iGain Protocol
  • iGain Protocol
  • Introduction
    • Basic Concepts of Options
    • A Decentralized Approach
  • The Core Protocol
    • Long and Short Tokens
    • Built-in DEX
      • Liquidity Provider
      • Advanced: Customized Proportion
    • Buy/Sell Options
    • Redemption
  • System Properties
    • Protocol Fee & Dynamic Trading Fee
  • iGain Universe
    • Impermanent Gain
      • Background: AMM & IL
      • Price Settlement
      • Hedge with Impermanent Gain
      • Gain with iGain
    • Interest Rate Synth
      • Introduction
      • Price Settlement
      • Fixed APY Borrowing/Lending
        • Examples
      • All-in-one Proxy
      • Underlying Token
  • Contracts
  • FAQ
Powered by GitBook
On this page
  • Buy Options
  • Sell Options

Was this helpful?

  1. The Core Protocol

Buy/Sell Options

PreviousAdvanced: Customized ProportionNextRedemption

Last updated 4 years ago

Was this helpful?

The traders who are going to hedge certain risk or speculate on options may follow the below process to buy Long/Short tokens:

Buy Options

There is no DAI/Long pair in the AMM pool of iGain. To acquire Long token would require the mintage of Long+Short tokens with DAI, and then swap all the minted Short token into Long token.

We will illustrate the process with an example:

Given 10,000 Long + 200 Short tokens in current pool,

how many DAI should I pay to acquire 20 Long tokens?

We set the inputted DAI as x. The system would mint x Long and x Short tokens with deposited x DAI in the first place, then exchanging x Short tokens into y Long tokens through the pool as shown below:

According to the constant product market-making model, their relationship would be:

By solving the above 2 simultaneous equations, we can get:

By calculations, we can find that a total of 3.38 DAI is required to purchase 20 Long tokens, which makes the price per Long token 0.169 DAI.

Sell Options

Long or Short tokens cannot be directly swapped back into DAI. Withdrawing DAI back before expiration should always follow the rule 1 Long + 1 Short → 1 DAI . Therefore, a Long token holder should swap part of Long tokens into Short tokens so that there are the same amount of Long and Short tokens, then the corresponding amount of DAI may be claimed.

This process is shown in the below diagram:

(1000−y)(200+x)=1000×200(1000-y)(200+x)=1000\times200(1000−y)(200+x)=1000×200

After swapping, there will be x+yx+yx+y Long tokens in hand. Therefore we can conclude the second equation:

x+y=20x+y=20x+y=20
x=3.38y=16.62x=3.38\\ y=16.62x=3.38y=16.62
Exchanging x DAI into 20 Long