Pods Options
app.pods.financeGithubBlogDiscord
  • Getting Started
  • Understand Options
    • What are options?
    • How do options work?
    • Pricing Options
  • The Protocol
    • Overview
    • Safety Measures
    • Ecosystem Participants
    • Use Cases
  • Options
    • Overview
    • Options Instrument
      • Variables
      • Functions
        • Mint
        • Unmint
        • Withdraw
        • Exercise
    • Smart Contracts
      • OptionFactory
      • PodPut
      • WPodPut
      • PodCall
      • WPodCall
    • Applied Use Cases
    • Understanding Returns
  • Options AMM
    • Overview
    • Options AMM
      • Variables
      • Components
      • Functions
        • Add Liquidity
        • Re-add Liquidity
        • Trade
        • Remove Liquidity
      • Pricing
      • Find The Next IV
      • Fees
      • Scenarios
        • LP Simulations
    • Smart Contracts
      • OptionAMMPool
      • OptionAMMFactory
      • OptionPoolRegistry
    • Applied Math
  • Developers
    • System Overview
    • Deployed Contracts
    • Dev Environment
  • Interfacing with Pods
    • Brand Assets
  • Code Integration Guides
    • Integrating with Pods (video)
    • How To Create Your Own Option
    • How To Create Your Own Pool
    • How To Trade (Buy/Sell)
    • How To Exercise
    • How To Remove Liquidity
  • User Guides
    • Videos
  • Security
    • Audits
  • APPENDIX
    • FAQ
    • Glossary of Terms
  • Additional Resources
  • app.pods.finance
  • Github
  • Blog
  • Discord
  • Twitter
  • Pods v0 Docs
Powered by GitBook
On this page
  • Main contracts
  • OptionAMMFactory
  • Configuration Manager
  • OptionAMMPool
  • Auxiliary Contracts
  • BlackScholes
  • IVGuesser
  • NormalDistribution
  • IVProvider
  • PriceProvider
  • PriceProvider
  • PriceProvider
  • ChainlinkPriceFeed
  • FeePool
  • Emergency Stop

Was this helpful?

  1. Options AMM

Smart Contracts

PreviousLP SimulationsNextOptionAMMPool

Last updated 3 years ago

Was this helpful?

Main contracts

OptionAMMFactory

Contract responsible for creating/deploying new AMM pair pools. It has only the following functions:

  • createPool()

  • getPool()

Configuration Manager

Contract responsible for managing all the addresses for the auxiliary contracts. It contains BlackScholes, IVGuesser, IVProvider, NormalDistribution, and Price Provider setters and getters.

OptionAMMPool

The contract pool responsible for trade, add and remove liquidity of a pair PodOption:ERC20. Some of the actions that you can do:

  • addLiquidity()

  • removeLiquidity()

  • tradeExactAInput()

  • tradeExactAOutput()

  • tradeExactBInput()

  • tradeExactBOutput()

  • getUserBalance()

  • getPoolBalances()

  • getRemoveLiquidityAmounts()

Auxiliary Contracts

BlackScholes

Contract responsible for the calculation of the BlackScholes formula for Puts and Calls. This contract uses the NormalDistribution contract to calculate the probability functions. You can check the prices using:

  • getCallPrice()

  • getPutPrice()

IVGuesser

To find the IV (also known as sigma) for a given price is not trivial. We need to use a numeric method. This contract is responsible for the interaction process that will find the IV given a targetPrice depending if the option is a Call or a Put. For gas cost purposes, a variable called IVInitialGuess can be passed to help the numeric method converge faster.

  • getCallIV()

  • getCallPut()

NormalDistribution

Since we do not have libraries to deal with normal distribution functions, and our goal is to be as cost-efficient as possible, we can use this contract to find probabilities given a Z using:

  • getProbability()

IVProvider

Contract responsible for finding the OracleIV of a given option. That IV will represent the external market IV of a given option, taking into account the option strike price, maturity, and underlying asset. As of now, the oracle is updated by the team (admin keys) since the current solutions for IV oracles are nascent. The weight of the Oracle IV can be reduced in big liquidity scenarios or increased, in low liquidity scenarios. We looking forward to exploring TWAP solutions in the future. This way users would need to do even more large transactions to manipulate the Pool's IV.

  • getIV()

  • updateIV()

  • setUpdater()

PriceProvider

Contract responsible for finding the spotPrice of a given asset that the priceFeed was previously registered. This contract can interact with many different price sources and even create an average between feeds. You can use it calling:

  • getPriceFeed()

  • latestRoundData()

  • getAssetPrice()

  • getAssetDecimals()

  • setAssetFeeds()

  • removeAssetFeeds()

PriceProvider

Contract responsible for finding the spotPrice of a given asset that the priceFeed was previously registered. This contract can interact with many different price sources and even create an average between feeds. You can use it calling:

  • getPriceFeed()

  • latestRoundData()

  • getAssetPrice()

  • getAssetDecimals()

  • setAssetFeeds()

  • removeAssetFeeds()

PriceProvider

Contract responsible for finding the spotPrice of a given asset that the priceFeed was previously registered. This contract can interact with many different price sources and even create an average between feeds. You can use it calling:

  • getPriceFeed()

  • latestRoundData()

  • getAssetPrice()

  • getAssetDecimals()

  • setAssetFeeds()

  • removeAssetFeeds()

ChainlinkPriceFeed

Its our facade Chainlink contract used to get spotPrice and even other data in future like implied volatility:

  • getLatestPrice()

  • latestRoundData()

  • decimals()

FeePool

Contract responsible for managing the fees paid to the LP providers. This contract is not supposed to be called from an EOA (external owned account). We are showing here only to make a more digestible understanding of the whole system.

Emergency Stop

Contract responsible for pause and resume a certain target contract.

Options AMM contracts diagram