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
  • Mint
  • 1) Required Collateral Amount
  • 2) Consult Balances
  • 2.1) Consult Current
  • 2.2) Consult Current
  • 3) Calculate
  • 4) Updates
  • 4.1) Update
  • 4.2) Update
  • 4.3) Update
  • 4.4) Update

Was this helpful?

  1. Options
  2. Options Instrument
  3. Functions

Mint

Understanding the minting function step-by-step.

Mint

The event of minting an option requires the following initial information: 1. Option Amount 2. Owner

After the information was supplied to the contract, the mint function will perform the following activities:

1) Required Collateral Amount

Calculate the number of assets the user has to send to the contract to lock as collateral.

If this is a put option:

AmountToTransfer=OptionsAmount⋅StrikePriceAmountToTransfer=OptionsAmount\cdot StrikePriceAmountToTransfer=OptionsAmount⋅StrikePrice

If this is a call option:

AmountToTransfer=OptionsAmount⋅UnderlyingAssetAmountToTransfer=OptionsAmount\cdot UnderlyingAssetAmountToTransfer=OptionsAmount⋅UnderlyingAsset

2) Consult Balances

2.1) Consult Current StrikeReservesnStrikeReserves_nStrikeReservesn​

StrikeReservesnStrikeReserves_nStrikeReservesn​ is a variable where we store the current amount of the strike asset. If the strike asset is an interest-bearing token, it is expected that StrikeReservesnStrikeReserves_nStrikeReservesn​ will have accrued some interest since the last period. We are calling balanceOf() from ERC20 strike asset to check option contract strike asset balance.

StrikeReservesn=StrikeReservesi−1+aTokensYieldStrikeReserves_n=StrikeReserves_{i-1}+aTokensYield StrikeReservesn​=StrikeReservesi−1​+aTokensYield

2.2) Consult Current UnderlyingReservesnUnderlyingReserves_nUnderlyingReservesn​

UnderlyingReservesnUnderlyingReserves_nUnderlyingReservesn​is a variable where we store the total amount of underlying assets currently locked in the protocol. This function has a precise fit with call options since in call options, the underlying asset is the asset locked as collateral. We are calling balanceOf() from ERC20 an underlying asset to check option contract strike asset balance.

3) Calculate OwnerSharesiOwnerShares_iOwnerSharesi​

OwnerSharesiOwnerShares_iOwnerSharesi​ is a variable that stores the shares of the user based on the current option contract situation.

If i=0,OwnerSharesi=AmountToTransferi=0, OwnerShares_i=AmountToTransferi=0,OwnerSharesi​=AmountToTransfer

If i≠0,i≠0,i=0,we identify the following cases:

If this is a put option:

OwnerSharesi=AmountToTransfer⋅TotalSharesi−1StrikeReservesn+(UnderlyingReservesi⋅StrikePrice)\displaystyle OwnerShares_i=\frac{AmountToTransfer\cdot TotalShares_{i-1}}{StrikeReserves_n+(UnderlyingReserves_i \cdot StrikePrice)}OwnerSharesi​=StrikeReservesn​+(UnderlyingReservesi​⋅StrikePrice)AmountToTransfer⋅TotalSharesi−1​​

If this is a call option:

OwnerSharesi=AmountToTransfer⋅TotalSharesi−1UnderlyingReservesi+StrikeReservesiStrikePrice\displaystyle OwnerShares_i=\frac{{AmountToTransfer\cdot TotalShares_{i-1}}}{UnderlyingReserves_i+\frac{StrikeReserves_i}{StrikePrice}}OwnerSharesi​=UnderlyingReservesi​+StrikePriceStrikeReservesi​​AmountToTransfer⋅TotalSharesi−1​​

4) Updates

4.1) Update TotalSharesiTotalShares_iTotalSharesi​

TotalSharesTotalSharesTotalShares is the sum of all the owner's individual factor of OwnerSharesOwnerSharesOwnerShares.

TotalSharesi=TotalSharesi−1+OwnerSharesiTotalShares_i = TotalShares_{i-1} +OwnerShares_i TotalSharesi​=TotalSharesi−1​+OwnerSharesi​

4.2) Update UserMintedOptionsiUserMintedOptions_iUserMintedOptionsi​

Update the current number of outstanding options minted by the same user on the same option series.

UserMintedOptions=UserMintedOptionsi−1+OptionsAmountUserMintedOptions=UserMintedOptions_{i-1}+OptionsAmountUserMintedOptions=UserMintedOptionsi−1​+OptionsAmount

4.3) Update OwnerSharesiOwnerShares_i OwnerSharesi​

This factor updates the current owner shares. Important: If the user had previously minted options, those would be accounted for as one factor.

OwnerSharest=OwnerSharesi−1+OwnerSharesiOwnerShares_t =OwnerShares_{i -1}+OwnerShares_i OwnerSharest​=OwnerSharesi−1​+OwnerSharesi​

4.4) Update StrikeReservesiStrikeReserves_iStrikeReservesi​

UsingStrikeReservesnStrikeReserves_nStrikeReservesn​ (accrued with interest from the last period) we'll add the AmountToTransferAmountToTransferAmountToTransfer to transfer used while minting this option.

StrikeReservesi=StrikeReservesn+AmountToTransferStrikeReserves_i=StrikeReserves_n+AmountToTransferStrikeReservesi​=StrikeReservesn​+AmountToTransfer

This session described mathematically how the contract logic works. It is not needed to update the total ERC20 balances at the code level since tokens transfer to or from the contract is automatically updated with the ERC20 implementation.

Minting options ✅

PreviousFunctionsNextUnmint

Last updated 4 years ago

Was this helpful?