Carmine Options AMM
  • Intro
  • What we are aiming for
  • Audit
  • Carmine Academy
  • How to use the app
  • Use cases
  • Organization
    • Team
  • Mechanics - Basic Overview
    • Liquidity Pools
    • Initialization of new pairs and new options
    • Price Adjustments
    • Examples
  • Tokenomics
    • Tokenomics
    • Token Allocation
    • Distribution of Fees
    • Voting about Treasury and community projects
  • Usage
    • For Hedging
    • For Speculation
    • For Trading
    • Arbitraging the AMM
    • Future Use Cases Unlocked by the Composability of DeFi
      • Hedging Impermanent Loss
  • Mechanics - Deeper Look
    • Option Pricing Mechanics
    • Fees
    • Volatility Updates
    • Slippage
  • Tech docs
    • Mainnet addresses
    • Smart Contract Architecture
    • Deprecated Smart Contract v1 Endpoints
    • Smart Contract v2 Endpoints
Powered by GitBook
On this page
  1. Tech docs

Smart Contract Architecture

PreviousMainnet addressesNextDeprecated Smart Contract v1 Endpoints

Last updated 1 year ago

TLDR

  • Each underlying asset (currency pair) has a separate liquidity pool for put options and a separate pool for call options.

  • Call options are denominated in base tokens (ETH in case of ETH/USDC) and put options in quote tokens (USDC in case of ETH/USDC). This means that to:

    • to trade put options, you need the quote tokens to pay premia or put up collateral

    • to trade call options, you need base tokens to pay premia (if you're buying the options) or put up collateral (if you're selling the options)

  • All capital is held by the AMM and allocated through internal accounting. Options and LP tokens themselves are not in possession of any other ERC20 tokens such as ETH or USDC.

  • Options are ERC20 tokens representing a right or obligation to trade. The obligation is enforced by locking in capital at the moment of trade.

  • Closing position and making opposite position are not equivalent. First actually closes position (burns option token) and releases capital. Second mints new option token, so the user is net 0, but his/her locked capital was not released.

  • Price changes by change in price of underlying asset or by trading options. First is external variable that we take from oracles. Second is based on realized supply/demand (actual trading) and it is done through changing the volatility parameter.

Architecture

The governance contract is the admin of all other contracts – LP tokens, option tokens, etc. Only the governance contract can upgrade the other contracts.

The governance can also upgrade itself if a proposal is passed in a vote.

The AMM holds all capital and distributes Option tokens and LP tokens for users who trade or stake, respectively.

Please refer to our for source code and details. The code is well-commented, but if anything is unclear, you're welcome to ask in the #development channel on our .

GitHub
Discord