# Options Logics

{% hint style="info" %}
In code, many base PRECISION are used to avoid, arithmetic, division or modulo by zero errors.
{% endhint %}

### Strike Price Gains calculation

{% code title="Options.sol" %}

```solidity
function calculateStrikePriceGains(
    uint128 depositedAmount,
    uint128 strikePrice,
    uint64 ethPrice
    )
```

{% endcode %}

{% code title="Options.sol" %}

```solidity
if(currentEthValue > strikePrice){
    ethToReturn = (currentEthValue - strikePrice)/currentEthPrice;
}else{
    ethToReturn = 0;
}
```

{% endcode %}

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

* [Borrowing Withdraw.](/autonomint/blockchain-docs/core-contracts/borrowing.md#withdraw)

### 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,

&#x20;           a = ETH Volatility&#x20;

&#x20;           b = dCDS Vault value/ ETH Vault value (including borrower’s ETH value).&#x20;

&#x20;           E = ETH price.

* ETH volatility is get from backend API.
* dCDS Vault value is get from Borrowing contract [omniChainBorrowingCDSPoolValue](/autonomint/blockchain-docs/core-contracts/borrowing.md#omnichainborrowingcdspoolvalue).
* ETH Vault value is get from Treasury contract [omniChainTreasuryTotalVolumeOfBorrowersAmountInUSD](/autonomint/blockchain-docs/core-contracts/treasury.md#omnichaintreasurytotalvolumeofborrowersamountinusd).
* ETH price is get param.

Functions which are using the above logic

* [Borrowing Deposit.](/autonomint/blockchain-docs/core-contracts/borrowing.md#deposittokens)

{% hint style="info" %}
In code, the constants  0.4, 0.1, 0.05, 0.01, 0.005 are multiplied with base of 1000.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nondollar.life/autonomint/blockchain-docs/core-logics/options-logics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
