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

Was this helpful?

  1. Code Integration Guides

How To Exercise

In order to exercise an option, is pretty simple. You just need to have the options address and PodOption interface. Do not forget to approve first the underlying

PodOption Interface below:

pragma solidity 0.6.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IPodOption is IERC20 {
    enum OptionType { PUT, CALL }
    enum ExerciseType { EUROPEAN, AMERICAN }

    event Mint(address indexed minter, uint256 amount);
    event Unmint(address indexed minter, uint256 amount);
    event Exercise(address indexed exerciser, uint256 amount);
    event Withdraw(address indexed minter, uint256 amount);

    function mint(uint256 amountOfOptions, address owner) external;

    function exercise(uint256 amountOfOptions) external;

    function withdraw() external;

    function unmint(uint256 amountOfOptions) external;

    function optionType() external view returns (OptionType);

    function exerciseType() external view returns (ExerciseType);

    function underlyingAsset() external view returns (address);

    function underlyingAssetDecimals() external view returns (uint8);

    function strikeAsset() external view returns (address);

    function strikeAssetDecimals() external view returns (uint8);

    function strikePrice() external view returns (uint256);

    function strikePriceDecimals() external view returns (uint8);

    function expiration() external view returns (uint256);

    function endOfExerciseWindow() external view returns (uint256);

    function hasExpired() external view returns (bool);

    function isAfterEndOfExerciseWindow() external view returns (bool);

    function strikeToTransfer(uint256 amountOfOptions) external view returns (uint256);

    function getSellerWithdrawAmounts(address owner)
        external
        view
        returns (uint256 strikeAmount, uint256 underlyingAmount);

    function underlyingReserves() external view returns (uint256);

    function strikeReserves() external view returns (uint256);
}

After allowing the PodOption to transfer the underlying token on your behalf, then you can perform the exercise. Example below:

// 1) Instantiate the Option token using the optionAddress
// You can get a current optionAddress from the deployedContracts 
// section
IPodOption option = IPodOption(optionAddress);

// 2) Approve option contract to spend yours underlyingToken
IERC20 underlyingToken = IERC20(underlyingTokenAddress);

underlyingToken.approve(optionAddress, amountOfUnderlying);

// 3) Call the exercise function giving the amount of options
// to exercise as an input.
option.exercise(amountOfOptions);
PreviousHow To Trade (Buy/Sell)NextHow To Remove Liquidity

Last updated 4 years ago

Was this helpful?