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
  • Unmint
  • 1) Consult Balances
  • 1.1) Consult current
  • 1.2) Consult current
  • 2) Calculate factors
  • 2.1) Calculate
  • 2.2) Calculate
  • 2.3) Calculate
  • 3) Updates
  • 3.1) Update
  • 3.2) Update
  • 3.3) Update
  • 3.4) Update
  • 4) Burn options

Was this helpful?

  1. Options
  2. Options Instrument
  3. Functions

Unmint

Unminting an option is similar to the withdraw function, check below the major differences.

Unmint

The unmint function is a function to assist options sellers that decide to leave the position before expiration.

To do so, the option seller has to buy the equivalent amount of options in the secondary market (in the options AMM) and use them together with the address that it holds (owner) the position to unmint.

‌Note that this leaves the seller on the option price exposure because it can happen that when they decide to leave the position, the options in the market are above the premium they received. "Buying back" the options at a higher price to leave a position can incur a loss.

Unmint function is very similar to the withdraw function. The differences are:

  • Withdraw function can only happen after expiration.

  • The withdraw function only allows users to withdraw 100% off the funds.

  • In European options, unmint will never result in removing two assets (strike asset and underlying asset). Instead, unmint will only return the funds that were previously provided as collateral since options weren't exercised yet.

  • The withdraw function can return a combination of assets (underlying and strike asset) since a few buyers may exercise the options during the expiration window.

The event of unminting options requires the following information: 1. Amount of options to unmint 2. Owner

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

1) Consult Balances

1.1) Consult current StrikeReservesnStrikeReserves_nStrikeReservesn​

This step will fit its purpose better in a put option, where the collateral is in strike asset.

This balance should reflect the new current strikeReserves, considering the interest that could accrue in the meanwhile. We are calling balanceOf()from ERC20 strike asset to check option contract strike asset balance.

1.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 the underlying asset is the asset locked as collateral in call options. We callbalanceOf()from an ERC20 underlying asset to check the option contract's strike asset balance.

2) Calculate factors

2.1) Calculate OwnerShareswOwnerShares_wOwnerSharesw​

This step calculates the proportional shares the user will unmint from its current position, considering his contract shares.

OwnerSharesw=AmountOfOptionsToWithdraw⋅OwnerSharesi−1UserMintedOptions\displaystyle OwnerShares_w=\frac{AmountOfOptionsToWithdraw\cdot OwnerShares_{i-1}}{UserMintedOptions}OwnerSharesw​=UserMintedOptionsAmountOfOptionsToWithdraw⋅OwnerSharesi−1​​

2.2) Calculate StikeToSendStikeToSendStikeToSend

This step is most fit with put options since the collateral in put options is in strike asset.

This step calculates the number of strike assets a user would need to receive for this unminting process.

StrikeToSend=OwnerSharesw⋅StrikeReservesnTotalSharesi−1\displaystyle StrikeToSend=\frac{OwnerShares_w\cdot StrikeReserves_n}{TotalShares_{i-1}}StrikeToSend=TotalSharesi−1​OwnerSharesw​⋅StrikeReservesn​​

2.3) Calculate UnderlyingToSendUnderlyingToSendUnderlyingToSend

This step is most fit with call options since the collateral in calls is in the underlying asset.

3) Updates

3.1) Update TotalSharesiTotalShares_iTotalSharesi​

TotalSharesiTotalShares_iTotalSharesi​ is the sum of all the user's shares.

TotalSharesi=TotalSharesi−1−OwnerShareswTotalShares_i = TotalShares_{i-1} -OwnerShares_w TotalSharesi​=TotalSharesi−1​−OwnerSharesw​

Notice the negative sign here is different from the pure mint function since it removed funds and, therefore, should reduce the number of shares.

3.2) Update OwnerSharesiOwnerShares_iOwnerSharesi​

This factor updates the current total amount of user shares.

OwnerSharesi=OwnerSharesi−1−OwnerShareswOwnerShares_i=OwnerShares_{i-1}-OwnerShares_w OwnerSharesi​=OwnerSharesi−1​−OwnerSharesw​

3.3) UpdatestrikeReservesnstrikeReserves_nstrikeReservesn​

They are used in the case of a put option.

Using the current StrikeToSendStrikeToSendStrikeToSend (accrued with interest from the last period), we'll deduct the amount of strike to transfer used while minting this option.

StrikeReservesi=StrikeReservesi−1−StrikeToSendStrikeReserves_i=StrikeReserves_{i-1} - StrikeToSendStrikeReservesi​=StrikeReservesi−1​−StrikeToSend

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.

3.4) Update UnderlyingReservesiUnderlyingReserves_iUnderlyingReservesi​

They are used in the case of a call option.

Using the current UnderlyingReservesnUnderlyingReserves_nUnderlyingReservesn​ (accrued with interest from the last period), we'll deduct the amount of UnderlyingToSendUnderlyingToSendUnderlyingToSend used while minting this option.

UnderlyingReservesi=UnderlyingReservesn−UnderlyingToSendUnderlyingReserves_i=UnderlyingReserves_n-UnderlyingToSendUnderlyingReservesi​=UnderlyingReservesn​−UnderlyingToSend

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.

4) Burn options

After the unmint function is processed, the options tokens will be burned.

Unminting options ✅

PreviousMintNextWithdraw

Last updated 4 years ago

Was this helpful?