Autonomint
Blockchain Docs
Blockchain Docs
  • GETTING STARTED
    • Overview
    • Contracts Overview
  • Core Contracts
    • Borrowing
    • CDS
    • Treasury
    • Options
    • MultiSign
    • BorrowLiquidation
    • GlobalVariables
  • Core Logics
    • Borrowing Logics
    • CDS Logics
    • Treasury Logics
    • Options Logics
    • BorrowLiquidation Logics
  • Deployed Contracts Addresses
Powered by GitBook
On this page
  • Strike Price Gains calculation
  • Option Fees Calculation
  1. Core Logics

Options Logics

Here the logics used in options contract are explained.

PreviousTreasury LogicsNextBorrowLiquidation Logics

Last updated 11 months ago

In code, many base PRECISION are used to avoid, arithmetic, division or modulo by zero errors.

Strike Price Gains calculation

Options.sol
function calculateStrikePriceGains(
    uint128 depositedAmount,
    uint128 strikePrice,
    uint64 ethPrice
    )
Options.sol
if(currentEthValue > strikePrice){
    ethToReturn = (currentEthValue - strikePrice)/currentEthPrice;
}else{
    ethToReturn = 0;
}

Compare the current USD value of the deposited amount and strike price value of the deposited amount chose by user. If the current value is greater, then the user will get gains, since the current ETH price is higher than the strike price. If its low, then user will get no gains from options.

Functions which are using the above logic

Option Fees Calculation

5% Strike Price = [(10*a*E)^½ + 3*(1/b)] + 0.4*((10*a*E)^½ + 3*(1/b))/(3*a)

10% Strike Price = [(10*a*E)^½ + 3*(1/b)] + 0.1*((10*a*E)^½ + 3*(1/b))/(3*a)

15% Strike Price = [(10*a*E)^½ + 3*(1/b)] + 0.05*((10*a*E)^½ + 3*(1/b))/(3*a)

20% Strike Price = [(10*a*E)^½ + 3*(1/b)] + 0.01*((10*a*E)^½ + 3*(1/b))/(3*a)

25% Strike Price = [(10*a*E)^½ + 3*(1/b)] + 0.005*((10*a*E)^½ + 3*(1/b))/(3*a)

where,

a = ETH Volatility

b = dCDS Vault value/ ETH Vault value (including borrower’s ETH value).

E = ETH price.

  • ETH volatility is get from backend API.

  • ETH price is get param.

Functions which are using the above logic

In code, the constants 0.4, 0.1, 0.05, 0.01, 0.005 are multiplied with base of 1000.

dCDS Vault value is get from Borrowing contract .

ETH Vault value is get from Treasury contract .

Borrowing Withdraw.
omniChainBorrowingCDSPoolValue
Borrowing Deposit.
omniChainTreasuryTotalVolumeOfBorrowersAmountInUSD