# Getting Started

Welcome to the official documentation page of Deri Protocol

{% embed url="<https://www.youtube.com/watch?v=Xi26wceLffE>" %}

## What is Deri Protocol?

**Deri, your option, your future!**

Deri Protocol is the Derivative Protocol of Web3, offering a comprehensive one-stop solution for on-chain hedging, speculation, and arbitrage. It currently supports four key derivative types: futures, options, power perps, and Gamma swaps. Structured as an xDapp, Deri Protocol masterfully consolidates liquidity across various layer 1 and layer 2 blockchains, achieving unparalleled liquidity for derivative trading.\
\
[Perpetual Futures](https://deri.io/#/pro/trade/futures)

[Everlasting Options](https://deri.io/#/pro/trade/option/BTCUSD-40000-C)

[Power Perpetuals](https://deri.io/#/pro/trade/power/BTC^2)

[Gamma Swap](https://deri.io/#/pro/trade/gamma/BTC-Gamma)

## What makes Deri Protocol so special?

As the solution to decentralized derivative exchange, Deri Protocol is designed with all the defining features of DeFi and financial derivatives in its nature

* **Flexibility of Network:** Deri Protocol excels in providing traders with access to a wide range of blockchain networks. Traders can choose their preferred blockchain and enjoy a consistent trading experience, enabling them to focus on executing trades and staying ahead of the curve.&#x20;
* **Consolidated Liquidity for Enhanced Trading**: By pooling liquidity from all supported networks, Deri Protocol ensures that traders have access to deeper and more robust markets. This consolidation reduces fragmentation and sippage, enabling traders to execute orders with greater efficiency and liquidity across multiple networks.&#x20;
* F**aster Execution and Reduced Gas Costs**: Deri Protocol employs a novel approach to enhance trading speed and reduce gas costs. By executing the main logic on Deri's Layer 3 infrastructure, the protocol significantly improves transaction processing times. Traders benefit from faster order execution and trade settlements, as well as reduced gas fees.&#x20;
* **Real derivative**: The PnL’s of the users’ positions are calculated with mark price updated by oracle, which ensures precision; positions are maintained by a margin, which provides built-in leverage.&#x20;
* **External Custody**: The user capital, upon deposit, will be stored into a money market protocol, which are proven by time and scale. Liquidity Provider and Traders earn additionally yield - interest and also the protocol's liquidity mining rewards.&#x20;
* &#x20;**Dynamic liquidity providing:** Allows liquidity providers to choose one or more from the supported range of base tokens to provide liquidity.&#x20;
* **Composability**: Positions are tokenized as non-fungible tokens (NFT), which can be held, transferred or imported into any other DeFi projects for their own financial purposes (as blocks in their own “lego game”).&#x20;

{% hint style="success" %}
Interest aroused? For even deeper insights feel free to study our recent: [Whitepaper](/library/whitepaper)
{% endhint %}

## Key Roles

Our ecosystem is an entity made up of a variety of essential contributors and Key Roles, each performing an important task.

1. **Liquidity Providers**\
   Liquidity providers provide liquidity to the pools to gain transaction fees, funding fees and DERI awards, etc., and are therefore playing the counterparty of the traders.
2. **Traders**\
   These are the end-users of the Deri Protocol, i.e. those who use Deri Protocol to trade derivatives.
3. **Arbitragers**\
   Arbitragers are a special type of trader, which are induced by funding fee arbitrage to balance the two sides of long and short positions.
4. **Position liquidators**\
   When a position is breaching the liquidation line, a liquidator can pay the gas to liquidate the position and share part of the position’s remaining margin as an award.

{% hint style="info" %}
**What is a derivative in finance?**\
\
A derivative is a contract that derives its value from the performance of an underlying entity, also called underlying, which can be an asset, an index or an interest rate. Investors/traders typically use derivatives for 3 reasons: to hedge, to increase leverage, or to speculate on an asset's movement
{% endhint %}


# Deri Lite

##

<br>


# Perpetual Futures

**Open a Position**

**Step 1:** Switch to Lite version, enter the Lite interface.&#x20;

<figure><img src="/files/VSAV8aPqXluR5WsJLWdY" alt=""><figcaption></figcaption></figure>

**Step 2:** Click the downward arrow,on the popped-up "Select Market" panel, choose "Futures". Then, select a symbol you want to trade.  Here taking the BTC as the example.&#x20;

<figure><img src="/files/9yFCHKgxp6kwZUrMNxKo" alt=""><figcaption></figcaption></figure>

**Step 3:** Choose if you wish to long or short your position on the “Buy/Sell” section (Taking long as an example here).\
\
Then, select a base token to buy assets: Click on the downward arrow, choose a base token with a balance in your wallet (using USDC as an example in this case).<br>

<figure><img src="/files/m4OV1yZMygEP7ze0OMGD" alt=""><figcaption></figcaption></figure>

**Step 4:** Set the notional amount in BTC you’d like to buy (Or you can directly enter the notional amount in USDC, it will be converted to BTCs equivalent). Adjust the leverage through buttons/slider, the leverage can go up to 25x. After setting, click on "Long BTC".\
\
On the popped-up wallet interface, click on "Confirm." Open the position successfully now.

Information of the position(s) you have opened up, will be included in your “Positions” tab.<br>

<figure><img src="/files/NzGAEnPljVfIoIR6FLzT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/SoTFOFMyStdiPNII3vz9" alt=""><figcaption></figcaption></figure>

You can add / remove the position’s collateral.\
\
**Add collateral**&#x20;

Click ‘+’ button, choose ‘Add’ section, set the notional amount in USDC you’d like to add through manually entering or selecting a percentage of your wallet balance. Then, click ‘Add Collateral’.

After confirming in the wallet, your collateral adding is done. Check the updated number in the ‘Collateral’ column.&#x20;

<figure><img src="/files/QDoXDYSugitG8drrxMVI" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/DW4WLLSw02QQq2r6OVGh" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6RT5le3xFHxCSUMstKfo" alt=""><figcaption></figcaption></figure>

**Remove collateral**&#x20;

Choose ‘Remove’, set the notional amount in USDC you’d like to remove through manually entering or selecting a percentage of the available balance. Then, click ‘Remove Collateral’.

After confirming in the wallet, your collateral removal is done. Check the updated number in the ‘Collateral’ column.<br>

<figure><img src="/files/BB7C6y3uSHcjVhjgvSig" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/YgK14nmCqvKNDn0GcC0r" alt=""><figcaption></figcaption></figure>

**Close a Position**\
\
**Step 1:** Click “Close” in the position tab. Set the position size you want to close through manually entering a specific size or selecting a percentage of the current position size. (100% means complete close) Then, click ‘Close’.

<figure><img src="/files/0to2eaHnk8U7uQAx8Fhw" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/n62v4UVgJdAC2RARbhZh" alt=""><figcaption></figcaption></figure>

**Step 2:** After confirming in the wallet, close the position successfully now. You can view your detailed trading history in the “History” section.&#x20;

<figure><img src="/files/TYbWiPCoM6K8tmpdFg2s" alt=""><figcaption></figcaption></figure>

\
\ <br>

<br>

\ <br>

##


# Everlasting Options

**Open a Position**

**Step 1:** Switch to Lite version, enter the Lite interface.

<figure><img src="/files/rlBcYMeZDH94fjzxVVCB" alt=""><figcaption></figcaption></figure>

**Step 2:** Click the downward arrow,on the popped-up "Select Market" panel, choose "Options". Then, select a strike you want to trade.  Here taking the BTCUSD-30000-C as an example.

<figure><img src="/files/1q66YlfVJ8Da8wsJv39W" alt=""><figcaption></figcaption></figure>

**Step 3:** Choose if you wish to long or short your position on the “Buy/Sell” section (Taking long as an example here).\
\
Then, select a base token to buy assets: Click on the downward arrow, choose a base token with a balance in your wallet (using USDC as an example in this case).

<figure><img src="/files/i7uxgIKNqVB01yXtGoAf" alt=""><figcaption></figcaption></figure>

**Step 4:** Set the amount in BTCUSD-30000-C you’d like to buy (Or you can directly enter the notional amount in USDC, it will be converted to the strike equivalent). Adjust the leverage through buttons/slider, the leverage can go up to 10x. After setting, click on "Buy BTC $30,000 Call‘’.\
\
On the popped-up wallet interface, click on "Confirm." Open the position successfully now.\
\
Information of the position(s) you have opened up will be included in your “Positions” tab.

<figure><img src="/files/YgL0YZJk0OwRXNsq0Ca1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/kyapKm4DFrlWDIWvLzmd" alt=""><figcaption></figcaption></figure>

You can add / remove the position’s collateral.

**Add collateral**&#x20;

Click ‘+’ button, choose ‘Add’ section, set the notional amount in USDC you’d like to add through manually entering or selecting a percentage of your wallet balance. Then, click ‘Add Collateral’.

After confirming in the wallet, your collateral adding is done. Check the updated number in the ‘Collateral’ column.

<figure><img src="/files/7qr7zHBifJXvQ67nl0Jo" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/jLI1kiYABoELSfiRUiIj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/00s8LajgwmGSheQByUpf" alt=""><figcaption></figcaption></figure>

**Remove collateral** \
\
Choose ‘Remove’, set the notional amount in USDC you’d like to remove through manually entering or selecting a percentage of the available balance. Then, click ‘Remove Collateral’.

After confirming in the wallet, your collateral removal is done. Check the updated number in the ‘Collateral’ column.&#x20;

<figure><img src="/files/agJkKAQJ6oIxUHamFFm3" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ufl3n1E5V05RLu5BFQHT" alt=""><figcaption></figcaption></figure>

**Close a Position**\
\
**Step 1:** Click “Close” in the position tab. Set the position size you want to close through manually entering a specific size or selecting a percentage of the current position size. (100% means complete close) Then, click ‘Close’.

<figure><img src="/files/jLQTOjkRzMoLFdFrkGsE" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cxXKmjxYR9XIzhGboRQt" alt=""><figcaption></figcaption></figure>

**Step 2:** After confirming in the wallet, close the position successfully now. You can view your detailed trading history in the “History” section.

<figure><img src="/files/9HNa9ahAy5N9UQO5DPYr" alt=""><figcaption></figcaption></figure>

\ <br>

\
\
\ <br>

<br>


# Power Perpetuals

**Open a Position**

**Step 1:** Switch to Lite version, enter the Lite interface.

<figure><img src="/files/M1FkVIBTWagY3DcUTm6F" alt=""><figcaption></figcaption></figure>

**Step 2:** Click the downward arrow,on the popped-up "Select Market" panel, choose "Powers" Then, select a symbol you want to trade.  Here taking the mBTC^2 symbol as an example.

<figure><img src="/files/FXw6wlvziR7sWNMquMkc" alt=""><figcaption></figcaption></figure>

**Step 3:** Choose if you wish to long or short your position on the “Buy/Sell” section (Taking long as an example here).\
\
Then, select a base token to buy assets: Click on the downward arrow,  choose a base token with a balance in your wallet (using USDC as an example in this case).&#x20;

<figure><img src="/files/87a5h9bKtQ0VSdxn2Lid" alt=""><figcaption></figcaption></figure>

**Step 4:** Set the amount in mBTC^2 you’d like to buy (Or you can directly enter the notional amount in USDC, it will be converted to the symbol equivalent). Adjust the leverage through buttons/slider, the leverage can go up to 10x. After setting, click on "Long mBTC^2".\
\
On the popped-up wallet interface, click on "Confirm." Open the position successfully now.

Information of the position(s) you have opened up will be included in your “Positions” tab.

<figure><img src="/files/XDpHutzYVXRSAAdeE6MQ" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/A7Bs7IFOeKxDWkWNXTPM" alt=""><figcaption></figcaption></figure>

You can add / remove the position’s collateral.\
\
**Add collateral**&#x20;

Click ‘+’ button, choose ‘Add’ section, set the notional amount in USDC you’d like to add through manually entering or selecting a percentage of your wallet balance. Then, click ‘Add Collateral’.

After confirming in the wallet, your collateral adding is done. Check the updated number in the ‘Collateral’ column.&#x20;

<figure><img src="/files/4vUUxD5Fmbx71ycPH0Vf" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/AzMv8vgvSxgBqBfc8PuN" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/rkzMeYOcdUAChwqUHtxK" alt=""><figcaption></figcaption></figure>

**Remove collateral** \
\
Choose ‘Remove’, set the notional amount in USDC you’d like to remove through manually entering or selecting a percentage of the available balance. Then, click ‘Remove Collateral’.

After confirming in the wallet, your collateral removal is done. Check the updated number in the ‘Collateral’ column.&#x20;

<figure><img src="/files/JQAg5vUa9Anx9AK14btE" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/zjELlhxDfNd9oULLuMBv" alt=""><figcaption></figcaption></figure>

**Close a Position**\
\
**Step 1:** Click “Close” in the position tab. Set the position size you want to close through manually entering a specific size or selecting a percentage of the current position size. (100% means complete close) Then, click ‘Close’.

<figure><img src="/files/cHOqHDK9BqVbj6KZgXSw" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/DGS23lDP6xVbtlM1QESw" alt=""><figcaption></figcaption></figure>

**Step 2:** After confirming in the wallet, close the position successfully now. You can view your detailed trading history in the “History” section. <br>

<figure><img src="/files/H9Uf9V36iRKszjEQMjRy" alt=""><figcaption></figcaption></figure>

<br>

\
\
\
\
\ <br>


# Deri Pro


# Perpetual Futures

## **Deposit Margin**

**Step 1**: Visit the official website of the Deri Protocol: [https://deri.io](https://deri.io/). Click ‘Futures’ to enter Perpetual Futures section.

<figure><img src="/files/ZZPLvt6WoeLoplaebczC" alt=""><figcaption></figcaption></figure>

**Step 2**: Select a chain you want to trade on. Take 'Arbitrum' as the example. Click on the small arrow pointing downwards, choose “Arbitrum”, then you can start trading on Arbitrum now.

<figure><img src="/files/AVSqtajT2qYUlusYsZrD" alt=""><figcaption></figcaption></figure>

**Step 3:** Select the trading symbol. Click on the small arrow pointing upwards, which will open the market window. Take 'BTCUSD' as the example.

<figure><img src="/files/r8yHeaaIVzxHR8o7cGsk" alt=""><figcaption></figcaption></figure>

**Step 4:** Then click “Deposit” to transfer funds from wallet to Deri Protocol to add margin.

<figure><img src="/files/yUhJMf263x9EhNbLEn31" alt=""><figcaption></figcaption></figure>

**Step 5:** The account deposit window appears. Firstly, choose the base token you’d like to transfer to the Deri Protocol and use as margin, we’re taking USDC as the example. Secondly, enter the amount of USDC you’d like to transfer from your wallet (alternatively you can directly select the percentage by your total USDC amount in your wallet). Once you have decided on an amount, click” Deposit”.

<figure><img src="/files/VUHp6WQD9OHbuv7IXJ1h" alt=""><figcaption></figcaption></figure>

**Step 6:** Confirm your request on the wallet by clicking “Confirm” in order to have the funds transferred to Deri Protocol. Your deposit is successfully transferred once the hint prompts you. On the Account  Info panel, you can see your added margin.

<figure><img src="/files/k4nEMZwKhdA9xfXR97O5" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
You successfully added Margin to Deri Protocol.
{% endhint %}

Once you add Margin to your account, you're ready to open your first position

### **Open a position**

**Step 1:** Now we’re ready to open a BTCUSD position. Move to the “Buy” section, set the notional amount in BTC you’d like to buy (alternatively you can directly enter the notional amount in USD, it will be converted to BTCs equivalent). Instead of the manual input or the given percentage buttons, there is also a slider to adjust the desired amount. Click “Buy/Long”. \
\
**In this tutorial we'll open a Long (Buy position)**

<figure><img src="/files/sjk8Jv2wj5CALRy2RSpD" alt=""><figcaption></figcaption></figure>

**Step 2:** A transaction confirmation window appears which sums up all the transaction details. Once convinced, hit the “Buy/Long” button. Confirm your wallet request to open your position. The hint means you have successfully opened your position. The information about your open position(s) that you have opened is displayed on your “Positions” tab.<br>

<figure><img src="/files/PlbDA1s2dBZxUDKc4NEy" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/8ZJhDWDdRD3gJ3b8tR29" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can open multiple positions in the same pool, but note that the margin requirement is calculated at the account level . Read more in the [Margin Requirement](/how-it-works/margin-requirement)article
{% endhint %}

### **Close a position**

You can close your position completely or partially.

#### Completely close your position

**Step 1:** If you seek to close a specific position, you can click “Close” in the position tab ,which results in a complete close of your position. Once you hit the close button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully closed your position.<br>

<figure><img src="/files/rlsmmMLNXNx38eSr11FG" alt=""><figcaption></figcaption></figure>

**Step 2:** You can view your detailed trading history in the “History” section.&#x20;

<figure><img src="/files/IS5VIT5tvByk9pRRFw2g" alt=""><figcaption></figcaption></figure>

### Partially close your position:

You can also partially close a position.

**Step 1:** To do this, you simply need to partially trade your position in the opposite direction. If you opened your position using the "Buy" tab for example, switch to the "Sell" tab to short it partially. \
\
Make sure that the Close Only button is ticked. Use the slider & the predefined percentage buttons to choose the amount percentage you wish to close. Hit the button below to partially close your position.

<figure><img src="/files/oJDJeVFlFtpHM0vnFVAT" alt=""><figcaption></figcaption></figure>

**Step 2:** Once you hit the button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully partially closed your position. Your position info will be updated on your “Positions” tab.

<figure><img src="/files/HV4ALet4GeU25E7x4yIO" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A partial close lowers your margin usage and increases your available margin
{% endhint %}

### Add & Withdraw Margin

On account level (per pool), it is possible to add additional or withdraw available margin.\
\
Why should a trader add additional Margin?

* If position(s) of the same pool are in danger of being liquidated as it could fall below the margin requirement, it may be wise to add additional margin to prevent liquidation.&#x20;
* Trader seeks to increase his buy power i.e to open additional positions

There is also the possibility to remove available margin at the account level (by pool), but this has the direct consequence that trader's position(s) are closer to falling below the margin requirement, which would result in liquidation. Be cautious!\ <br>

{% hint style="warning" %}
Should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions of the same pool. \
\
Please note accordingly, forced liquidations are executed on the account level too. In that case, you would lose all of your margin balance, i.e. your margin balance would become 0. \
\
For more details refer to our  [Liquidation](/how-it-works/liquidation)or [Trading FAQ](/library/faqs/trading-faq)
{% endhint %}

{% hint style="info" %}
Some Deri Protocol pools support a mixed margin feature that allows an existing position backed by a certain base token to be extended using an additional, different supported base token of the same pool, to increase the margin available.
{% endhint %}

### Add Margin

The process of 'Add Margin' is the same as the one of 'Deposit Margin'.

### Withdraw Margin

**Step 1**: To withdraw available margin,  click "Withdraw".&#x20;

<figure><img src="/files/PKwligJ4ROWfODjwfUbm" alt=""><figcaption></figcaption></figure>

**Step 2**: Decide which base token you wish to withdraw, choose a quantity (The withdrawl amout can not exceed avaliable balance) and hit 'Withdraw' button.<br>

<figure><img src="/files/q1E9ApyW0lstf09bTK4A" alt=""><figcaption></figcaption></figure>

**Step 3**: Confirm your request on the wallet to have the funds transferred from Deri Protocol to your wallet. Your withdraw is successfully transferred once the hint occurs. Your balance will be updated in Accout Info panel.&#x20;

<figure><img src="/files/FNy5nED395u4jH0cWdjP" alt=""><figcaption></figcaption></figure>

## Backup RPC URLs

Deri Protocol is a group of smart contracts deployed on the blockchain, where the exchange of risk exposures takes place completely on-chain. The RPC is quite important from a trader's perspective because it allows you to query data and submit transactions on the blockchain on which Deri Protocol operates.

There may be times when the RPC URL is not as responsive as it should be. At these times, you may notice data being slow to load or not loading on Deri Protocol's trading page.

To continue using Deri Protocol during these times, we recommend you change the RPC URL in the network settings of your wallet. The page should load faster after changing the PRC URL.\
\
For a list of RPC URLs and their statuses: [https://chainlist.org/ <br>](<https://chainlist.org/&#xD;&#xA;>)

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above.&#x20;

We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!\ <br>


# Everlasting Options

{% embed url="<https://youtu.be/YqcKrgc_88c>" %}
How to trade on Deri Protocol - Everlasting Options
{% endembed %}

## **Deposit Margin**

**Step 1**: Visit the official website of the Deri protocol: [https://deri.io](https://deri.io/). Click ‘Options’ to enter the everlasting options section. <br>

<figure><img src="/files/kZFWJFrllsblKGNTGe8f" alt=""><figcaption></figcaption></figure>

**Step 2**:  Select a chain you want to trade on. Take 'Arbitrum' as the example. Click on the small arrow pointing downwards, choose “Arbitrum”, then you can start trading on Arbitrum now.

<figure><img src="/files/VMpIamRkz4Xuyiw4HKNN" alt=""><figcaption></figcaption></figure>

**Step 3:** Select the trading symbol. Click on the small arrow pointing upwards, which will open the market window. Take 'BTCUSD-40000-C' as the example.

<figure><img src="/files/nYXd0s32y1AqwvdS0MsL" alt=""><figcaption></figcaption></figure>

**Step 4:** Then click “Deposit” to transfer USDC from wallet to Deri Protocol to add margin.<br>

<figure><img src="/files/wXdkkQZrXgJ8MQiQJRUC" alt=""><figcaption></figcaption></figure>

**Step 5:** The account deposit window appears. Firstly, choose the base token you’d like to transfer to the Deri Protocol and use as margin, we’re taking USDC as the example. Secondly, enter the amount of USDC you’d like to transfer from your wallet (alternatively you can directly select the percentage by your total USDC amount in your wallet). Once you have decided on an amount, click” Deposit”.<br>

<figure><img src="/files/CnlnPHB3LnFfdD69M6Us" alt=""><figcaption></figcaption></figure>

**Step 6:** Confirm your request on the wallet by clicking “Confirm” in order to have the funds transferred to Deri Protocol. Your deposit is successfully transferred once the hint prompts you. On the Account  Info panel, you can see your added margin. <br>

<figure><img src="/files/dPJJF0ql2huH83fxYOrE" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
You successfully added Margin to Deri Protocol.
{% endhint %}

Once you add Margin to your account, you're ready to open your first position

### **Open a position**

**Step 1:** Now we’re ready to open a BTCUSD-40000-C position. Move to the “Buy” section, set the notional amount in BTC you’d like to buy (alternatively you can directly enter the notional amount in USD, it will be converted to BTCs equivalent). Instead of the manual input or the given percentage buttons, there is also a slider to adjust the desired amount. Click “Buy/Long”. \
\
**In this tutorial we'll open a Long (Buy position)**<br>

<figure><img src="/files/EanTzg6E6jbadtBVrHgR" alt=""><figcaption></figcaption></figure>

**Step 2:** A transaction confirmation window appears which sums up all the transaction details. Once convinced, hit the “Buy/Long” button. Confirm your wallet request to open your position. The hint means you have successfully opened your position. The information about your open position(s) that you have opened is displayed on your “Positions” tab.<br>

<figure><img src="/files/iBJrjjdQddpfCtZ2tLnR" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/RkxCE9A3ENO4ovbDjSUb" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can open multiple positions in the same pool, but note that the margin requirement is calculated at the account level . Read more in the [Margin Requirement](/how-it-works/margin-requirement) article
{% endhint %}

### **Close a position**

You can close your position completely or partially.

#### Completely close your position

**Step 1:** If you seek to close a specific position, you can click “Close” in the position tab ,which results in a complete close of your position. Once you hit the close button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully closed your position.

<figure><img src="/files/o5Ze8z95z1eZ3HmDLiNP" alt=""><figcaption></figcaption></figure>

**Step 2:** You can view your detailed trading history in the “History” section.

<figure><img src="/files/XvcX1CGheBHtofvS38DR" alt=""><figcaption></figcaption></figure>

#### Partially close your position

You can also partially close a position.

**Step 1:** To do this, you simply need to partially trade your position in the opposite direction. If you opened your position using the "Buy" tab for example, switch to the "Sell" tab to short it partially. \
\
Make sure that the Close Only button is ticked. Use the slider & the predefined percentage buttons to choose the amount percentage you wish to close. Hit the button below to partially close your position.<br>

<figure><img src="/files/f8acAkNbIsWPdzEYUEA7" alt=""><figcaption></figcaption></figure>

**Step 2**: Once you hit the button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully partially closed your position. Your position info will be updated on your “Positions” tab.

<figure><img src="/files/CBJoRhMLTBzKuWi1etmX" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A partial close lowers your margin usage and increases your available margin
{% endhint %}

### **Add & Withdraw Margin**

On account level (per pool), it is possible to add additional or withdraw available margin.\
\
Why should a trader add additional Margin?

* If position(s) of the same pool are in danger of being liquidated as it could fall below the margin requirement, it may be wise to add additional margin to prevent liquidation.
* Trader seeks to increase his buy power i.e to open additional positions

There is also the possibility to remove available margin at the account level (by pool), but this has the direct consequence that trader's position(s) are closer to falling below the margin requirement, which would result in liquidation. Be cautious!

{% hint style="warning" %}
Should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions of the same pool.\
\
Please note accordingly, forced liquidations are executed on the account level too. In that case, you would lose all of your margin balance, i.e. your margin balance would become 0.\
\
For more details refer to our  [Liquidation](/how-it-works/liquidation) or [Trading FAQ](/library/faqs/trading-faq)
{% endhint %}

{% hint style="info" %}
Some Deri Protocol pools support a mixed margin feature that allows an existing position backed by a certain base token to be extended using an additional, different supported base token of the same pool, to increase the margin available.
{% endhint %}

### Add Margin

\
The process of 'Add Margin' is the same as the one of 'Deposit Margin'.

### Withdraw Margin

**Step 1:** To withdraw available margin,  click "Withdraw".&#x20;

<figure><img src="/files/pEnIXUfDd7xWW4CK5TGF" alt=""><figcaption></figcaption></figure>

**Step 2:** Decide which base token you wish to withdraw, choose a quantity (The withdrawl amout can not exceed avaliable balance) and hit 'Withdraw' button.<br>

<figure><img src="/files/DESh8qYqeawWvnVMmmux" alt=""><figcaption></figcaption></figure>

**Step 3**: Confirm your request on the wallet to have the funds transferred from Deri Protocol to your wallet. Your withdraw is successfully transferred once the hint occurs. Your balance will be updated in Accout Info panel. <br>

<figure><img src="/files/PawTTjvCtmPuuNeOjmOP" alt=""><figcaption></figcaption></figure>

## Backup RPC URLs

Deri Protocol is a group of smart contracts deployed on the blockchain, where the exchange of risk exposures takes place completely on-chain. The RPC is quite important from a trader's perspective because it allows you to query data and submit transactions on the blockchain on which Deri Protocol operates.&#x20;

There may be times when the RPC URL is not as responsive as it should be. At these times, you may notice data being slow to load or not loading on Deri Protocol's trading page.&#x20;

To continue using Deri Protocol during these times, we recommend you change the RPC URL in the network settings of your wallet. The page should load faster after changing the PRC URL.&#x20;

For a list of RPC URLs and their statuses: <https://chainlist.org/>

## **Is trading on Deri Protocol risk-free?**

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above.&#x20;

We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# Power Perpetuals

## Deposit Margin

**Step 1**: Visit the official website of the Deri protocol: [https://deri.io](https://deri.io/). Click ‘Powers’ to enter the Power Perpetuals section.&#x20;

<figure><img src="/files/Or9SXovYtrzsy7lMOxfN" alt=""><figcaption></figcaption></figure>

**Step 2**: Select a chain you want to trade on. Take 'Arbitrum' as the example. Click on the small arrow pointing downwards, choose “Arbitrum”, then you can start trading on Arbitrum now.<br>

<figure><img src="/files/ZZQzerFxm62A1PiincMJ" alt=""><figcaption></figcaption></figure>

**Step 3:**  Select the trading symbol. Click on the small arrow pointing upwards, which will open the market window. Take 'mBTC^2' as the example.

<figure><img src="/files/NtMVpvD19olm3fIcLRca" alt=""><figcaption></figcaption></figure>

**Step 4:** Then click “Deposit” to transfer USDC from wallet to Deri Protocol to add margin.

<figure><img src="/files/zEnx1KCpkxf2ORwW69Cx" alt=""><figcaption></figcaption></figure>

**Step 5:** The account deposit window appears. Firstly, choose the base token you’d like to transfer to the Deri Protocol and use as margin, we’re taking USDC as the example. Secondly, enter the amount of USDC you’d like to transfer from your wallet (alternatively you can directly select the percentage by your total USDC amount in your wallet). Once you have decided on an amount, click” Deposit”.

<figure><img src="/files/nZ7RAedTT5NfLbcBSn4K" alt=""><figcaption></figcaption></figure>

**Step 6:** Confirm your request on the wallet by clicking “Confirm” in order to have the funds transferred to Deri Protocol. Your deposit is successfully transferred once the hint prompts you. On the Account  Info panel, you can see your added margin. <br>

<figure><img src="/files/y34XXupLMBBRpJK7wNzS" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
You successfully add Margin to Deri Protocol.
{% endhint %}

Once you add Margin to your account, you're ready to open your first position

### **Open a position**

**Step 1:** Now we’re ready to open a mBTC^2 position. Move to the “Buy” section, set the notional amount in BTC you’d like to buy (alternatively you can directly enter the notional amount in USD, it will be converted to BTCs equivalent). Instead of the manual input or the given percentage buttons, there is also a slider to adjust the desired amount. Click “Buy/Long”. \
\
**In this tutorial we'll open a Long (Buy position)**<br>

<figure><img src="/files/k7P7TYWYPN4y2yCKi5kC" alt=""><figcaption></figcaption></figure>

**Step 2:** A transaction confirmation window appears which sums up all the transaction details. Once convinced, hit the “Buy/Long” button. Confirm your wallet request to open your position. The hint means you have successfully opened your position. The information about your open position(s) that you have opened is displayed on your “Positions” tab.<br>

<figure><img src="/files/V9tzHPfd22JUJjVmhrff" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eVKdmSWbmikkx8LfwKvA" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
You can open multiple positions in the same pool, but note that the margin requirement is calculated at the account level . Read more in the [Margin Requirement](/how-it-works/margin-requirement)article
{% endhint %}

### **Close a position**

You can close your position completely or partially.

#### Completely close your position

**Step 1:** If you seek to close a specific position, you can click “Close” in the position tab ,which results in a complete close of your position. Once you hit the close button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully closed your position.

<figure><img src="/files/HENfTeUL15s4bCPUtBdf" alt=""><figcaption></figcaption></figure>

**Step 2:** You can view your detailed trading history in the “History” section.

<figure><img src="/files/xtN7sMS0nIU86QQzc3L5" alt=""><figcaption></figcaption></figure>

### Partially close your position

You can also partially close a position.

**Step 1**: To do this, you simply need to partially trade your position in the opposite direction. If you opened your position using the "Buy" tab for example, switch to the "Sell" tab to short it partially. \
\
Make sure that the Close Only button is ticked. Use the slider & the predefined percentage buttons to choose the amount percentage you wish to close. Hit the button below to partially close your position.

<figure><img src="/files/UMfNVh3NQ0uF3jwL9a0D" alt=""><figcaption></figcaption></figure>

**Step 2**: Once you hit the button, you need once again to “Confirm” the closure request on your wallet. The hint means you have successfully partially closed your position. Your position info will be updated on your “Positions” tab.

<figure><img src="/files/r2TPAHPAW551cHK9gWm3" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A partial close lowers your margin usage and increases your available margin
{% endhint %}

### **Add & Withdraw Margin**

On account level (per pool), it is possible to add additional or withdraw available margin.

Why should a trader add additional Margin?

* If position(s) of the same pool are in danger of being liquidated as it could fall below the margin requirement, it may be wise to add additional margin to prevent liquidation.
* Trader seeks to increase his buy power i.e to open additional positions

There is also the possibility to remove available margin at the account level (by pool), but this has the direct consequence that trader's position(s) are closer to falling below the margin requirement, which would result in liquidation. Be cautious!

{% hint style="warning" %}
Should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions of the same pool.\
\
&#x20;Please note accordingly, forced liquidations are executed on the account level too. In that case, you would lose all of your margin balance, i.e. your margin balance would become 0.\
\
For more details refer to our [Liquidation](/how-it-works/liquidation) or [Trading FAQ](/library/faqs/trading-faq)
{% endhint %}

{% hint style="info" %}
Some Deri Protocol pools support a mixed margin feature that allows an existing position backed by a certain base token to be extended using an additional, different supported base token of the same pool, to increase the margin available.
{% endhint %}

#### **Add Margin**

The process of 'Add Margin' is the same as the one of 'Deposit Margin'.

#### Withdraw Margin

**Step 1**: To withdraw available margin,  click "Withdraw".&#x20;

<figure><img src="/files/1vl5BKp7MneqblFgjbvI" alt=""><figcaption></figcaption></figure>

**Step 2**: Decide which base token you wish to withdraw, choose a quantity (The withdrawl amout can not exceed avaliable balance) and hit 'Withdraw' button.

<figure><img src="/files/xGrpU0OgUDCpkhIkQxCQ" alt=""><figcaption></figcaption></figure>

**Step 3**: Confirm your request on the wallet to have the funds transferred from Deri Protocol to your wallet. Your withdraw is successfully transferred once the hint occurs. Your balance will be updated in Accout Info panel.&#x20;

<figure><img src="/files/s0CxXuQCElpglgeC070y" alt=""><figcaption></figcaption></figure>

## **Backup RPC URLs**

Deri Protocol is a group of smart contracts deployed on the blockchain, where the exchange of risk exposures takes place completely on-chain. The RPC is quite important from a trader's perspective because it allows you to query data and submit transactions on the blockchain on which Deri Protocol operates.

There may be times when the RPC URL is not as responsive as it should be. At these times, you may notice data being slow to load or not loading on Deri Protocol's trading page.

To continue using Deri Protocol during these times, we recommend you change the RPC URL in the network settings of your wallet. The page should load faster after changing the PRC URL.

For a list of RPC URLs and their statuses: <https://chainlist.org/>

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above.

We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# Gamma Swap

## Start&#x20;

**To get started visit:**[ ](https://deri.io/#/index)[**https://deri.io**](https://deri.io)

**Step 1:** Click ‘Trade’ at the upper menu of Deri’s official website to enter the trade section.

<figure><img src="https://lh5.googleusercontent.com/H8FzmDh5sN2CEVZXV0QcNiyUcFEpt5S7gfDKACGzGxPfMbabaNaVBkbxH-F1ON6EXX4yPD3VE3mVZXUV290ytgw5zmRFlwhMJdxgw1194av_FXj_MWfZRkK0Tn5QSwN1j-ea7OVvoEXVbdJdvquNtpM" alt=""><figcaption></figcaption></figure>

**Step 2:** In Pro version, click on the small arrow pointing upwards, which will open the market window. Choose ‘Gamma’, there are 3 kinds of symbols in this derivative. Here we choose ETH-Gamma as an example.&#x20;

<figure><img src="https://lh4.googleusercontent.com/Co-yzYC14gSFWg5CeL-oJic3fSeZIhhbBLLMMYRhw01-Ej0xpxguF_7phJA_QDfpcFdBRzfp_we3hSWMoStc0SQ1Eqlpyr3T3YhlgjC_84lwQSnpB99YvyTyvaYmeAuGng5e5SwIY7Mtr1eoi6ZGV94" alt=""><figcaption></figcaption></figure>

## Margin Deposit:

**Step 1:** Deposit your funds from the wallet to your account, get prepared for trading. Click ‘Deposit’.&#x20;

<figure><img src="https://lh4.googleusercontent.com/YtJ8UD_2oo7ycEaz980XsFkQXMOGRsbo2PITggQHPoRc98hWxmTmp95IykS7Py0ZvxJNAPOe6DVyZ_xWjhBiyzydLDBWmRbjOg_HnV08AZXH4ne2uvaOCgDpOvsofHDoejsZAkTxKwblQNi4heWW1bg" alt=""><figcaption></figcaption></figure>

**Step 2:** Choose a base token as the deposit currency, here I choose USDC. Then, enter in the token amount you want to deposit.（Note that your deposit amount cannot exceed your wallet balance.) You can also choose to deposit 25%, 50%, 75%, or 100% of your wallet balance. Click “ Deposit”.

<figure><img src="https://lh3.googleusercontent.com/4D0yvd0Xu7q0aySOuO2waE5mzV312yssnjSUyfYycYrh8EgCqU5hg-WuS2lP5-zoTZR04_z7DZyFHkwX3b04CYKBXtbC6AQ7WyPvGf0AaUyXEF7FogyCsUD76gv3UndDQzUUtt5PUex1g4-OcA2HEuc" alt=""><figcaption></figcaption></figure>

**Step 3:** After confirming on the wallet, the hint “ Deposit USDC Margin-Execuetd” means the deposit is successful.

<figure><img src="https://lh3.googleusercontent.com/HkSNH4Q9k39qKAyk0162WC3sSwy-1xsJf73-XyJct1G7mBSJoLck7ct1hIV9QIKJ3ltXNQ8gztqc-4mLd7IHFzZMI5L0aOe-B6UOXOfHGO-1r4E4CK1n2NT2wpUYomj6RrXn-CNbqd32p_quwVJAMkA" alt=""><figcaption></figcaption></figure>

**Step 4:** You can now see your deposits in the “Account Info” panel.&#x20;

<figure><img src="https://lh4.googleusercontent.com/26jUGsEAb3ARlM14n8ztPirW_gPsM2vT6tL2m8_hGVki87JHgOKvkVyHWvL_AwhP15PEG750sChrEvvAADrWk88zYJp-vDr0SqOwv2Upbkz7lTW1A0jvTXBvhX2BFL_8564lIjdeqXzH6TCrwMccXG4" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
You successfully added Margin to Deri Protocol.
{% endhint %}

Once you added Margin to your account, you're ready to open your first position

## Open a position:&#x20;

**Step 1:** It comes to the trade panel. Choose “Buy” or “ Sell” (If you think the market will go up, choose “Buy”, otherwise, choose “Sell”). Then,enter the trading volume. Instead of the manual input or the given percentage buttons, there is also a slider to adjust the amount. Click “Buy/Long”&#x20;

<figure><img src="https://lh6.googleusercontent.com/_Wsrlnidw1_vwURWEQ-Bg-2QjvypZPygABJZ-aBnWzf94je-zsVnesKTcdmZzuQhXpKXU4NmhfallOgA5LGnYv7_4vxZ5RXR48VRbNBsTEaq6yZtCZOzePgMS0PoKpJPNrHPtVeeKTrOMDKC6nE1T8g" alt=""><figcaption></figcaption></figure>

**Step 2:** A transaction confirmation window appears which sums up all the transaction details. Once convinced, hit the “Buy/Long” button. Confirm your wallet request to open your position. Then, the hint ‘Place Long Order-Filled’ means that you have opened the position successfully.&#x20;

<figure><img src="https://lh3.googleusercontent.com/eAHI8dVr1Q4Hv7nxW464-K__Zu518bMazKvwkbv5Xy81euOsY7najF_ktph7xxJNnD1Q0UCP9cawjnbf5qT6YH8O2IO193C130xv5snu30bpf4WaFAjEezowcCR6SvaIHcRVCRbmv-udXYi7Lu-GQ9k" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh5.googleusercontent.com/jZJ9rRXOimC8rNx4NjwiK2mY66Cjd4SnOglJfhrHSFtfXhNVg61ODWC5TDuy2cb4w6B18vrQr6vFA9wBtMdAQpr2IYJNc3fM4ghPqeW6N7WWRQEs7HDquvP3nBkALfjeYcv2y24kWtWcDJkHuIuvQf8" alt=""><figcaption></figcaption></figure>

**Step 3:** Information of your open position(s) will be included in your “Positions” tab.&#x20;

<figure><img src="https://lh6.googleusercontent.com/_RZU3k1YAI3tMmoPT2qj99N2fEeYKhc58FXn-HdXmETxvmEYpyqqbQqaJxueuc-IHbiuW7HNMKOA5rkBAWmoIOpiPB7Wt_bKI1Jtp1KNQCpVU5cSXfcj3UaZZSq4S9_wKikxwfdGtEyxTdPH_mB4VOo" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can open multiple positions in the same pool, but note that the margin requirement is calculated at the account level . Read more in the[Margin Requirement](/how-it-works/margin-requirement) article
{% endhint %}

## Close a Position:

You can close your position completely or partially.

**Completely close your position:**\
\
**Step 1:** If you seek to completely close a specific position, you can click “Close” in the position tab ,which results in a complete close of your position. Once you hit the close button, you need once again to “Confirm” the closure request on your wallet. The hint ‘Place Short Order-Filled’ means you have successfully closed your position.&#x20;

<figure><img src="https://lh3.googleusercontent.com/6qsgEIaZUGMhjWiuomkPdEjd4dsQBAjieFO8Pe79fI5OiFgX4dNdvVZWPJ2CwL2qrcMjdQ_gdHG_l57elXG--_qA2e3JHh0d4U8dKscgAiWfjYxZTGFwlOIlRVa939BSS_DWBYugVpk0yNebIA4ur-I" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh3.googleusercontent.com/cQlZGE0kP6kjqJLfjgVsLzPBMv7Na2yMibCinSNk6_E_sAI2K8sI3wl2fY5G45jBAOxplDmPbdhaixCVl96sY6nPMHNdzC_GTQDwK9UG1u2La1m13U8AVjW4DAXBw3ggBhK3pAa8ausb0uF11IGF8uY" alt=""><figcaption></figcaption></figure>

**Step 2:** You can view your detailed trading history in the “History” section.&#x20;

<figure><img src="https://lh4.googleusercontent.com/HIVvRyat1hgP1QkfvA6EYhlUVgKHPoxeglW_UmFjr31AIBIHI9wcIG8eQaUAnnqPIMLhLx_z9rs_OIeoySdM76d18SxqIfI0_yXfwV5v0B7jTdEggEKo3m4ZOGmvf87SeEijeD-KU3-KzxxrrknK264" alt=""><figcaption></figcaption></figure>

**Partially close your position:**

You can also partially close a position.&#x20;

**Step 1:** To do this, you simply need to partially trade your position in the opposite direction. If you opened your position using the "Buy" tab for example, switch to the "Sell" tab to short it partially.&#x20;

<figure><img src="https://lh3.googleusercontent.com/WmhCPagUlr7m0XKgrS6P4-ChaEoE_41PLlwyNRB_GCt3HrvJlhFDw-omWxWNwj_yVLFxaxMpwdmpgVMtTxIIIrWEWPbSkuta_Jo0qoc_V2bYkWVY6NN6lW6DI6lt8uFX4N_Aj5AOBkKWnLoQM42Y62E" alt=""><figcaption></figcaption></figure>

**Step 2:** Make sure that the Close Only button is ticked (2). Use the slider & the predefined percentage buttons (1) to choose the amount percentage you wish to close. Hit the button below to partially close your position.

<figure><img src="https://lh5.googleusercontent.com/_a143ChVUH3o86lnOH-XnBaHIRFV28R8aMGmhw_6aSlkP8LgPSyTW4T-wGbX9bajy9YM8faCdQ5y_JCtVraNrbgNxSJlZT4ST-YORoVLTQIWXPhGqpfDbRemNX7YhI7UvLrhpvxyFb7irpR8rV5RIMA" alt=""><figcaption></figcaption></figure>

<br>

## &#x20;


# Arbitrage

## How to arbitrage?

The DPMM of Deri Protocol is designed around the arbitrage mechanism to offset the net position of the trading pool. This article explains the details of the mechanism. We take Perpetual Futures as an example, and the arbitrage with Everlasting Options would be similar.

The basic idea of arbitrage is straightforward: per the DPMM mechanism, the funding fee is paid from the majority side to the minority side. **Therefore, a very simple arbitrage strategy is to take the minority side of the pool to earn the funding fee.** At a high level, this involves the following steps:

1. Read the current funding rate of the pool. when it is at some positive (negative) threshold, enter a short (long) position.
2. Accordingly, hedge your short/long position outside (e.g. hold a spot position or take a futures position on a centralized exchange as you wish).
3. Sit back and enjoy collecting the funding earning (i.e. negative funding fee).
4. Close your position when it stops paying the funding fee (i.e. the sign of the funding rate flips).

The tricky part is steps 1 and 4, for which you pay transaction fees (i.e. your cost of the arbitrage). **However, if you properly choose the timing of steps 1 and 4 (the entry and closing points), you can compensate your transaction cost with the “negative slippage” of your trades so that the whole procedure from steps 1 to 4 is guaranteed to make profits.** The key is to take advantage of the spread between mark price and index (determined by the DPMM based on the total net position). For example, if we are to arbitrage with the BTCUSD perpetual futures with a transaction fee of 0.1% of the national, then we can choose the entry and closing points as follows (denoting index price and mark price as $$I$$and $$M$$).

1. Assume ***I*****&#x20;= 40000**, and the total position is positive, pushing the mark price up to ***M = I\******&#x20;(1+0.4%) = 40160** Open a short position to pull the mark price to ***M = I\******&#x20;(1+0.2%)** **= 40160***.* Your transaction fee is around **40** and your average trading price of opening the position is around ***I\******(1+0.3%) = 40120** .
2. hedge your long position somewhere else.
3. Collect the funding earning of your short position.
4. Due to other traders’ activities, the total net position becomes **0,** and thus the mark price becomes at par with the new index price (then you stop receiving funding earnings). Let’s assume now the index price ***I’*****=50000.** Close your short position, which would push the mark price to ***M = I’\******(1+0.2%) = 50100**. Your transaction fee is around **50** and your average trading price of closing the position is around ***I’\******(1+0.1%)&#x20;*****= 50050**.*

As long as you are perfectly hedged, your total (negative) slippage from steps 1 and 4 would be **-*****(I+I’)\******&#x20;0.1% = -90**, which is a profit perfect compensating the total transaction fees **90**. Therefore, the funding fees that you earn from step 3 are pure profits. In practice, you would also take into account the possible cost on the hedging side. But this depends on where and how you do it. Under certain circumstances and with specific strategies, this cost could be zero or even negative.

A sample code of taking arbitrage with Deri Protocol can be found here on [Github](https://github.com/deri-finance/demo/tree/main/deri_v3_arbitraguer). Please note this code is for demo purposes only. You will use it at your own risk.

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. \
\
We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# AMM Liquidity Mining

## Overview

There are two ways to do add Liquidity & mine DERI. One is to add liquidity to our in-house pools([Mining (AMM Liquidity Mining)](/how-it-works/mining-amm-liquidity-mining) or to add liquidity in existing, predefined spot DEX trading pairs (PancakeSwap & Sushiswap) to increase spot liquidity. In both cases, Liquidity Miner, earn DERI

This article deals with AMM Liquidity Mining by providing liquidity to in-house pools.

## Install Metamask or supported mobile dApps

\
**Desktop**: We're supporting the Desktop version of the Metamask wallet for interaction with Deri Protocol.

\
**Mobile:** We're supporting various mobile dApps wallets & are also working on supporting more dApps.

* *Metamask*
* *imToken*
* *Math Wallet*
* *Trust Wallet*
* *Bitkeep Wallet*
* *ONTO Wallet*
* *TockenPocket*
* *Coin98*
* Safepa

## **Add Liquidity**

**Step 1**: Visit the official website of Deri protocol: [https://deri.io](https://deri.io/). Click ‘Pools’ to enter the liquidity mining.&#x20;

<figure><img src="/files/VfnkWhpnisH5Pq3IqlBG" alt=""><figcaption></figcaption></figure>

**Step 2**: Click “Connect Wallet”, connect your wallet to Deri Protocol, and select “AMM Liquidity Mining”.&#x20;

<figure><img src="/files/GBTey3iMNSUmwdydoWlN" alt=""><figcaption></figcaption></figure>

**Step 3:** Select the chain you’d like to stake on, take 'Arbitrum' as the example. Then, select the base tokens to add as liquidity, take the “USDC” base token as the example. Note that different pool supports a number of different base tokens with different APYs. Choose according to your own preferences and requiries.&#x20;

<figure><img src="/files/dYBkWNMcLwZTK10ldH9D" alt=""><figcaption></figcaption></figure>

**Step 4**: Enter the USDC amount you’d like to add as liquidity at the “ADD” section (The amount can not exceed your wallet balance). Or you can choose to add in proportion to your wallet balance. Then click the ”Add Liquidity”. <br>

<figure><img src="/files/OUviiwe2JJS7aswjwrwg" alt=""><figcaption></figcaption></figure>

**Step 5**: Wallet will pop up for approval. Click “Confirm” to approve and the hint will prompt you that the staking is successful. Once the transaction is validated on-chain, you can see your liquidity information in the “pool Info”. The base token you added as liquidity will be marked with the tick tag.

<figure><img src="/files/geJxFk2TDGtrKchlJADh" alt=""><figcaption></figcaption></figure>

### **Claim DERI rewards**

**Congratulations!** You can withdraw your liquidity at any time. DERI rewards are calculated and distributed per block based on LPs’ liquidity percentage.

In 'Claimbale Rewards' section, Click 'Claim' to claim DERI rewards.

<figure><img src="/files/A4fqZvgkAU9Y68Md5kAu" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**What exactly happens to my liquidity when I am AMM liquidity mining?**&#x20;

\
Your liquidity is added & stored on the specific smart contract of the respective chain, which acts as a counterparty to the traders position. It is subject to a certain market risk, for more information regarding potential risks and profits, check out How it works [Mining (AMM Liquidity Mining)](/how-it-works/mining-amm-liquidity-mining)article or [Mining FAQ](/library/faqs/mining-faq)
{% endhint %}

### **Remove Liquidity**

**Step 1:** You can withdraw your liquidity at any time by clicking”Remove”. Enter the token amount or select the percentage of liquidity you’d like to remove (e.g 100%), then click” Remove Liquidity”.<br>

<figure><img src="/files/x5zOWpPngHlofVxHObW9" alt=""><figcaption></figcaption></figure>

**Step 2**: Wallet will pop up for approval. Click “Confirm” to approve and the hint will prompt you that the removal is done. After the transaction is validated on-chain, your pool balance information will be adjusted depending on how much liquidity you’ve removed. In the case you removed everything, the tag “Staked” will be removed too.&#x20;

<figure><img src="/files/h4Xc9OGd5sg2FBcdPR2j" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hLyyb1qKB3YCrBa2iOPp" alt=""><figcaption></figcaption></figure>

## Is the AMM Liquidity Mining on Deri pools risk-free?

No, it isn't.  In general, it is essential to comprehend that liquidity providers are the counterparts of traders on Deri Protocol. When traders realize profits, they do so at the expense of liquidity provider's provided liquidity. When traders realize losses or are liquidated, liquidity providers realize profits at the expense of traders.

Since it is very rare that all traders' positions are covered by an equal number of long and short contracts, liquidity providers step in to cover the difference between long and short positions (net position) with their liquidity. Therefore Liquidity mining on Deri Pools is subject to market risk&#x20;

However, please note that such market risk is different from the *impermanent loss* of spot exchanges (e.g. Uniswap or Sushiswap). First of all, the fact it is called "risk", instead of "loss", indicates that the LSV/mining PnL result could be negative but also positive (which depends on several factors such as funding & transaction fees, exceeding traders' profits & realizing them, etc.). Secondly, the probability of a negative result (a loss) on Deri liquidity mining pools is much smaller than that of typical spot exchanges due to the protection by arbitrageurs, although a certain market risk remains. \
\
You might think of liquidity mining on Deri as investing in a low-risk fund with potentially very high profit, whereas that risk-free liquidity mining is like depositing your money into a bank saving account.

Please refer to our [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_whitepaper.pdf) for further details regarding the protection by the arbitrage mechanism.


# DERI Liquidity Mining

Mining

## Overview

There are two ways to do add Liquidity & mine DERI. One is to add liquidity to our in-house pools([Mining (AMM Liquidity Mining)](/how-it-works/mining-amm-liquidity-mining) or to add liquidity in existing, predefined spot DEX trading pairs (PancakeSwap & Sushiswap) to increase spot liquidity. In both cases, Liquidity Miner, earn DERI

This article deals with DERI liquidity mining by providing liquidity to predefined DEXs.

## Install Metamask or supported Mobile dApp

\
**Desktop**: We're supporting the Desktop version of the Metamask wallet for interaction with Deri Protocol.

\
**Mobile:** We're supporting various mobile dApps wallets & are also working on supporting more dApps.

* *Metamask*
* *imToken*
* *Math Wallet*
* *Trust Wallet*
* *Bitkeep Wallet*
* *ONTO Wallet*
* *TockenPocket*
* *Coin98*
* *SafePal*

## **DERI Liquidity Mining**

This type of liquidity mining is external. You deposit two predefined assets to its retrospective trading pair on a DEX as liquidity and get pledge tokens, these pledge tokens can be staked on Deri Protocol. On top of this you get a lucrative APY paid in DERI.

Currently we support 2 DEXs:&#x20;

* ***PancakeSwap** (Trading pair: **BUSD/DERI**) - BNB Chain*
* ***SushiSwap** (Trading pair: **USDT/DERI**) - Ethereum*

Once you staked your liquidity on the DEX and received the predefined pledge tokens, you're ready to stake them on Deri Protocol

**Step 1:** Visit the official website of the Deri protocol: <https://deri.io/\\>
\
**Step 2:** Click ‘Pools’ at upper left corner to enter the Pools section.&#x20;

![](https://lh5.googleusercontent.com/hBBeF2PCIa8bOlxUCvmraMoJe0H5S7IF6aEn4Z4u_ZGd0T_5ZcZcF1XPzNJEFH-hxjo4Vjy2eFOLPU0t2ewc1O7v8eK1-Vqsc3Vy-c163AxB8ANayFMW6CiOOAfw6btAapbdgO5a)

**Step 3:** Choose“ Deri Liquidity Mining” , select the specific pool you wish to add your pledge tokens to, we will take the PancakeSwap BSC Pool as an example

**Step 4:** Click the ”Stake”button at “Pancake-BSC” pool.

![](https://lh6.googleusercontent.com/PcAusdeKI95qvGTje49jlKAr983vI56RtfN6F64388AeTZUByi_LNB7RtG_VEqbX59NEwlGv2h9JIJ0sgTVlc06gabXIbCcf0na2pEdxHDnm7LmEIcTN-s-Lm-HZ7WGmHcgwBjCQ)

**Step5:** Hit the “Approve” button on the right side, to grant permission for Deri Protocol to transfer your CAKE-LP to the CAKE-LP pool. Confirm” the request at the wallet page to allow access to the specific pledge token.

![](https://lh3.googleusercontent.com/vI4iCB3mi-kpzVCcqTQZDyIBPdWDV20xD4tGkQ71HJ941CeUa6V2HwQIf9kun6V01xd9TVsN1lCTddOWrVGa5_ziLo_vZR-YE5bJsoDFtPuAfvrXxZgqvxbzu1aYG6MPhb9bu-X-)

![](https://lh4.googleusercontent.com/1oPtZlFnAtNA0wcs3AVm6Sj4Xy3K7NpplCMdN8I0gR8RFV_BC280YZ6AFPWHJuMxJUAmmeczOb_3W15WZpBeuxQDY5WMwwEMYFtsCPpJpIdz-PzKtSxgf4GNz5enU1Ierb7K1OWt)

**S**t**ep 6**: Select the percentage you’d like to add as liquidity（e.g 100% of your pledge tokens）, hit the “Add Liquidity” button, then click”Confirm” once your wallet requests it.

![](https://lh4.googleusercontent.com/VxbXg7P69G8VxZDKGOVHH4YfuGfXf4GucyaqD6EM_o_sehe0UEkjRATFD2Zk1IFjsyq8WeecyabNIeoKTtmTXqyI7FZqoPbmg80reZoh8TIdroO-WKjx-kOmyv9KnwWs5e0G_HZ7)

![](https://lh3.googleusercontent.com/XNedZTvFmZpnoTgaQoxAJ_JPfpTHiBLmiYl65l0CYoUWhm724Pqr52ZDpwR16AhvuHXGFzvKgPWf1GMRj4j9ffil9KjBiihQWI3V0pP7dDech392frX1FMkRrbNYqh_sfvV5xdTZ)

**Step 5:** Once the Liquidity adding process is completed, Details regarding the added liquidity can be viewed on the pool page info.

![](https://lh3.googleusercontent.com/te4VGDUW3t2ACLgsehu6Y6XIw9GmjLsqsZffMo8U-PcTIU-plIOKDDvTa0ZJeixciZXWErjPqJv_JwuFDfUCruckVnx4AFqR_aHR6aSfLalF63Skhvwdwryiwy0k6n2y1ag2wHa9)

**Step 6:** If you wish to remove your *pledge tokens* liquidity again. For help please refer to the liquidity removal steps  of *AMM Liquidity Mining:* [AMM Liquidity Mining](/mining/amm-liquidity-mining#remove-liquidity)

{% hint style="warning" %}
Your liquidity on DEX is subject to **Impermanent loss**. For more details, please refer to the documentation page of the respective DEX or our Mining [Mining FAQ](/library/faqs/mining-faq)
{% endhint %}

{% hint style="danger" %}
You should only add DEX liquidity on pairs that are predefined by Deri Protocol! Never add liquidity on empty, unsupported DEX pools!
{% endhint %}

## Is DERI Liquidity Mining on SushiSwap & PancakeSwap risk-free?

No, it is not. Liquidity mining on SushiSwap or PancakeSwap are subject to the risk of impermanent loss. Any resulting permanent loss caused by removing the liquidity is in the user's responsibility. \
\
Use only the listed pools on our website to add liquidity. Adding liquidity on empty pools directly over SushiSwap or PancakeSwap can cause a huge or total loss. Any resulting permanent loss caused by removing the liquidity is in the user's responsibility


# Architecture

Overview

## The xDapp Architecture.

Deri Protocol's innovative architecture consists of two main components: a requesting interface and an executive engine, implemented as two groups of smart contracts.

<figure><img src="/files/ZFrpzBHCtP5hoLOzI3qY" alt=""><figcaption></figcaption></figure>

The requesting interface,also known as the “i-chain” (with “i” signifying interface), serves as the pivotal entry point for user interactions. It adeptly handles a wide range of user requests, from traders initiating orders and managing margins to liquidity providers engaging in adding or removing liquidity.

These requests are seamlessly relayed to the executive engine. Deployed on a dedicated blockchain, this is our “d-chain”, where “d” represents “Deri”. Here, all the requests are processed.

There is only one d-Chain, which is an AppChain deployed by the Deri Protocol team using layer 3 technology. Whereas, i-Chain are all the major public layer 1s and layer 2s such as Ethereum, Arbitrum, BNBChain, zkEVM,and zkSync Era. While theoretically any layer 1 or layer 2 can be adopted as an i-Chain, in practice, the community will choose which ones to deploy.

## **DPMM Architecture**

The chart below illustrates the architecture of the DPMM of Deri Protocol.<br>

![](/files/7u1TeAsxgJcRfE03Uz53)

## How DPMM works

The "How DPMM works" section is intended to give users a rough overview of the various mechanisms implemented on Deri Protocol, resulting in giving a transparent and clearer picture on how exactly Deri Protocol's engine and backend is beating.

{% content-ref url="/pages/QZneu8KtHrjFDm0bkNH1" %}
[DPMM (Proactive Market Making)](/how-it-works/dpmm-proactive-market-making)
{% endcontent-ref %}

{% content-ref url="/pages/hlXr1bAjiIwVqJEugIYN" %}
[External Custody](/how-it-works/external-custody)
{% endcontent-ref %}

{% content-ref url="/pages/W7C8zbbaCCY1vFYmpbGm" %}
[Funding Fee](/how-it-works/funding-fee)
{% endcontent-ref %}

{% content-ref url="/pages/bLNgxGl6snYz8rrOww1C" %}
[Leverage](/how-it-works/leverage)
{% endcontent-ref %}

{% content-ref url="/pages/Kjo2oCAmpTNIm34XugV2" %}
[Margin Requirement](/how-it-works/margin-requirement)
{% endcontent-ref %}

{% content-ref url="/pages/UQod9NzYfj7zXG3uPvRU" %}
[Liquidation](/how-it-works/liquidation)
{% endcontent-ref %}

{% content-ref url="/pages/CkJUdqDmlqKjO8ip0tge" %}
[Mining (AMM Liquidity Mining)](/how-it-works/mining-amm-liquidity-mining)
{% endcontent-ref %}

{% hint style="info" %}
Interest aroused? For even deeper insights feel free to study our: [Whitepaper](/library/whitepaper)
{% endhint %}

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. \
\
We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# DPMM (Proactive Market Making)

## Introduction

Proactive Market Making (PMM), introduced by DODO for spot trading, is adapted by Deri Protocol for its derivative-oriented PMM paradigm: ***Deri Proactive Market Making***, abbreviated as ***DPMM***.

Perpetual futures and everlasting options are just two special cases of the general form of funding-fee-based perpetual derivatives requiring one long position to pay one short position \[*MARK-I*(*S*)] as funding fee, where *I*(*S*) is a general “intrinsic value” function of the underlier price *S*. Another instance of such funding-fee-based perpetual derivatives is the so-called Power Perpetuals.&#x20;

The DPMM of Deri V3 has unified the funding and pricing mechanisms for all funding fee-based perpetual derivatives. That is, the DPMM of Deri V3 is designed to universally handle funding-fee-based perpetual derivatives rather than respectively handling perpetual futures or everlasting options. This has led to a major architectural simplification of the Deri V3 DPMM: the DPMM of Deri V3 has only one general-purpose trading pool (i.e. one single smart contract) implementing the pricing and funding fee logic.

## &#x20;DPMM of Perpetual Futures

With Deri's PMM algorithm, when the net position is 0 (the equilibrium state; long positions equals short position), the mark price equals the index price fed by the oracle. Whenever there is a trade, it pushes the mark price toward the specific trading direction (i.e. a buying trade pushes the price up while a selling pushes it down). The price change due to the trade is proportional to the trade size.

For example, if the current mark price is P and someone places a trade of size x, then the mark price is pushed to P + ∆P, where ∆P = a • x, with a determined by the pool liquidity and the pool parameters. Since mark price is the trading price for a trade of infinitesimal size as of the current state, the trading price of the trade of size x is the average from P to P + ∆P, roughly P ∆P/2. The precise trading price is calculated by the trading cost as an integral from P to P + ∆P

As the trading volume pushes the mark price linearly, the price spread and the mark price are determined by the total net position, as follows:

$$
∆P/i = a(l — s),
$$

$$
P = i\[1 a(l — s)]
$$

where i is the index price, / and s are the total long and short position&#x73;**.** Thus (1 — s) is the total net position, and a is a coefficient determined by the pool liquidity & parameters.><br>

### Example

Let's take the following example of BTCUSD perpetual futures to illustrate how this works numerically.

* &#x20;The pool liquidity (in terms of BUSD): *L =* 1, 000, 000
* The total net position (in terms of BTC): &#x6C;*-s =* 1
* &#x20;The index price of BTCUSD: i = 50000
* a = 0.01
* &#x20;*f =* 0.01/86400, where 86400=24\*60\*60 is the number of seconds per day. (Please note these are not real parameters - we purposely choose these numbers to make the example numerically easy to understand. Please refer to the specific smart contract for the respective real parameters)

Then we have the percentage premium of the mark price, over the index price, as follows:

That is, the mark price is 1% above the index price, which leads to

$$
\frac{P-i}{i}=a(l-s)=0.01
$$

$$
P=i(1+1%)=50500
$$

resulting in, ∆*P =* 500.

And the funding fee of 1 long contract. paying 1 short contract per second is

$$
F = (0.01/86400) \* 500 = (0.01/86400) \* 0.01 \* 1 \* i
$$

\
which is equivalent to a daily funding fee being:

$$
F • 86400 = 500 = i • 0.01%
$$

That is, 1 long contract pays 0.01% of the contract value to 1 short contract per day.

## DPMM of Everlasting Options

For everlasting options, the DPMM (Deri Proactive Market Making) mechanism is adopted to carry out trades. For each everlasting option, DPMM takes two inputs from the oracle: the underlying price and volatility. It calculates then the theoretical price ($$i$$) for the option (refer to the [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_everlasting_options_whitepaper.pdf) for the math of the pricing).&#x20;

This theoretical price is used as the starting point of the DPMM pricing. When the net position is 0 (the equilibrium state), the option mark price equals the theoretical price $$i$$. Whenever there is a trade, it pushes the mark price toward the trading direction (i.e. a buying trade pushes the price up while a selling pushes it down). The price change due to the trade is proportional to the trade size.

### Example

Let's take the following example of BTCUSD-50000-C Everlasting Options to illustrate how this works numerically.

* &#x20;The pool liquidity (in terms of BUSD): *L =* 1, 000, 000
* The total net position (in terms of BTC): &#x6C;*-s =* 1
* &#x20;The index price of BTCUSD: i = 55000
* &#x20;The mark price of BTCUSD-50000-C: P=5300 (the mark price is derived from the everlasting option pricing formula and the DPMM model to reflect the long/short demand on the market.)
* The intrinsic value of BTCUSD-50000-C: I = 55000 - 50000 = 5000
* a = 0.01
* &#x20;*f =* 0.01/86400, where 86400=24\*60\*60 is the number of seconds per day. (Please note these are not real parameters - we purposely choose these numbers to make the example numerically easy to understand. Please refer to the specific smart contract for the respective real parameters)

The funding fee is based on the premium of mark price over intrinsic value. In this case, the funding fee of 1 long contract paying 1 short contract per funding period (e.g. 1 week) is P-I = 5300-5000=300. This corresponds to a funding per second as

(P-I) / (7\*24\*3600) = 300 / (7\*24\*3600) = 0.000496


# Oracle

## The "pull model" of Oracle

Deri Protocol adopts the pull model of Oracle. The pull model is a new approach to price oracles that eliminates transaction costs paid by the oracle and data providers, which enables it to scale in ways that traditional push oracles cannot. In a pull model, the oracle does not push data to the blockchain, but instead waits for the blockchain to request data. This reduces the amount of data that needs to be pushed to the blockchain, which in turn reduces the transaction costs. Deri Protocol uses a pull model for its oracles, which allows users to pull prices on-chain only when they are needed. This new oracle design improves on existing oracles by eliminating transaction costs paid by the oracle and data providers, which enables it to scale in ways that traditional push oracles cannot. Another advantage of the pull model is that the price is updated when used, which avoids the transaction-front-run issue of push-model oracles.

Deri Protocol employs [Oraclum](https://oraclum.io/) and [Pyth](https://pyth.network/) oracles to guarantee precision and stability in pricing for derivatives trading. The primary aim of this approach is to safeguard against front-running, ensuring a fair and reliable trading environment.


# External Custody

## **Overview**

Deri Protocol adopts a money market protocol as "external custodian" to carry out the following functionalities:&#x20;

* Holds and secures user capital in one or several base tokens;&#x20;
* Calculates a total dynamic effective value of the user capital deposited.

## AAVE: The Money Market Protocol on Abitrum

For the trading business to better scale, Deri Protocol adopts AAVE as the external custodian on Abitrum. AAVE does not just hold capital but also calculates its dynamic effective value.&#x20;

The support of multiple base tokens is more systematical, as users can choose to deposit any token supported by AAVE, e.g. USDC, DAI, WBTC, ETH, LINK.

When users deposit several kinds of tokens, the real-time total dynamic effective value of the tokens is calculated by AAVE with some built-in functions.


# Funding Fee

## What is Funding Fee?

Both **Perpetual Futures and Everlasting Options are funding fee based**. Funding fees are periodic payments between traders and or liquidity providers (i.e paid peer-to-peer). Hence, Deri Protocol takes no fees from funding fees as it is done directly between users. \
\
Depending on the derivative type, the direction and the total net position: traders and or liquidity providers will either pay or receive funding fees.

## **Funding Fee of Perpetual Futures**

To balance the two sides of long and short positions, the pool will always apply a funding fee to the majority side. The funding fee mechanism of Deri Perpetual Futures is quite similar to that of the centralized exchanges (e.g. [BitMEX](https://www.bitmex.com/app/perpetualContractsGuide#Funding)). That is, the funding fee is proportional to the spread of the mark price over the index price, i.e. (mark-index). Every second, one long position pays one short position funding fee as below:

$$
F=f\*(P-i)
$$

​where *P* is the mark price, *i* is the index price, and *f* is the funding fee coefficient.

**Note**: given $$(P-i)$$ is determined by the net position, the funding fee is ultimately determined by the net position. Specifically, when $$l>s$$, the funding fee is positive (meaning long positions pay short positions), whereas when $$l\<s$$, the funding fee is negative (short positions pay long positions).&#x20;

This is mathematically equivalent to our funding mechanism prior to V2.1 (V1 and V2). Please refer to [this article](https://deri-protocol.medium.com/introducing-dpmm-for-deri-perpetual-futures-f2acee29c880) for the comparison and equivalence between the funding mechanisms of V2 and V2.1.

## **Funding Fee of Everlasting Options**

For each second, assuming the total number of contracts in a long position is L while that in a short position is S. Then every single long contract will pay a funding fee per the following formula:

&#x20;                                 $$FundingFeefor7Day=OptionMarkPrice-Payoff$$​

where

$$
Payoff = max(spot - strike, 0) for call
$$

$$
Payoff = max(strike - spot, 0) for put
$$

**Please note:** \
1\. the Funding Fee is accrued on a per-second basis. That is, a funding fee of (Funding Fee for 7 Day)/604800 is accrued every second.&#x20;

2\. Unlike Perpetual Futures, theoretically the funding fee for Everlasting Options is always positive (i.e. long positions always pay Funding Fee to short positions).

{% hint style="info" %}
While in theory the Funding Fee for Everlasting Options is always positive, it can be pushed to negative by trading actions in real trading.

For more details, refer to Deri's Everlasting Options [Whitepaper](/library/whitepaper)
{% endhint %}


# Leverage

## **Overview**

**Deri Protocol** enables traders to benefit from leverage (**up to 12.5x on BNB Chain & 25x on Arbitrum**) by covering a position with margin usage that is worth less than the total size of the position.

The use of leverage, depending on the degree of leverage, significantly affects your margin usage, has an impact on your margin requirement, and can greatly increase the possibility of liquidation. Therefore, traders should be aware of how leverage works, including its functioning and risks of losing or being liquidated.

You can prevent your account/position from falling below the Maintenance Margin requirement and being liquidated by depositing sufficient margin to your position(s) to maintain the margin requirement\
\
For more details, please read the margin requirement & Leverage article: [Margin Requirement](/how-it-works/margin-requirement) & [Leverage](/how-it-works/leverage)

{% hint style="warning" %}
The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite
{% endhint %}


# Margin Requirement

## Overview

Margin requirement refers to the percentage of marginable assets that an trader is obliged to pay with his own assets. The margin requirement can be further subdivided into the **Initial Margin Requirement** and **Maintenance Margin Requirement.**&#x20;

{% hint style="warning" %}
&#x20;Should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions of the same pool.\
\
&#x20;Please note accordingly, forced liquidations are executed on the account level too. In that case, you would lose all of your margin balance, i.e. your margin balance would become 0. \
\
For more details refer to our [Liquidation](/how-it-works/liquidation) or [Trading FAQ](/library/faqs/trading-faq)
{% endhint %}

## **Initial margin requirement**

An initial margin requirement means the % of assets that is required if an investor opens a position.&#x20;

The minimum Initial Maintenance Margin requirements of the specific Trading Symbol can be found on the Contract Info panel on the trading interface after selecting the Trading Symbol&#x20;

{% hint style="warning" %}
Please note that when the Open Interest of a symbol surpasses some threshold, an Open Interest Multiplier will be applied to increase Initial Margin Requirement. Read [Open Interest](/how-it-works/open-interest) for more details.
{% endhint %}

### Perpetual Futures&#x20;

The initial margin requirement always fixed for perpetual futures. You can find the initial margin requirement at the Contract Info

![](/files/ILFfOb68tIdbQT9tAYSg)

#### Example

Let's assume a fictitious initial margin requirement of 8%

For instance, if you have 1,000 BUSD you wish to open a ETHUSD Perpetual Futures position, with a current spot ETHUSD price of 4,000$ , which requires 10% margin, the amount of ETHUSD position, you can buy as margin is calculated as follows:

Buying Power is less or equal to 1000 BUSD / 8% = 12500 BUSD

You can purchase up to 12500 BUSD worth of ETHUSD positions\ <br>

### Everlasting Options&#x20;

Unlike the fixed margin requirement for Perpetual Futures, Everlasting Options adopt a Greek-based margin mechanism, which can be viewed on the contract info page. The details of the Greek-based margin mechanism can be found in the [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_v3_whitepaper.pdf).

![](/files/GGW4WhG4VffOelyEUGdc)

## **Maintenance Margin Requirement**

Once the position is opened, the margin requirement represents the percentage quantity of assets that the investor must maintain in the margin account. This is called the "Maintenance Margin Requirement". If the investor is not able to keep the percentage quantity of assets above the Maintenance Margin Requirement, account level liquidation will occur.

The minimum Maintenance Margin requirements of the specific Trading Symbol can be found on the Contract Info panel on the trading interface after selecting the Trading Symbol

### Perpetual Futures &#x20;

The Maintenance Margin Requirement always fixed for perpetual futures. You can find the maintenance margin requirement at the Contract Info

#### Example

Let's assume a fictitious maintenance margin requirement of 4%

You have 10,000 BUSD worth of ETHUSD positions, using 5,000 BUSD on assets & 5,000 BUSD on margin. Since the Maintenance Margin Requirement is 4%, the value of the trader's 50% margin requirement has declined from 5,000 BUSD to 250 BUSD, resulting trader's account falling below the required maintenance margin level, which would be 500 BUSD.<br>

### Everlasting Options&#x20;

Unlike the fixed margin requirement for Perpetual Futures, Everlasting Options adopt a Greek-based margin mechanism, which can be viewed on the contract info page. The details of the Greek-based margin mechanism can be found in the [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_v3_whitepaper.pdf).

![](/files/xWWQh7Nw0GHeqH83DNpD)

{% hint style="info" %}
**Know the difference:** *Available Margin & Margin Usage*\
\
\&#xNAN;***Available Margin*** indicates assets that you still have available for trading (up to certain degree) and that are currently unused. \
\
\&#xNAN;***Margin Usage*** are the used, not available assets that are in your current open position(s).
{% endhint %}


# Open Interest

## Understanding Open Interest

The Open Interest of a symbol is the total number of outstanding contracts currently held on that symbol. It serves as an indicator of market activity and liquidity. However, excessive open interest can pose risks to the stability of a trading platform, particularly in the decentralized finance (DeFi) space.

## Open Interest Multiplier

In December 2024, we introduced a new algorithm involving a multiplier to calculate the initial margin requirement of a trade on Deri. First, we define a (soft) bound of Open Interest as one half of the Open Interest Hard Limit that was defined in the previous mechanism. And then we calculate Open Interest Multiplier (OIM) as follows:

$$
OIM = max(\frac{Open Interest}{Open Interest Bound}, 1)
$$

With this risk management measure, the initial margin requirement is multiplied with OIM. That is, when the Open Interest of a symbol surpasses its Open Interest Bound, OIM becomes greater than 1 and subsequently the protocol starts to increase the initial margin requirement. That is,

$$
Final Initial Margin Ratio = Standard Initial Margin Ratio \* OIM
$$

Note that OIM does not affect maintenance margin requirement and thus does not impact the mechanism of liquidation.&#x20;

## Open Interest Limits

Additional to the adjustment of initial margin requirement, we also implement the following two “hard limits” on OIM, and hence on the open interest:

* When OIM > 4, only trades decreasing Total Net Position can be placed.
* When OIM > 8, no trades can be placed any more.

That is, the overall hard limit of OIM is 8, while the hard limit of OIM for increase-net-position trades is 4. In other words, the range \[4, 8] of OIM is reserved for trades decreasing net positions. With such a setting, trade decreasing net positions can always be placed and executed.

<br>

<br>


# Liquidation

## Overview

Opening a leveraged position is equivalent to borrowing assets from liquidity providers of the same pool to buy/sell an asset.

If the value of that asset/position (of which trading symbol you're trading) decreases, the losses approach the value of your margin.  Keep in mind that should you have positions in several symbols of the same trading pool, a total margin requirement would be calculated for all of your positions.\
\
&#x20;Please note accordingly, forced liquidations are executed on the account level too. In the case of forced liquidation, you would lose all of your margin balance, i.e. your margin balance would become 0.&#x20;

Any price movement causing the dynamic effective balance of your account to drop below the Maintenance Margin Requirement, account-level liquidation will take place.

{% hint style="warning" %}
Traders can prevent liquidation by depositing additional margin or by closing their position(s), to avoid your account of falling below the maintenance margin requirement
{% endhint %}

## Liquidator

Since Deri Protocol is completely on-chain, Liquidation is not carried out by Deri Protocol, but by calling the *liquidate()* function of the respective smart contract. It is a public function open to be called by anyone. That is, anybody can help the liquidation by paying the gas to invoke the function to liquidate a position with insufficient margin (below maintenance margin requirement). The successful liquidator is rewarded by part of the remaining value of the position being liquidated.

While everyone is encouraged to participate in liquidation, liquidators are required to stake DERI in the "privileger" pool with a staking amount no less than the average level. Please refer to FAQ "[How to become a qulified liquidator](/library/faqs)" for details.&#x20;


# Mining (AMM Liquidity Mining)

Liquidity

## Overview

Liquidity providers provide liquidity to Deri [pools ](https://deri.io/#/pool)to mine yield paid in DERI tokens. The provided liquidity can be withdrawn at any time and solely through the address with which the liquidity has been added.\
\
Liquidity Providers cover the discrepancy of trading positions between long and short positions for each of the trading symbol of the specific trading pool they added liquidity to. So if the long positions of a trading symbol exceed the short positions, then the liquidity providers in this event take over the short side. In the opposite case, if the short positions of a trading symbol exceed the long positions, liquidity providers would take the long side, to cover the discrepancy of missing positions between the both. Covering the discrepancy opens up a potential market risk for liquidity providers, but also the potential to earn a share of the traders' losses.

So in general, it is essential to comprehend that liquidity providers are the counterparts of traders on Deri Protocol. When traders realize profits, they do so at the expense of liquidity provider's provided liquidity. When traders realize losses or are liquidated, liquidity providers realize profits at the expense of traders.&#x20;

To mitigate the risk of losses for liquidity providers, those receive 20% of all transaction fees paid by traders belonging to the same pool, likewise liquidity providers receive remaining margins from liquidations, if a traders position is liquidated. In addition, they may also earn from the funding fees. With these potentially attractive compensations, we reduce the risk of losses for liquidity miners and facilitate the ability to offer liquidity on Deri Protocol to a degree to potentially even leading to a positive PnL, beside the always certain yield earned in DERI tokens.

Liquidity providers also earn additional yield from the money market protocol - interest and also the protocol's liquidity mining reward while providing liquidity (only v3 pools).

<table><thead><tr><th width="197">-</th><th>Transaction fees</th><th width="224">Funding Fee (Perpetual Futures)</th><th width="263">Funding Fee (Everlasting Options)</th><th width="150">yield/mining rewards (only v3)</th><th>Liquidation</th></tr></thead><tbody><tr><td>Liquidity Providers</td><td>Receiving (20%)</td><td>Receiving</td><td>Minority long side: Paying<br>Minority short side: Receiving</td><td>Receiving</td><td>up to 1000$ 50%, over 1000$ >50%</td></tr><tr><td>Trader</td><td>Paying</td><td>Minority side: Receiving<br>Majority side: Paying</td><td>Long: Paying <br>Short: Receiving</td><td>Receiving</td><td>N/A</td></tr></tbody></table>

Specifically, there are two types of potential returns, one with market risk:

### I. Yield of DERI token

**The APY shown on each liquidity pool refers to this part of yield.**&#x20;

As a miner, you earn your DERI reward (APY), proportional to the dollar value and the time length (i.e. timed value) of your liquidity contribution.&#x20;

DERI rewards is calculated and distributed per block based on LPs’ liquidity percentage in each pool. You can claim them by clicking on the DERI icon. Please note that you will need to pay transaction fees in order to claim your DERI reward tokens.

![](/files/6vkb6SCs8NS9NK8EtK9D)

### II. Base token Profit (with Market Risk)

As mentioned above the Liquidity provider's PnL, which reflects your profits and losses, is an interplay of various fees paid & received, possible liquidations, profits and losses of the counterpart.&#x20;

Specifically, there are certain and uncertain profits you may earn as a liquidity provider. For this part of profits, your liquidity (base token, e.g. BUSD) is exposed to market risk since you act as counterpart to the trader's position. All of the following certain and uncertain profits are paid in the Base token currency. (e.g. BUSD)

**Certain Profits:**

1. 20% of the transaction fees paid by traders flow into the liquidity pool and are shared between the liquidity providers. (This percentage is the result of [DIP2](https://deri.io/#/governance)).
2. *Perpetual Futures Pools:* The funding fee is always paid by Perpetual Futures traders on the majority side to minority side. And since the pool including its liquidity providers are always on the minority side, Liquidity providers receive funding fees. This fee amount is dynamic and adjusts to the net position (Total size of long position minus total size of short position held by traders).
3. When the trader is liquidated, the remaining margin is shared between the liquidators and the liquidity providers. Up to a certain amount (e.g. \~2000 USD), the remaining margin position is shared in half, whereby for larger margin positions, the LP's overall share increases, as the liquidators' profit is capped at a limit (e.g. \~1000 USD).
4. Additional yield from the money market protocol - interest and also the protocol's liquidity mining rewards. (only v3 pools)

**Uncertain Profits:**

1. An uncertain but possible, loss of a trader increases your LSV or Mining PnL.
2. *Everlasting Options Pools:* The funding fee is always paid by Long-positions to short positions. Unlike Perpetual Futures pools, if there are more short than long positions in the pool, liquidity providers cover the difference and switch to the long side. Since long always pays short, liquidity providers pay funding fees to the short traders. If long positions exceed short positions, liquidity providers take the short side and receive funding fees. This possible profit is in your Base token currency

**Market Risk**:

1. An uncertain but possible profit of a trader decreases your LSV or Mining PnL. To the extent that it can become negative. Nevertheless, the probability of market loss on Deri liquidity mining is much smaller than for e.g. that of Uniswap due to the protection of arbitrageurs. This uncertain, but possible loss is in your Base token currency
2. While liquidity providers are always on the minority side on perpetual futures pools (i.e. they earn funding fees), they can (but don't have to) be on the majority side on Everlasting Options pools (i.e. they pay funding fees), since Long always pay short. Therefore, if the liquidity providers take the long side, they pay funding fees to the short side. This possible loss is in your Base token currency

**Minig PnL Settlement**

When you market making in DERI, you are exposed to uncertain market risk and therefore incur a corresponding PnL, which will be settled based on the type of token you are lping and the result of profit/loss.

* When you deposit a non-BUSD tokens (e.g. BTC) to provide liquidity and your mining pnl is positive, you choose to withdraw all your BTC, your mining pnl will be converted to BTC along with your liquidity. However, if you have other non-BUSD tokens that are lping at this time, your mining pnl will be transferred to your BUSD vault when you withdraw all your BTC.
* When you deposit non-BUSD tokens (such as BTC) for market making, and the mining pnl is negative. When you choose to withdraw BTC, the smart contract will automatically sell some BTC to cover the loss, so the amount of BTC receive will be less than the initiated amount.
* When you use BUSD to make market, regardless of the positive or negative mining pnl, it will be settled directly with your BUSD account.

{% hint style="info" %}
Liquidity provider's profit (or loss) in base token is reflected in the change of *Liquidity Share Value (LSV) or Mining PnL*. You can calculate your base token total by multiplying the LSV with the Staked Balance, **shown on the pool info overview**.
{% endhint %}

## Deposit Reward & Withdraw Penalty

With the DPMM mechanism, the net position borne by the liquidity pool pushes the Mark Price up or down by the net position size. Such deviation is inversely proportional to the pool‘s total liquidity. Therefore, adding liquidity would bring the Mark price closer to the Index price (for futures) or the theoretical price (for options and powers) and consequently cause an unrealized profit to the pool. Whereas removing liquidity would push the Mark price away from the Index price or the theoretical price and consequently cause an unrealized loss for the pool. In other words, such unrealized PnL would incur a minor reward for adding liquidity and a minor penalty for removing liquidity. (Please note these unrealized PnLs, i.e., the rewards and the losses, are generally insignificant.)

Per the DPMM, the reward will be distributed among all LPs, while the penalty will be borne by the removing LP alone. Since the total rewards and total penalties would cancel out, all the LPs as a while will not have any profit or loss due to this reason. However, those staking liquidity longer will share more profits and bear less loss from this mechanism than those staking shorter. So this is a mechanism to encourage LPs to stake longer rather than shorter.

{% hint style="info" %}
Got questions about AMM Liquidity Mining on Deri Protocol? Check out our  [Mining FAQ](/library/faqs/mining-faq)
{% endhint %}

## Is AMM Liquidity Mining on Deri pools risk-free?

No, it isn't. In general, it is essential to comprehend that liquidity providers are the counterparts of traders on Deri Protocol. When traders realize profits, they do so at the expense of liquidity provider's provided liquidity. When traders realize losses or are liquidated, liquidity providers realize profits at the expense of traders.

To mitigate the risk of losses for liquidity providers, those receive 20% of all transaction fees paid by traders belonging to the same pool, likewise liquidity providers receive remaining margins from liquidations, if a traders position is liquidated. In addition, they may also earn from the funding fees.&#x20;

However, please note that such market risk is different from the *impermanent loss* of spot exchanges (e.g. Uniswap or Sushiswap). First of all, the fact it is called "risk", instead of "loss", indicates that the mining PnL (i.e Profit & Loss) result could be negative but also positive (which depends on several factors such as funding & transaction fees, exceeding traders' profits & realizing them, etc.). Secondly, the probability of a negative result (a loss) on Deri liquidity mining pools is much smaller than that of typical spot exchanges due to the protection by arbitrageurs, although a certain market risk remains. \
\
You might think of liquidity mining on Deri as investing in a low-risk fund with potentially very high profit, whereas that risk-free liquidity mining is like depositing your money into a bank saving account.

Please refer to our [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_whitepaper.pdf) for further details regarding the protection by the arbitrage mechanism.


# Limit Orders and Stop Orders

A Limit Order uses a specific limit price to trigger market buys or sells. This allows you to enter or exit a position at your predetermined limit price or at a better rate. For Futures, the mark price can be used as the trigger price. In the case of Options and Powers, both the mark price and the underlier's index price can serve as triggers.

To illustrate, consider this example: If you're optimistic about ETHUSD and intend to purchase it at a rate lower than its current value, you can place a limit order to buy at a price 10% below the current mark price. When the mark price descends below your set limit price, a keeper will facilitate the execution of the buy order for ETH without your manual intervention.

Below is a concise breakdown of Limit Orders & Stop Orders, based on the trigger price's relation to the current price:

| Condition                     | Buy/Long  | Sell/Short |
| ----------------------------- | --------- | ---------- |
| Trigger Price < Current Price | Limit Buy | Stop Sell  |
| Trigger Price > Current Price | Stop Buy  | Limit Sell |

For instance, if you already hold a long position in ETHUSD and want to set a stop-loss order that activates when ETHUSD prices drop by over 10%, you can initiate a Stop Order. This order will sell ETHUSD when its price is 10% below the current price.

Key Takeaways on Using Limit and Stop Orders:

* Limit orders and stop orders are processed as market orders when activated.
* The execution price is not guaranteed to be better than the trigger price. Price fluctuations might occur during the keeper's execution, but configuring a slippage tolerance can help counteract this.
* The trigger price doesn't account for the price impact from DPMM slippage. Thus, the final trade price is influenced by both the trigger price and DPMM slippage.
* For multiple orders with the same trigger prices, execution order is randomized, depending on which order the keeper identifies first.

Important Notes:

It's crucial to understand that the successful execution of orders is not guaranteed. Several factors can lead to execution failures:

* A keeper might initiate the trade, but it can fail due to issues like insufficient margins or surpassing the price limit. Such failed orders will be automatically canceled.
* Although a designated price might be reached, it might not stay there long enough to be executed by keepers.
* There might be instances when the keeper's service is temporarily unavailable.


# Deri Improvement Proposal (DIP)

DIP Contributing

**Deri Improvement Proposal** (**DIP**) is a standard for introducing features or information to **Deri Protocol**. The **DIP** should provide besides a simple summary, motivation; a concise technical specification of the attribute and a rationale for the feature.

As Deri Protocol is a community-centered project, the innovation and success of the protocol depend on the community's input.

## DIP Contributing

When you believe your final AIP draft is mature enough and ready to propose to the community. \
Visit  [**DIP Submission Form**](https://airtable.com/shrOr6s8zpN3qukj8), fill it out in detail and submit.\
\
Afterward, your DIP is added to the governance discord where it can be discussed for inclusion in a future protocol upgrade. If a small part of the community agrees to include it, it gets the status "Proposed". Your proposal will now be reviewed On-Chain by the entire community through the [**Governance Platform**](https://deri.io/#/governance) and given a majority vote, it will be upgraded to the status "Approved"

At this stage, your proposal will be forwarded to the developers within the community, who will be responsible for the execution of your theoretical proposal and its implementation.

Check out the DIPs here: <https://deri.io/#/governance>


# Derivative Products

Deri Protocol's derivative products

For the time being, Deri Protocol offers three major products: **Perpetual Futures, Everlasting Options and Power Perpetuals**. Perpetual futures, Everlasting options ans Power Perpetuals are similar in that they are both funding fee-based perpetual derivatives. With these derivatives, the user has to pay a funding fee to maintain the position, unlike regular futures which have an expiry date.&#x20;

The primary difference between perpetual futures and everlasting options is the payoff function attached to the derivative. Perpetual futures are a linear payoff function. If we take Bitcoin as example, if bitcoin (BTC) rises, the holder of the derivative would actually make money, and if it drops, the holder would lose money.

In comparison, the payoff function for everlasting options is non-linear. To use the same example for a call option: If the bitcoin rises, the holders make money, and they lose nothing if it decreases. For maintaining this less risky position, the user is generally charged a fee on a per-second basis.

Everlasting options which are implemented as a decentralized protocol are one of the groundbreaking & pioneering  DeFi primitives. This is a new type of derivative that allows traders to have unprecedented never-before-seen long-term exposure without having to roll positions. This work is based on a theoretical paper by Dave White & Sam Bankman-Fried & the extension of the Deri Protocol team\
\
Read our Whitepapers to learn more about Deri Protocol's major products: [**click here**](/library/whitepaper)<br>


# Whitepaper

Read our ambitions, thoughts and plans on how we want to fundamentally change the DeFi space with Deri Protocol

## Latest **Whitepaper**

### Deri Protocol Whitepaper V4

{% embed url="<https://github.com/deri-protocol/whitepaper/blob/master/deri_v4_whitepaper.pdf>" %}

## **Archive**

### **Deri Protocol Whitepaper v0.0.9 (General)**

{% embed url="<https://github.com/deri-finance/whitepaper/blob/master/deri_whitepaper.pdf>" %}

### **Deri Protocol v2 Whitepaper v0.1.0 (Futures Upgrade)**

{% embed url="<https://github.com/deri-finance/whitepaper/blob/master/deri_v2_whitepaper.pdf>" %}

### **Deri Protocol - Everlasting Options Whitepaper**&#x20;

{% embed url="<https://github.com/deri-finance/whitepaper/blob/master/deri_everlasting_options_whitepaper.pdf>" %}

### Deri Protocol Whitepaper v3

{% embed url="<https://github.com/deri-finance/whitepaper/blob/master/deri_v3_whitepaper.pdf>" %}


# Code Audits

Code Audits of Deri Protocol

Security first in Deri Protocol. To be comfortable with launching Deri Protocol V2, security audits from Peckshield and Certik are carried out to reduce the threat of direct protocol vulnerabilities.

## Latest **Code Audit**

### **Deri Protocol V4 Audit By Peckshield**

{% embed url="<https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-DeriV4-1.0.pdf>" %}

## **Archive**

### Deri Protocol v**3** Audit By Peckshield

{% embed url="<https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-DeriV3-1.0.pdf>" %}

### **Deri Protocol v1 Audit By Peckshield**

{% embed url="<https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-Deri-v1.0.pdf>" %}

### **Deri Protocol v2 Audit By Peckshield**

{% embed url="<https://github.com/peckshield/publications/blob/693bdb69e3e3e422b4f7e1f3130d841e631b4dab/audit_reports/PeckShield-Audit-Report-DeriV2-v1.0.pdf>" %}

### **Deri Protocol v2 Audit By CertiK**

{% embed url="<https://www.certik.org/projects/deriprotocol>" %}

### **Deri Protocol v2 Everlasting Options Audit by Peckshield**

{% embed url="<https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-DeriV2EverLasting-v1.0.pdf>" %}


# Tokenomics

DERI's Minting & Utilities

## Minting

Ultimate Total Supply (Fully Diluted Total Supply) = *1,000,000,000*  consists of a non-mining (preallocation) part of *400,000,000* DERI tokens and a mining part of *600,000,000* DERI tokens.&#x20;

### **Non-mining part (preallocation)**

Initial Total Supply = *400,000,000*. This is the number of DERI minted at DERI's genesis block. These is the non-mining part and is distributed to the team, early investors and foundation (project treasury).

* DERI allocated to the team & early investors = 260,000,000 \
  This is part of the initial total supply of 400,000,000 and is locked in a [vesting vault](https://etherscan.io/address/0x05aff24f7f653d2f067917c0b157f84971e54966) with a 2-year linearly releasing plan. Please [click here](https://etherscan.io/address/0x05aff24f7f653d2f067917c0b157f84971e54966#code) to check out the details of the vesting plan.
* DERI allocated to the treasury = 140,000,000\
  This is part of the initial total supply of 400,000,000 and is unlocked since day 1. It includes 40,000,000 DERI originally allocated to the treasury at the genesis and additionally, subsequently 100,000,000 DERI, which has been given up and transferred to the treasury by the operation team for fundraising and to promote a more decentralized and community-driven operations.

**Note**: The original Tokenomics allocates 360,000,000 DERI to the team & early investors and 40,000,000 DERI to the treasury.&#x20;

### Mining part

Total supply of the Mining part = 600,000,000. This is the number of mined DERI after all the mining tokens are mined out (in decades).&#x20;

Currently, the mining rate of DERI is around 0,8M per week, including 4 parts:

* Liquidity mining in trading pools by providing base tokens
* Liquidity mining with the DERI-BUSD Cake-LP staking
* Liquidity mining with the DERI-USDT SLP staking in Sushiswap's Onsen pool

In summary, the current Total Supply is 400,000,000 + DERI minted throughout mining.\
This is the number of DERI that have been minted so far, including the initial total supply (400M) which is also displayed as"Max Total Supply" on [etherscan](https://etherscan.io/token/0xa487bf43cf3b10dffc97a9a744cbb7036965d3b9). This number is increasing as the DERI mining continues. Please check the [etherscan](https://etherscan.io/token/0xa487bf43cf3b10dffc97a9a744cbb7036965d3b9) page for the up-to-date value.

## Utilities & Use Cases

**Governance** \
Like in other DeFi projects, the community ownership and governance system are based on the Protocol token, DERI. In practice, this means the significant decision-making of the protocol and the tokenomics will be carried out by voting per DERI.<br>

**Privilege**\
We have defined a new type of value basis of DeFi protocol tokens, *Privilege Token*, which is different from the common types such as governance tokens, fee tokens, or security tokens. DERI is a privilege token means people in the Deri ecosystem need to stake DERI to obtain some privileges during the Deri trading business.

Please note privilege token is different from governance token. Governance token represents the power of governing the community or decision-making of the protocol (e.g. revising rules). Whereas privilege token is to grant a user some privilege during the business activity. As an analogy of a hotel, a governance token lets the holder participate in the hotel management; whereas a privilege token is like the hotel's VIP card, giving the holder access to the hotel's advanced services.

Specifically, DERI grants users the following privileges:

* Liquidator qualification: with Deri Protocol, position liquidation is decentralized and open to qualified users. Since liquidation is riskless profitable, while we encourage anybody to participate in liquidation, for some of the trading pools we require participants to stake DERI in the liquidator qualification pool and his/her staking amount has to be no less than the average level.&#x20;
* VIP transaction fee rate: going forward, a rule of differentiated transaction fees will be introduced per traders' DERI staking in a specific pool.

As the Deri business activities grow, we will grant a series of privileges associated with different scenarios, to promote a prosperous ecosystem.

## What are the Smart Contract Addresses for DERI token?

The DERI token characterized by multichain support. It is available on the following networks with the following smart contract addresses:<br>

**Ethereum**: [0xa487bf43cf3b10dffc97a9a744cbb7036965d3b9](https://etherscan.io/token/0xa487bf43cf3b10dffc97a9a744cbb7036965d3b9)

**Arbitrum:** [0x21e60ee73f17ac0a411ae5d690f908c3ed66fe12](https://arbiscan.io/address/0x21e60ee73f17ac0a411ae5d690f908c3ed66fe12)

**zkSync Era**: [0x140D5bc5b62d6cB492B1A475127F50d531023803](https://explorer.zksync.io/address/0x140D5bc5b62d6cB492B1A475127F50d531023803)

**Linea:** [0x4aCde18aCDE7F195E6Fb928E15Dc8D83D67c1f3A](https://lineascan.build/address/0x4aCde18aCDE7F195E6Fb928E15Dc8D83D67c1f3A)

**Scroll:** [0xa3c5293892f112C834ADa46219973C5e4Ac23bA0](https://scrollscan.com/address/0xa3c5293892f112C834ADa46219973C5e4Ac23bA0)

**Polygon zkEVM:** [0x360CE6EeCDF98e3851531051907e6a809BF6e236](https://zkevm.polygonscan.com/address/0x6aa414780Df0FbC3a1f751916dd91826B2DEFb07)

\
**BNBChain**: [0xe60eaf5A997DFAe83739e035b005A33AfdCc6df5](https://bscscan.com/token/0xe60eaf5A997DFAe83739e035b005A33AfdCc6df5)\
**Polygon**: [0x3d1d2afd191b165d140e3e8329e634665ffb0e5e](https://polygonscan.com/address/0x3d1d2afd191b165d140e3e8329e634665ffb0e5e)\
**HECO**: [0x2bdA3e331Cf735D9420e41567ab843441980C4B8](https://hecoinfo.com/token/0x2bdA3e331Cf735D9420e41567ab843441980C4B8)

## Burning Mechanism

Following [DIP 15](https://deri.io/#/dipfifteen)'s vote and approval:&#x20;

* 40% of the trading fees will be collected as "protocol fees" to regularly buy DERI from secondary markets to be burned to deadlock address.&#x20;
* 40% of the trading fees will be sent to the treasury to help maintain and grow the protocol.
* 20% of the transaction fees will be awarded to liquidity providers.

The burning program will be carried out differently for these two types of collected protocol fees.

* For the collected B0 token
* For the collected DERI token

Due to DERI token’s multi-chain nature, the implementation of the burn-to-deadlock mechanism cannot be just a simple transfer to a deadlock address. The tricky part is, while DERI is Ethereum-native, the protocol fees collected to burn DERI might be on non-Ethereum networks, in which the DERI tokens are essentially wrapped ones. To burn a wrapped token, you have to transfer it to the original network and burn it there. It is very easy to understand with this analog: if a [Binance-Peg Ethereum Token (ETH)](https://bscscan.com/token/0x2170ed0880ac9a755fd29b2688956bd959f933f8) is “burned” on BNB Chain, it does not mean an ETH is burned — an ETH has to be burned on Ethereum network.

Here we explain the procedure taking the DERI-burning from BNB Chain as an example. BUSD is the B0 token on BNBChain.

**For the collected BUSD**

The key component of the burning mechanism is a set of two pairing “burner” smart contracts on BNB Chain and Ethereum, **with the same address.** Let’s call them Burner1 (on BNB Chain) and Burner2 (on Ethereum).

Burn1: <https://bscscan.com/address/0x2e225Dacc4c2b843BB8a6b2215b9008f922D06bd>

Burn2: <https://etherscan.io/address/0x2e225Dacc4c2b843BB8a6b2215b9008f922D06bd>

DERI tokens are burned as follows.

1. Call the buyAndBurnDeri function inside the protocol fee collector to buy DERI from DEX and transfer them to Burner1 on BNB Chain.
2. Burner1 is coded to have one function only: uses the DERI bridge to transfer the DERI tokens from BNB Chain to Burner2 on Ethereum. Please note that Burner1 and Burner2 have to be deployed at the same address on the two networks, since the DERI bridge only supports same-address bridging.
3. Once the DERI bridge signs the transfer, Burner2 can claim the transferred DERI tokens.
4. Burner2 is coded to have one function only: send the claimed DERI tokens to [the deadlock address](https://etherscan.io/address/0x000000000000000000000000000000000000dead).<br>

**For the collected DERI**

There will be no buying procedure, the DERI tokens will be burned directly. The procedure is very straightforward, calling the function “collectProtocolFee” will send the accrued protocol fees (DERI) directly to Burner 1 on BNBChain. Anybody who wants to experience the fun of “burning DERI” can go ahead and call this function yourself.

The next steps are the same as "For the collected BUSD" step 2–3–4.

**All DERI tokens burned with this mechanism can be found in this** [**DEAD address**](https://etherscan.io/token/0xa487bf43cf3b10dffc97a9a744cbb7036965d3b9?a=0x000000000000000000000000000000000000dead)**.**

#### Protocol Fee Manager Address:&#x20;

Arbitrum 0x9518dC115Bf7AbD278434bf1b55B6EB9C2ba7D61&#x20;

Linea 0xB22C5A9e69B3e46978cecaA70c54f0063B90D2f6&#x20;

Scroll 0x5Fe2C482D03c1ECfAd01446817a154BFBCC56C33&#x20;

zkSync 0xDECA7b795ae7f7c3Cd41e3bC790949e3a53ED308

<br>


# List of Smart Contracts

Arbitrum: [0x7C4a640461427C310a710D367C2Ba8C535A7Ef81](https://arbiscan.io//address/0x7c4a640461427c310a710d367c2ba8c535a7ef81)

zkSync Era: [0x34FD72D2053339EA4EB1a8836CF50Ebce91962D0](https://explorer.zksync.io/address/0x34fd72d2053339ea4eb1a8836cf50ebce91962d0)

Linea: [0xe840Bb03fE58540841e6eBee94264d5317B88866](https://lineascan.build//address/0xe840bb03fe58540841e6ebee94264d5317b88866)

Scroll: 0x7B56Af65Da221A40B48bEDcCb67410D6C0bE771D

Polygon zkEVM: 0xC7E484c20D5dc5d33299AfB430BFb5d17085eE98

Manta: 0xc8fa78f6B68ab22239222b4249b1fF968D154aE9

BNB Chain: 0x2c2E1eE20C633EAe18239c0BF59cEf1FC44939aC

Blast: 0x60138081198b75aAF15ACA3A17Ec7f5Ffc5D4605

Taiko: 0xd4E08C940dDeC162c2D8f3034c75c3e08f1f6032


# Referral Program

The referral program aims to incentivize users for bringing new traders to the Deri Protocol, by offering competitive rewards to both the referrers and traders, making it a win-win-win situation for the 3 parties involved.

In this article, we’ll provide an overview of the Referral Program, illustrate its reward architecture, and guide you on joining the program.

## How to Join the Program

The **Referrals** page can be accessed from the **More** dropdown in the top navigation bar. After connecting your wallet, click the **Copy Invite Link** button in the top-left corner to generate and copy your unique referral link. You can then copy the link to your clipboard and share it wherever you prefer.

<figure><img src="/files/wKwDWig2NA0Sw5peW22u" alt="" width="470"><figcaption></figcaption></figure>

A referral relationship is established when a user accesses Deri Protocol via your referral link, connects their wallet, and completes a deposit OR a trade on the Lite version. The user will then be permanently associated with you as a referee, and all eligible activity will count toward your commission.

## Referral Tiers

The Referral Program offers a tiered rewards system, encouraging participants to contribute more to Deri Protocol and earn higher rewards. The tiers are as follows:

#### Bronze Tier

* 10% of your friends' trading fees as commissions
* 5% trading fees refund for your friends

#### Silver Tier

* 15% of your friends' trading fees as commissions
* 5% trading fees refund for your friends
* You must have invited 10+ qualified traders OR your friends must have generated more than $250 in trading fees

#### Gold Tier

* 20% of your friends' trading fees as commissions
* 5% trading fees refund for your friends
* You must have invited 25+ qualified traders OR your friends must have generated more than $1,000 in trading fees

To be counted as a "qualified trader", your friend must have accumulated at least $5 in trading fees.

{% hint style="success" %}
The commissions on trading fees will be earned even if the referred trader has not yet become a "qualified trader".
{% endhint %}

### Example with Trading Fees

Bob invites his friends Alice and Charlie with his unique referral link.

1. **Initial trades (Bronze Tier)**\
   Alice makes a trade with a trading fee of 20 USDC. She receives a 5% refund (1 USDC), while Bob earns a 10% commission (2 USDC) under the Bronze tier.<br>

2. **Accumulating trading fees**\
   As Alice and Charlie continue trading, they generate a total of 248 USDC in trading fees. Bob earns 24.8 USDC in commissions (10%) during this period. <br>

3. **Tier upgrade to Silver**\
   Charlie executes another trade with a 50 USDC trading fee. bringing the total trading fees generated by Bob’s referees above $250.

   Bob now qualifies for the **Silver tier**, and the upgrade takes effect immediately.

   * Charlie receives a 5% refund (2.5 USDC)
   * Bob earns a 15% commission (7.5 USDC) on this trade

4. **Continued growth**

   As Alice and Charlie continue trading and generate more fees, Bob may qualify for higher tiers, allowing him to earn increased commission rates on future trades.

### Example with Qualified Traders

Bob invites multiple friends to Deri Protocol using his unique referral link.

1. **Initial activity (Bronze Tier)**

   After a few days, 12 of Bob’s friends have connected their wallets and started trading on Deri. Together, they have generated 50 USDC in trading fees.

   * 8 of Bob’s friends have each generated at least 5 USDC in trading fees and are counted as **qualified traders**
   * The remaining 4 have generated less than 5 USDC and are not yet qualified

   At this point, Bob has **8 qualified traders** and remains in the **Bronze tier**, earning 5 USDC in commissions (10%).<br>

2. **Reaching Silver Tier**

   Alice executes a trade with a 6 USDC trading fee. She receives a 5% refund (0.3 USDC) and becomes a qualified trader.<br>

   Charlie then executes a trade with an 8 USDC trading fee. He receives a 5% refund (0.4 USDC) and also becomes a qualified trader.<br>

   With both Alice and Charlie now meeting the qualification criteria, Bob reaches **10 qualified traders** and qualifies for the **Silver tier**.<br>

   The tier upgrade takes effect immediately.

   * For Charlie’s trade, Bob earns a 15% commission (1.2 USDC)
   * Future trades will continue to earn commissions at the Silver tier rate

3. **Continued growth**

   As Bob invites more users and more referees become qualified traders, he may progress to higher tiers and earn increased commission rates.

   Once a user becomes a qualified trader, they will continue to be counted as such.

## How Tier Upgrades Work

* Tier upgrades take effect immediately once the required conditions are met.
* Commissions from that point onward are calculated based on the new tier.
* Tier levels do not decrease, and previously earned commissions are not recalculated.

## Rewards Distribution

Referral rewards are not distributed in real time. They are settled on a weekly basis and become available to claim once settlement is completed. Users can claim their available rewards on the same page.

<figure><img src="/files/op9q4X2dHK82A1OfwN78" alt="" width="470"><figcaption></figcaption></figure>

{% hint style="info" %}
Tier upgrades take effect immediately, while rewards are settled weekly.
{% endhint %}

## Trading Refunds

If you have been referred and are eligible for trading fee refunds, you can view and claim them directly from your account page. Similar to referral rewards, trading refunds are settled on a weekly basis and become available to claim after settlement.

Claiming your refunds will transfer the corresponding USDC amount to your Web3 wallet.

## Affiliate Program

If you believe you can drive significant trading activity to Deri, we offer an Affiliate Program that provides enhanced rewards for both you and your referees.

Applicants are expected to meet at least one of the following criteria:

* **Social media influencer** with 5,000+ followers on at least one platform
* **Community manager** with 500+ members focused on crypto trading (derivatives experience is a plus)
* **Professional or organization** with an established user base or network in crypto trading, such as:
  * Crypto funds
  * Educational communities
* **On-chain protocol** with at least 500+ daily active users (DAU), such as:
  * Decentralized exchanges
  * Lending protocols
  * Insurance protocols
  * Meme marketplaces
  * LST / LRT projects

## Why Apply as an Affiliate?

Benefit from higher commission rates and dedicated support as you scale trading activity on Deri.\
Work closely with our team to expand your reach within the ecosystem.

If you are interested in joining the Affiliate Program, please contact our team via Discord or Telegram.

{% hint style="info" %}
Applications are evaluated based on the ability to drive meaningful trading volume or onboard a significant number of users.
{% endhint %}

The Referral Program is open to all users and offers rewards for eligible trading activity.


# Social Links & Media

Deri Protocol's social handles

### Official **Communication Channels**

* **Discord**: <https://discord.gg/kb8ZbYgp8M>
* **Twitter**: <https://twitter.com/DeriProtocol>&#x20;
* **Telegram**
  * **Main group (official):** <https://t.me/DeriProtocol>&#x20;
* **Medium**: <https://deri-protocol.medium.com>&#x20;
* **Youtube**: <https://www.youtube.com/channel/UCxWKIor4N3xKP1fA55LM4ww>
* **Reddit**: <https://www.reddit.com/r/DeriProtocol/>&#x20;
* **Bitcointalk**: <https://bitcointalk.org/index.php?topic=5322611.0>

### **Community Groups (inofficial)**

* **Telegram ID:** <https://t.me/deriprotocolindonesia>
* **Telegram FR**:  <https://t.me/DeriProtocol_FR>&#x20;
* **Telegram VN**: [ https://t.me/deriprotocolvn](< https://t.me/deriprotocolvn>)
* **Telegram CN**:  <https://t.me/deriprotocol_zh>
* **Telegram TR:** <https://t.me/deriprotocoltr>
* **Telegram JP**:  <https://t.me/DeriProtocolJP>
* **Telegram TH**: <https://t.me/DeriProtocolThailand>
* **Telegram SP**: <https://t.me/DeriProtocolSpain>&#x20;


# Bridge

Frequently Asked Questions about Deri Bridge

## How to use the DERI Bridge?

Watch our simple clip guide on how to use the DERI Bridge to transfer DERI tokens from one network into another.

{% embed url="<https://www.youtube.com/watch?v=QfyyeGmI9f0>" %}

## Do I lose my DERI if the transferring procedure "fails" in the middle?

No, you have not lost your DERI. All you need to do is to come back to the bridge webpage and finish the process.

If your DERI has already been out of your wallet, i.e., sent to the wormhole, the bridge will definitely issue a signature for your transfer, which means that you just need to come back & connect to the bridge webpage with the address which includes the transferring signature. The website notices the signature and guides you through the procedure to ensure that the transfer is carried out properly.

## What happens under the hood when I transfer my DERI from one network to another?

When you transfer your DERI from Ethereum to BSC, HECO, or Polygon, you send your DERI token to a "wormhole" smart contract to be frozen. And the bridge will mint the corresponding DERI tokens for you on the destination network.

For the opposite procedure, when you transfer your DERI from BSC, HECO, or Polygon to Ethereum, your DERI tokens are burned on the source network and the corresponding DERI tokens are unfrozen from the "wormhole" smart contract to your address.

## Can I transfer DERI tokens from address A on one network to address B on another network?

That is not supported by the bridge. For the bridge operation, you can only transfer your DERI between the same address from one network to another one. If you want to transfer your DERI tokens from address A on one network to address B on another network, you have to take two steps:&#x20;

1. Bridge it from **address A** on network 1 to **address A** on network 2;&#x20;
2. Send your tokens from address A to address B on network 2.

## Is it possible to issue a second signature before the first one has been completed?

If your DERI has already been out of your wallet, i.e., sent to the wormhole, the bridge will definitely issue a signature for your transfer. You must now wait until the transfer process of the first signature is completed, to issue a new signature. Please don’t interrupt the transfer by issuing a new signature.

**Warning: If you issue a second signature, despite the presence of the first signature, the first signature will be invalidated and you will lose all your DERI that would have been transferred with the first signature.**

## What are the smart contract addresses of the Wormholes of Deri Bridge?

The Wormhole is available & active on the following networks with the following smart contract addresses:

**BSC**: [0x15a5969060228031266c64274a54e02Fbd924AbF](https://bscscan.com/address/0x15a5969060228031266c64274a54e02Fbd924AbF) \
**Ethereum**: [0x6874640cC849153Cb3402D193C33c416972159Ce](https://etherscan.io/address/0x6874640cC849153Cb3402D193C33c416972159Ce)[ ](https://etherscan.io/address/0x6874640cC849153Cb3402D193C33c416972159Ce)\
**HECO**: [0x134A04497e9a0b1F8850fEaf87eD18ec348dDa46](https://hecoinfo.com/address/0x134A04497e9a0b1F8850fEaf87eD18ec348dDa46)


# Trade on Demo Testnet

New users on Deri Protocol?

Deri Protocol testnet is here! Demo Trade on Deri Protocol with demo assets to learn how to trade derivatives without risking real assets.

Here is our demo testnet: [testnet.deri.io](https://testnet.deri.io)

**How to use Deri Protocol Testnet on Arbitrum Goerli Testnet?**

1. Connect to Arbitrum Goerli Testnet
2. Obtain Testnet Token at “[Faucet](https://testnet.deri.io/#/faucet)”
3. Start Trading!

Choose the market you'd like to [trade](https://testnet.deri.io).


# Academy


# General

{% content-ref url="/pages/xnt1tz6VL1W5dCFTpmX2" %}
[What are derivatives in DeFi?](/library/academy/general/what-are-derivatives-in-defi)
{% endcontent-ref %}

{% content-ref url="/pages/Y4WXF74jR9H6qDVoOIE2" %}
[What are the 3 biggest mistakes of trading derivatives?](/library/academy/general/what-are-the-3-biggest-mistakes-of-trading-derivatives)
{% endcontent-ref %}

{% content-ref url="/pages/u6VtpLJXOl3dOFefqf2n" %}
[Four tips for your trading](/library/academy/general/four-tips-for-your-trading)
{% endcontent-ref %}


# What are derivatives in DeFi?

In finance, a derivative is a contract that derives its value from the performance of an underlying entity. This underlying entity can be an asset, index, interest rate, or even another derivative.

Derivatives can be used for a number of purposes, including insuring against price movements (hedging), increasing exposure to price movements for speculation, or getting access to otherwise hard-to-trade assets or markets.

Given the importance of derivative contracts in mature, traditional financial systems, it should be no surprise that derivatives are emerging in crypto markets.

### Derivatives in DeFi

Derivatives aren’t new to the crypto world—BitMex, founded in 2014, is a peer-to-peer trading platform with perpetual contracts and futures bought and sold in Bitcoin. Since then, various other centralized exchanges have been launched, they ultimately take on the roles of both brokers and exchanges.

In DeFi, there is no custody. Settlement takes place on-chain, where the terms of the contract are fulfilled. The intersection of DeFi and derivatives is a gamechanger, bringing yet another borderless, low-barrier, financial instrument to the world.

### Deri Protocol shapes derivatives in Web3

Funding-fee-based derivatives have gained a lot of popularity over the years. With the broad range of crypto derivative instruments on offer, Deri Protocol provides DeFi traders numerous ways to enter the market.

In total, Deri Protocol offers three products:&#x20;

* **Perpetual Futures**&#x20;
* **Everlasting Options**&#x20;
* **Power Perpetuals**

With Deri Protocol, trades are executed under AMM paradigm and positions are tokenized as NFTs, highly composable with other DeFi projects.

{% hint style="success" %}
Read more about these products [Getting Started](/)
{% endhint %}

### Disclaimer&#x20;

The information provided is for educational purposes and should not be construed as investment advice by Deri Protocol. Traders should do their own research before making any investment decision. For more details, visit: [ https://deri.io](< https://deri.io>)


# What are the 3 biggest mistakes of trading derivatives?

Learning from other people’s mistakes can save you a lot of time, and more certainly, it will save you a lot of capital. Here we have summarised the Top 3 mistakes made by derivatives traders, and more importantly, how to avoid them.

### **Mistake 1: Trading without a trading plan**

Every trader needs a trading plan. If you don’t have one, it’s time to get one and the best place to start is by thinking about why you’re trading.

Is it because you want to earn a bit of extra money on the side of your regular job?

Do you want to make a career of tracking the market?

Or is it just something you are doing for a challenge?

Whatever the reason may be, the goals will help determine the way you trade.

The trading plan should contain a strategy, time commitments and the amount of capital that you are willing to invest.

### **Mistake 2: Over leveraging**

As we know, leverage can be a double-edged sword. It can amplify both winning and losing trades.

If you use a high level of leverage and the trade turns against you, this could result in a total wipeout of your trading capital.

So the best way to use leverage is to start low. Try using the lowest level of leverage offered by derivatives trading DEX. Once you are more comfortable with how leverage works, then you can increase the leverage level if you like.

### **Mistake 3: Over Expectation of returns**

Many traders enter the derivatives market believing that this is a money-making machine. We cannot say this expectation is wrong. But it is wrong to expect this to take place very fast.

It’s possible to make money in the derivatives market, but you will have to be patient and persistent.

There is another advantage to not over-expecting the returns: If we do not expect very high returns, we will not take big risks in this market. Many traders take such big risks and end up losing their money. Therefore, traders need to rationalize their return expectations.

### **Disclaimer**

The information provided is for educational purposes and should not be construed as investment advice by Deri Protocol. Traders should do their own research before making any investment decision. For more details, visit [https://deri.io](https://deri.io/)


# Four tips for your trading

### **First: Know Your Object**

Before we start anything, our objective must be clear.

When we start building our portfolio, we must know why we are undertaking this trade. To hedge, to speculate, or to arbitrage?

It is essential to know this because this is what will decide your trading actions. If you want to earn a stable income, you will follow a different strategy than if you’re going to hedge market risks.

Which derivatives you will trade depends on knowing exactly what your goal is.

### **Second: Entry and Exit Point**

We are often confused about when to open a position, and more importantly, when to close it. We get clarity when we do our homework before opening a position. Open a position when the reward is in your favor, and exit when you suffer a loss or when your target is reached.

### **Third: Keep what works**

When you are trading in the market, many things will work in your favor, and many things will work against it. Some strategies will generate returns, while some will make you lose. In other words, the right strategy should be pursued and refined, whereas the wrong strategy should be rectified or discarded.

Another important thing is to keep adjusting your trading strategies according to market situations.

### **Fourth: Continuous Learning**

The more you trade in the market, the more you will learn. Every day there is something new to learn in the market, new tools, new strategies, and new derivatives types keep coming.

When you keep yourself updated, your portfolio also stays updated.

### **Disclaimer**

The information provided is for educational purposes and should not be construed as investment advice by Deri Protocol. Traders should do their own research before making any investment decision. For more details, visit [https://deri.io](https://deri.io/)


# Perpetual Futures

{% content-ref url="/pages/HLe6Kzgc8D0vwilVm1px" %}
[General Intro about Perpetual Futures](/library/academy/perpetual-futures/general-intro-about-perpetual-futures)
{% endcontent-ref %}

<br>


# General Intro about Perpetual Futures

### **What are Perpetual Futures?**

Perpetual futures are futures contracts with no expiration date. The “perpetual” status is maintained by paying/receiving the funding fee.

The Deri Protocol lists [**Perpetual Futures**](https://deri.io/#/trade/futures) on many coins including BTC, ETH, BNB, etc.

### **Why trade Perpetual Futures?**

* Hedging and risk management: traders can use perpetual futures to hedge positions
* Leverage: Perpetual Futures do not require traders to post 100% of collateral as margin. Therefore, trading perpetual futures is more capital efficient.
* No need to own the underlying asset: the payoff of the perpetual futures is based on the underlying asset, such as BTC, but traders do not need to own the underlying asset itself. Any profits and losses will be settled directly in settlement tokens.
* Ability to trade both directions: traders can buy (long) or sell (short) perpetual futures, so they can profit from both rising and falling prices. This is not possible with spot trading.

### **Advantages of Perpetual Futures on Deri Protocol**

The “External Custody” feature allows traders on Deri Protocol to use other tokens than stable coins as collateral. Refer to table 1 for base tokens that can be used to trade Perpetual Futures on Deri Protocol.

![Table 1](/files/gB2XM2AXCpHwQVYUuJE0)

### **The Basic terms on Deri Protocol**

When trading Perpetual Futures, you will see a lot of terminology that is being used. We explain the most common terms [Glossary](/library/glossary)

### **Liquidation on Deri Protocol**

You can find detailed illustrations about Liquidation on Deri Protocol [Liquidation](/how-it-works/liquidation)

### **How to trade them on Deri Protocol?**

You can find a detailed guide on Deri Protocol [Perpetual Futures](/library/faqs/trading-faq/perpetual-futures)


# How to Arbitrage

The DPMM of Deri Protocol is designed around the arbitrage mechanism to offset the net position of the trading pool. This article explains the details of the mechanism.&#x20;

The basic idea of arbitrage is straightforward: per the DPMM mechanism, the funding fee is paid from the majority side to the minority side. **Therefore, a very simple arbitrage strategy is to take the minority side of the pool to earn the funding fee.** At a high level, this involves the following steps:

1. Read the current funding rate of the pool. when it is at some positive (negative) threshold, enter a short (long) position.
2. Accordingly, hedge your short/long position outside (e.g. hold a spot position or take a futures position on a centralized exchange as you wish).
3. Sit back and enjoy collecting the funding earning (i.e. negative funding fee).
4. Close your position when it stops paying the funding fee (i.e. the sign of the funding rate flips).

The tricky part is steps 1 and 4, for which you pay transaction fees (i.e. your cost of the arbitrage). **However, if you properly choose the timing of steps 1 and 4 (the entry and closing points), you can compensate your transaction cost with the “negative slippage” of your trades so that the whole procedure from steps 1 to 4 is guaranteed to make profits.** The key is to take advantage of the spread between mark price and index (determined by the DPMM based on the total net position). For example, if we are to arbitrage with the BTCUSD perpetual futures with a transaction fee of 0.1% of the national, then we can choose the entry and closing points as follows (denoting index price and mark price as $$I$$and $$M$$).

1. Assume ***I*****&#x20;= 40000**, and the total position is positive, pushing the mark price up to ***M = I\******&#x20;(1+0.4%) = 40160** Open a short position to pull the mark price to ***M = I\******&#x20;(1+0.2%)** **= 40160***.* Your transaction fee is around **40** and your average trading price of opening the position is around ***I\******(1+0.3%) = 40120** .
2. hedge your long position somewhere else.
3. Collect the funding earning of your short position.
4. Due to other traders’ activities, the total net position becomes **0,** and thus the mark price becomes at par with the new index price (then you stop receiving funding earnings). Let’s assume now the index price ***I’*****=50000.** Close your short position, which would push the mark price to ***M = I’\******(1+0.2%) = 50100**. Your transaction fee is around **50** and your average trading price of closing the position is around ***I’\******(1+0.1%)&#x20;*****= 50050**.*

As long as you are perfectly hedged, your total (negative) slippage from steps 1 and 4 would be **-*****(I+I’)\******&#x20;0.1% = -90**, which is a profit perfect compensating the total transaction fees **90**. Therefore, the funding fees that you earn from step 3 are pure profits. In practice, you would also take into account the possible cost on the hedging side. But this depends on where and how you do it. Under certain circumstances and with specific strategies, this cost could be zero or even negative.

A sample code of taking arbitrage with Deri Protocol can be found here on [Github](https://github.com/deri-finance/demo/tree/main/deri_v3_arbitraguer). Please note this code is for demo purposes only. You will use it at your own risk.


# Everlasting Options


# Introducing EverLasting Options

### What are Everlasting Options?

Everlasting Options are perpetual-style options that do not expire.

Unlike traditional options, which expire at a fixed time and require traders to continuously roll positions forward, Everlasting Options remain open indefinitely as long as the position holder continues paying the funding fee required to maintain the position.

In essence, Everlasting Options combine characteristics of both traditional options and perpetual derivatives:

* Similar to traditional options, they provide non-linear payoff exposure
* Similar to perpetual futures, they do not expire and rely on a funding mechanism to maintain price equilibrium over time

This design removes the need for expiry management while allowing traders to maintain long-term optionality exposure.

Everlasting Options can be viewed as a perpetualized version of traditional options, designed specifically for continuous on-chain trading.

### What Are the Problems with Traditional Options

Traditional options are difficult to implement efficiently on-chain for several reasons:

* Each expiry date fragments liquidity into separate markets
* Market makers must continuously manage inventories across strikes and expiries
* Users often need to roll positions manually after expiration
* Liquidity becomes inefficient for long-tail expiries

In traditional finance, these problems are partially mitigated by centralized market makers and institutional infrastructure. In DeFi, however, fragmented liquidity and limited market-making efficiency become major obstacles.

Everlasting Options were introduced to address these issues by creating a perpetual options market with unified liquidity and continuous trading.

### Why Everlasting Options Matter

By removing expirations and reducing liquidity fragmentation, Everlasting Options simplify on-chain options trading while improving capital efficiency and market continuity.

This allows traders to maintain long-term optionality exposure without actively managing contract rollovers.

### How Everlasting Options Work

Everlasting Options are part of Deri’s family of funding-fee-based perpetual derivatives.

Just like perpetual futures maintain their perpetual nature through funding fees, Everlasting Options also rely on a funding mechanism between longs and shorts.

The funding mechanism is generally derived from the difference between the option’s market price and its intrinsic value:

$$
Funding≈Mark−IntrinsicValue
$$

where:

* $Mark$ represents the current market price of the option
* $IntrinsicValue$ represents the option’s intrinsic value based on the underlying asset price

Under normal market conditions, long positions will generally pay funding fees to short positions in order to maintain exposure over time.

This mechanism allows the option contract to exist perpetually without requiring expiration or settlement cycles.

### Understanding the Payoff

The payoff structure of Everlasting Options is similar to traditional options.

For example:

* A long call option benefits when the underlying price rises above the strike price
* A long put option benefits when the underlying price falls below the strike price

However, unlike traditional options:

* There is no expiration date
* There is no need to roll positions
* Traders can maintain exposure continuously through the funding mechanism

This creates a more capital-efficient and user-friendly options trading experience for on-chain markets.

### Funding Fees in Everlasting Options

Funding fees are a core component of Everlasting Options.

Unlike perpetual futures, where funding fees may fluctuate between positive and negative depending on market conditions, Everlasting Options are generally designed such that long positions pay funding fees to short positions.

In real trading conditions, however, market dynamics may temporarily push funding fees below zero.

The funding mechanism serves several purposes:

* Maintains the perpetual structure
* Helps keep option pricing aligned with market demand and theoretical value
* Incentivizes balanced market participation between longs and shorts

### Capital Efficiency

One of the key advantages of Everlasting Options is capital efficiency.

Traditional DeFi options protocols often suffer from:

* fragmented liquidity
* low utilization
* limited leverage
* inefficient collateral usage

Deri’s implementation allows Everlasting Options to operate inside the unified DPMM (Deri Proactive Market Maker) framework, enabling more efficient liquidity utilization and smoother pricing.

This significantly improves the trading experience compared with many traditional on-chain option models.

### Comparison with Traditional Options

| Feature              | Traditional Options        | Everlasting Options |
| -------------------- | -------------------------- | ------------------- |
| Expiration Date      | Fixed                      | None                |
| Liquidity            | Fragmented across expiries | Unified             |
| Position Rolling     | Required                   | Not required        |
| Funding Fee          | No                         | Yes                 |
| Settlement Mechanism | Expiration-based           | Funding-based       |
| Exposure Duration    | Limited                    | Perpetual           |

### Typical Use Cases

Everlasting Options can be used for:

* Directional trading with asymmetric payoff
* Gaining exposure to market volatility
* Hedging spot or LP positions
* Maintaining long-term optionality exposure without rolling contracts

Because they are perpetual, Everlasting Options are particularly suitable for traders who want continuous options exposure without actively managing expiries.

### Everlasting Options on Deri

Deri Protocol implements Everlasting Options using its unified DPMM framework, allowing traders to access perpetual options markets directly on-chain.

Combined with cross-chain deployment, transparent on-chain execution, and capital-efficient liquidity mechanisms, Everlasting Options provide a perpetual options trading model designed for decentralized markets.

For more technical details, please refer to the Everlasting Options Whitepaper.

{% embed url="<https://github.com/deri-protocol/whitepaper/blob/master/deri_everlasting_options_whitepaper.pdf>" %}


# Numerical Examples of Everlasting Option Pricing

We have proved the following pricing formulae for everlasting options under the BSM assumptions.

Let's divide the theoretical prices of everlasting call and put options,   $$C^{ever}$$and $$P^{ever}$$, into intrinsic value and time value:

$$
\begin{align\*}\&C^{ever}=\max(S-K,0)+TimeValue\_{call}\\\&P^{ever}=\max(K-S,0)+TimeValue\_{put}\\\end{align\*}
$$

The call and put options at the same strike have the same time value

$$TimeValue\_{call}$$ = $$TimeValue\_{put}$$= $$V$$, given by

$$
V=
\begin{cases}
\frac{K}{u}\left(\frac{S}{K}\right)^{\frac{1-u}{2}}, & \text{if}\ S\geqslant K\\
\frac{K}{u}\left(\frac{S}{K}\right)^{\frac{1+u}{2}}, & \text{if}\ S\<K \\
\end{cases}
$$

Where $$u= \sqrt{1+\frac{8}{\sigma^2T}}$$.

The details of the math can be found in this [article](https://github.com/deri-finance/whitepaper/blob/master/Pricing_Continuously_Funded_Everlasting_Options.pdf). Here we provide some numerical examples. Let’s take the BTCUSD-50000-CALL with 7Day funding period as an example and assume volatility = 100%:

$$
\begin{align\*}
\&T = 7D\\
\&K = 50000\\
&\sigma=100%
\end{align\*}
$$

Then we have the key intermediate variable

$$
u=\sqrt{1+\frac{8}{100%^2\times7/365}}= 20.4485
$$

## **The out-of-money scenario**

Assuming BTCUSD = 40000, then we have intrinsic value  $$I=0$$, and time value

$$
V=\frac{50000}{20.4485}\left(\frac{40000}{50000}\right)^\frac{1+20.4485}{2}=
223.3667
$$

Therefore, the theoretical price of this 50000-Call is

$$
C=I+V=223.3667
$$

Every day, a long (short) position of 1BTC of this EO pays (receives)

$$
(C-I)/7=31.9095
$$

## The at-the-money scenario

Assuming BTCUSD = 50000, then we have intrinsic value $$I=0$$, and time value

$$
V=\frac{50000}{20.4485}\left(\frac{50000}{50000}\right)^\frac{1+20.4485}{2}=
2445.1621
$$

Therefore, the theoretical price of this 50000-Call is

$$
C=I+V=  2445.1621
$$

Every day, a long (short) position of 1BTC of this EO pays (receives)

$$
(C-I)/7=
349.3089
$$

## The In-the-money scenario

Assuming BTCUSD = 60000, then we have intrinsic value $$I=60000-50000=10000$$ , and time value

$$
V=\frac{50000}{20.4485}\left(\frac{60000}{50000}\right)^\frac{1-20.4485}{2}=
415.2673
$$

Therefore, the theoretical price of this 50000-Call is

$$
C=I+V=10415.2673
$$

Every day, a long (short) position of 1BTC of this EO pays (receives)

$$
(C-I)/7=(10415.2673-10000)/7=
59.3239
$$


# Power Perpetuals

[Introducing Power Perpetuals](/library/academy/power-perpetuals/introducing-power-perpetuals)

[Hedging Impermanent Loss with Power Perpetuals (1)](/library/academy/power-perpetuals/hedging-impermanent-loss-with-power-perpetuals-1)

[Hedging Impermanent Loss with Power Perpetuals (2)](/library/academy/power-perpetuals/hedging-impermanent-loss-with-power-perpetuals-2)


# Introducing Power Perpetuals

Power Perpetuals (Powers) were first come up with by [Dave White et al](https://www.paradigm.xyz/2021/08/power-perpetuals) in Aug 2021. Simply put, in the case of power=2, **Power Perpetuals are perpetual swaps of the square of some price, e.g. BTCUSD.** In other words, a long position in “BTCUSD powers” will have PnL along the curve of BTCUSD^2, while a short position will have the opposite of that. Due to the convexity of the square function, the fair price of a power perpetual is usually slightly higher than the square of the underlying price.

A very simple rule of thumb to remember the PnL of taking long or short positions of power perpetuals is:

* Underlying price goes up, longs make profits while shorts bear losses.
* Underlying price goes down, longs bear losses while shorts make profits.
* Underlying price stays stable, shorts earn funding fees while longs are paying them.

In Jan 2022, Opyn implemented the first power perpetuals of ETH, Squeeth. While mathematically well designed, Opyn’s Squeeth is essentially a synthetic asset (synthesizing the square of ETH price), rather than a derivative. In the Opyn framework, people mint oSQTH (a “spot” synthesizing ETH^2) against collateralized ETH, and trade it on Uniswap just like trading spots. Thanks to its sophisticated design, oSQTH should theoretically work well in terms of tracking ETH^2 (the role of a synthetic asset) but would not sufficiently serve the purposes of derivatives. Among its drawbacks, lack of leverage and hence a low capital efficiency is limiting the adoption of Squeeth as a serious derivative tool.

Boiling down to its essence, Power Perpetuals are yet another instance of the funding-fee-based perpetual derivative family, for which a long contract periodically pays a short contract funding fee as follows:

$$
Funding=Mark-I(S)
$$

where $$Mark$$ is the trading price of the derivative and $$I(S)$$ is a general intrinsic value function of the underlying price $$S$$. People can define different intrinsic value functions to get different funding-fee-based perpetual derivatives:

* $$I(S)=S$$ for perpetual futures
* $$I(S)=\max(S-K,0)$$ for everlasting calls
* &#x20;$$I(S)=\max(K-S,0)$$for everlasting puts
* $$I(S)=S^p$$ for power perpetuals of order $$p$$

The Power Perpetuals by Deri Protocol are rolled out under this framework. And here is how it works.

First of all, we specifically implemented the case of $$p=2$$, i.e. the perpetuals of BTC^2 and ETH^2. Since the square of BTC price is a huge number, we downscale it to a smaller unit - milli (prefix for 1/1000). Namely, the object being traded on Deri is **mBTC^2** and **mETH^2**, which correspond to 1/1000 of BTC^2 and ETH^2, respectively. Let’s take mBTC^2 as an example.

Assume BTCUSD =40000, and **mBTC^2** is traded at a price of 1631284 (i.e. *Mark*=1631284). \*\*\*\*People holding a long position of 1 **mBTC^2** will pay those holding a short position of 1 **mBTC^2** the following amount for every week:

$$
Funding=1631284-40000^2/1000=31284
$$

That is, a long contract pays a short contract 31284 USD per week. However, please note that the funding fee is accrued on a second basis (and settled whenever there is a trading action), so every second a long contract will accrue a funding fee of $$31285/(7*24*3600)=0.0517USD$$ to be paid, while every second a short contract will accrue 0.0517USD to be received. Please note that, even with a *milli* unit, 1 unit of mBTC^2 is still a very large contract, with mark price over 1 million USD.

Let’s take 2 scenarios to see the PnLs of the longs and the shorts upon BTC price moves.

* BTCUSD goes up to 45000, mBTC^2 goes up to **2064594** (a trading result of the market)**:** A long contract will make a profit of $$2,064,594-1,631,284=433,310$$. Accordingly, a short contract will bear a loss of the same amount.
* BTCUSD goes down to 35000, mBTC^2 goes down to **1248953** (a trading result of the market)**:** A long contract will make a loss of $$1,248,952-1,631,284=-382,331$$. Accordingly, a short contract will make a profit of **382331**.

As you can see from the example above, for a long position, the up-side profit and the down-side loss are asymmetric. That is, the long (short) positions have an advantage (disadvantage) in terms of PnL. That is why the long positions need to pay the short positions a funding fee — to compensate for such an advantage. Such an asymmetric bet is the point to trade Powers:

> The longs are paying a funding fee to gain an asymmetric advantage: to boost their up-side profit and mitigate their down-side loss. Whereas, the shorts are offering that advantage to the longs by charging them the funding fee as a yield.

Execution-wise, we set up the powers largely similar to the futures. Namely, one trades mBTC^2 similar to how he/she trades the BTCUSD futures. You just need to choose the long or short side and specify the volume to trade. Please note that under normal circumstances the longs always pay the funding fee and the shorts always receive the funding fee.

### The Greeks of Powers

This section is for advanced traders who are familiar with the Greeks of derivatives and are interested in learning the powers from this perspective. A detailed discussion of the mathematics of the Powers can be found in this [paper](https://github.com/deri-finance/whitepaper/blob/master/Pricing_Continuously_Funded_Power_Perpetuals.pdf). However, you don’t have to understand this section to trade powers.

The Delta and the Gamma of the powers are as follows:

$$
\Delta = \frac{\partial P}{\partial S}= \frac{pS^{p-1}}{1-hT}=\frac{pP}{S}\\
\Gamma = \frac{\partial^2 P}{\partial S^2}= \frac{p(p-1)S^{p-2}}{1-hT}=\frac{p(p-1)P}{S^2}
$$

where

* *P:* the price of the power
* *S*: the price of the underlying
* *T:* the funding period. *T*=1week in our implementation.
* $$h=r+\sigma^2/2$$, with *r* the risk-free interest rate and $$\sigma$$ the volatility

Specifically, for the case $$p=2$$, we have

$$
\Gamma =\frac{2}{1-hT} = \frac{2}{1-(r+\frac{\sigma^2}{2})T}
$$

Please note that in the square case $$p=2$$, the Gamma of powers has a very special and important property: independent of the underlying price.

This property of the powers lead it to a very important use case: **hedging the impermanent loss of Constant-Product Marketing Making**, e.g. Uniswap and Pancake. We will explain the mechanism in [this](/library/academy/power-perpetuals/hedging-impermanent-loss-with-power-perpetuals-1) article.


# Hedging Impermanent Loss with Power Perpetuals (1)

This article is for hedging impermanent loss for Uniswap-V2-style CPMM. For Uniswap V3, please refer to "[Hedging Impermanent Loss with Power Perpetuals (2)](/library/academy/power-perpetuals/hedging-impermanent-loss-with-power-perpetuals-2)"

As explained in the [introduction paper](https://deri-protocol.medium.com/introducing-power-perpetuals-2b052f655224), Power Perpetuals have a very special and important property: its Gamma is independent of the underlying prices:

$$
\Gamma =\frac{2}{1-hT} = \frac{2}{1-(r+\frac{\sigma^2}{2})T}
$$

where

* *T:* the funding period. *T*=1week in our implementation.
* $$h=r+\sigma^2/2$$
* *r:* the risk-free interest rate
* $$\sigma$$: the volatility

In the DeFi world, it is usually safe to assume $$r=0$$. And since volatility is relatively stable for most of the time, the Gamma stays a constant for most of the time. Having an (almost) constant Gamma leads to a few handy use-cases. This article will explain how to hedge the impermanent loss of providing liquidity to CPMM (constant-product marking making) such as Uniswap or Pancakeswap.

## Impermanent Loss from the Greeks Perspective

Ever since the launch of Uniswap, there have been tons of materials discussing the impermanent loss (IL) issue of CPMM. We are not repeating the discussions here but just would like to point out that the difficulty of hedging the IL is the gamma part of the liquidity providers’ positions. Let’s take the ETH-USDC pair as an example. Let’s assume you provide $$x\_0$$ ETH and  $$y\_0$$ USDC to the CPMM when ETHUSDC=S=4000, e.g. $$x\_0=1, y\_0=4000$$. When the price of ETH $$S$$ changes, you would have $$x$$ ETH and $$y$$ USDC with $$x\cdot y=x\_0\cdot y\_0=K=4000$$. It’s easy to see $$x$$and $$y$$ are functions of the ETH price $$S$$

$$
x=\sqrt{\frac{K}{S}}\ y=\sqrt{KS}
$$

The value of your provided liquidity (or the value of your LP tokens) is:

$$
V=xS+y=2\sqrt{SK}
$$

Therefore, we have the Delta and the Gamma of your LP tokens as follows:

$$
\Delta = \frac{\partial V}{\partial S}=\sqrt{\frac{K}{S}}\\
\Gamma = \frac{\partial \Delta}{\partial S}=-\frac{\sqrt K}{2S^{\frac{3}{2}}}
$$

From the Greeks’ perspective, it is the Gamma part that complicates the impermanent loss. If we hedge IL with a linear derivative such as futures, we would need to rebalance the hedging position quite frequently to adapt to the rapidly changing Delta. Such a process is called dynamic Delta hedging (DDH), causing a substantial cost. A better solution would be to adopt a Gamma tool to hedge the Gamma part specifically. And Power Perps is a perfect Gamma tool for this purpose thanks to its (almost) constant Gamma.

## Hedging IL with Powers and Futures

Let’s still assume the initial liquidity you provide to a CPMM (Uniswap or Pancake) is ($$x\_0$$ ETH, $$y\_0$$ USDC ): $$x\_0=1, y\_0=4000$$. To hedge the Gamma, you would need $$w$$ units of ETH^2 to make the portfolio Gamma-neutral:

$$
w\cdot\frac{2}{1-hT}-\frac{\sqrt{K}}{2S^\frac{3}{2}}=0\\
w = \frac{(1-hT)\sqrt{K}}{4S^\frac{3}{2}}
$$

And then you would need to take $$z$$ units of ETHUSD futures to make the portfolio Delta-neutral:

$$
z+\sqrt{\frac{K}{S}}+w\cdot\frac{2S}{1-hT}=0\\

z=-\frac{3}{2}\sqrt{\frac{K}{S}}
$$

In other words, you need to short $$\frac{3}{2}\sqrt{\frac{K}{S}}$$ units of ETHUSD futures.

As a static hedge that fixes the hedging positions at the entry point, where $$S=S\_0=K$$, we have:

$$
w = \frac{(1-hT)}{4S\_0},\\
z=-\frac{3}{2}
$$

To summarize, the following portfolio has 0 Delta and 0 Gamma at the point of $$(x\_0=1, y\_0=4000)$$:

* Providing 1ETH+4000USDC to the ETH-USDT pair
* Long $$\frac{(1-hT)}{4S\_0}$$units of ETH^2
* Short $$\frac{3}{2}$$ units of ETHUSD futures

Numerically, at the point of $$(x\_0=1, y\_0=4000)$$, assuming volatility $$\sigma=100%$$, this means:

* Providing 1ETH+4000USDC to the ETH-USDC pair
* Long 0.0000613 units of ETH^2 (equals to 0.0613 units of mETH^2 on [Deri Protocol](https://deri.io))
* Short 1.5 units of ETHUSD futures

Please note this only ensures the portfolio has 0 Delta and 0 Gamma at the current point. Nevertheless, a portfolio with 0 Delta and 0 Gamma at $$(x\_0, y\_0)$$ would have its value stable in a very wide range of price around $$(x\_0, y\_0)$$. The figure below illustrates the PnL of the portfolio with respect to ETH price change. Please note the red curve (portfolio value) stays flat in a very wide range.

![](/files/i8zbEiBxh4DN8LrTPuyL)

Note 1: Depending on how strictly flat you would like to keep the portfolio value, you can choose your price range to leave the portfolio unchanged. For example, for not-so-strict use cases, you can choose the range to be (2000, 6000) and only rebalance the portfolio when ETH price moves out of this range. For more demanding use cases, you can narrow the range to (3000, 5000). However, please note that the more strict requirement you put, the more frequently you would need to rebalance the portfolio.

Note 2: the portfolio above was constructed to keep the dollar value of your LP pair to stay constant (4000U + 4000U = 8000U). However, if you want to keep the value at par with (4000U + 1ETH) (i.e. you want to keep your risk exposure of 1ETH), then you just need to hedge less Delta. That is, instead of short 3/2 units of ETHUSD futures, you just need to short 1/2 units (just to hedge the Detal of the power perps).

## Cost vs Income

Constructing the portfolio above comes at a cost. Usually, both the futures and powers positions would incur funding fees. However, the expectation of the futures funding fee is 0. Therefore, we only consider the funding fee of the powers. Per [the pricing of powers](https://github.com/deri-finance/whitepaper/blob/master/Pricing_Continuously_Funded_Power_Perpetuals.pdf), the theoretical funding fee of 1 unit of powers for one funding period is:

$$
F=P-S^2 = S^2\frac{hT}{1-hT}
$$

This leads to an annualized cost in terms of a ratio of the LP value:

$$
\frac{w\cdot F/(T/1year)}{2S}=\frac{h}{8} \left(\frac{S}{S\_0}\right)^2
\=\frac{\sigma^2}{16} \left(\frac{S}{S\_0}\right)^2
$$

Let’s put this annualized cost into numerical scenarios:

<table><thead><tr><th width="200"></th><th>ETH Price</th><th> </th><th> </th><th>  </th><th> </th></tr></thead><tbody><tr><td>Volatility</td><td>-20%<br>3200</td><td>-10%<br>3600</td><td>0%<br>4000</td><td>+10%<br>4400</td><td>+20%<br>4800</td></tr><tr><td>75%</td><td>2.25%</td><td>2.85%</td><td>3.52%</td><td>4.25%</td><td>5.06%</td></tr><tr><td>100%</td><td>4.00%</td><td>5.06%</td><td>6.25%</td><td>7.56%</td><td>9.00%</td></tr><tr><td>125%</td><td>6.25%</td><td>7.91%</td><td>9.77%</td><td>11.82%</td><td>14.06%</td></tr><tr><td>150%</td><td>9.00%</td><td>11.39%</td><td>14.06%</td><td>17.02%</td><td>20.25%</td></tr></tbody></table>

Now this business turns into a very simple math problem: **would the income of liquidity-providing cover the cost of hedging?**

**As long as the income from liquidity-providing is greater than the cost, the portfolio is making profits.**

The income of liquidity providing depends on the transaction volume of the CPMM. On [Uniswap](https://info.uniswap.org/#/), as of today, the annualized income ratio for the ETH-USDC pair is:

$$
\frac{532.68m\cdot0.3%/7\*365}{380.04m}=21.93%
$$

![(Data source:https://info.uniswap.org/, as of 2022-3-10)](/files/RtCKHdy8DYGJNtstH0Ns)

So the short answer to the question: it’s profitable indeed. As of the last 7 days, this income ratio beats even the most costly scenario in the table above.

Please note the trading volume of last 7 days has been at a relatively low level. For most of the time, the trading volume has been higher than the current level.

![(Data source:https://info.uniswap.org/, as of 2022-3-10)](/files/wExEMx0d3HnVGdpBTFRy)

## Other Examples

#### WBTC-USDC @Uniswap

Now let’s look at the case of providing liquidity to the WBTC-USDC pair, it is easy to have a similar numerical analysis. Assuming the entry point of liquidity providing is BTCUSD = 40000, we have the following annualized cost ratio in different scenarios:

<table><thead><tr><th width="200"></th><th>BTC Price</th><th> </th><th> </th><th>  </th><th> </th></tr></thead><tbody><tr><td>Volatility</td><td>-20%<br>32000</td><td>-10%<br>36000</td><td>0%<br>40000</td><td>+10%<br>44000</td><td>+20%<br>48000</td></tr><tr><td>75%</td><td>2.25%</td><td>2.85%</td><td>3.52%</td><td>4.25%</td><td>5.06%</td></tr><tr><td>100%</td><td>4.00%</td><td>5.06%</td><td>6.25%</td><td>7.56%</td><td>9.00%</td></tr><tr><td>125%</td><td>6.25%</td><td>7.91%</td><td>9.77%</td><td>11.82%</td><td>14.06%</td></tr><tr><td>150%</td><td>9.00%</td><td>11.39%</td><td>14.06%</td><td>17.02%</td><td>20.25%</td></tr></tbody></table>

As of last 7 days, the annualized income ratio is:

$$
\frac{248.16m\cdot0.3%/7\*365}{114.85m}=33.80%
$$

![(Data source:https://info.uniswap.org/, as of 2022-3-10)](/files/XRxmfQbHhHmBL9dfrXDg)

#### WBNB-BUSD, BTCB-BUSD @Pancakeswap

Now let’s look at 2 sample pairs from another CPMM, [Pancakeswap](https://pancakeswap.finance/info): WBNB-BUSD and BTCB-BUSD. For the most active trading pair WBNB-BUSD, assuming the entry point of liquidity providing is BNBUSD = 400, then we have the following annualized cost ratio in different scenarios:

<table><thead><tr><th width="200"></th><th>BNB Price</th><th> </th><th> </th><th>  </th><th> </th></tr></thead><tbody><tr><td>Volatility</td><td>-20%<br>320</td><td>-10%<br>360</td><td>0%<br>400</td><td>+10%<br>440</td><td>+20%<br>480</td></tr><tr><td>75%</td><td>2.25%</td><td>2.85%</td><td>3.52%</td><td>4.25%</td><td>5.06%</td></tr><tr><td>100%</td><td>4.00%</td><td>5.06%</td><td>6.25%</td><td>7.56%</td><td>9.00%</td></tr><tr><td>125%</td><td>6.25%</td><td>7.91%</td><td>9.77%</td><td>11.82%</td><td>14.06%</td></tr><tr><td>150%</td><td>9.00%</td><td>11.39%</td><td>14.06%</td><td>17.02%</td><td>20.25%</td></tr></tbody></table>

As of last 7 days, the annualized income ratio is 16.35%, still profitable for most of the scenarios.

$$
\frac{427.24m\cdot0.25%/7\*365}{340.59m}=16.35%
$$

![(Data source:https://pancakeswap.finance/info, as of 2022-3-10)](/files/DcKf5bN6h1nrfiUP8MSW)

As for the BTCB-BUSD pair, as of last 7 days, the annualized income ratio is:

$$
\frac{45.76m\cdot0.25%/7\*365}{64.39m}=9.30%
$$

This income is profitable at the current market condition (volatility \~ 80%), but would become unprofitable for some of the worse scenarios (e.g. volatility turns into 150%). So liquidity providers adopting this strategy would need to keep a closer watch on the market condition change for providing liquidity to the BTCB-BUSD pair on Pancakeswap.

Note 1: The extra CAKE reward by Pancakeswap has not been taken into account in this analysis.

Note 2: In practice, the transaction volume on CPMM and the volatility are positively correlated. In a more volatile market condition, even though you are paying a higher funding fee for the powers, most likely you would also earn more income from the CPMM due to a higher trading volume. In other words, the strategy would still very likely be profitable in such scenarios.


# Hedging Impermanent Loss with Power Perpetuals (2)

In the first [article](/library/academy/power-perpetuals/hedging-impermanent-loss-with-power-perpetuals-1) of this series, we explained how to hedge the impermanent loss of CFMM (of Uniswap V2 style) by power perpetuals. The idea is to hedge the Delta and Gamma to zero at the entry point (the price at which an LP deposits liquidity) so that the LP portfolio value stays flat in a reasonably wide range around the entry point. The algorithm was based on calculating the Delta and Gamma of an LP position of Uniswap-V2-style CFMM. Since the function in the CFMM of Uniswap V3 is different from that of V2, the hedging would be a bit different too. This article explains how to hedge the impermanent loss of LP position in Uniswap V3 by power perpetuals. We will skip the basic concepts (for which you can the details in the previous article) and directly start with Uniswap’s different Greek letters.

## Greek Letters of Uniswap V3

Let’s still take the ETH-USDC pair as an example: provide $$x\_0$$ETH and $$y\_0$$ SDC to Uniswap V3 when ETHUSDC= $$p\_0$$ with the range specified as $$(p\_a,p\_b)$$When the price of ETH $$P$$ changes within the range, you would have $$x$$ ETH and $$y$$ USDC following the [formula](https://uniswap.org/whitepaper-v3.pdf):

$$
\left(x+\frac{L}{\sqrt{p\_b}}\right)\left(y+L\sqrt{p\_a}\right)=L^2
$$

Just like in Uniswap V2, $$x$$ and $$y$$ are functions of the ETH price $$p$$ (in this article we follow the denotation of [Uniswap V3 whitepaper](https://uniswap.org/whitepaper-v3.pdf) to use $$p$$ in place of $$S$$ and $$L^2=K$$:

$$
x=L\left(\frac{1}{\sqrt p}-\frac{1}{\sqrt p\_b}\right)\\
y=L\left(\sqrt p-\sqrt p\_a\right)
$$

The value of your LP position is as follows, for $$p\in(a,b)$$:

$$
V=xp+y=L\left(2\sqrt p-\frac{p}{\sqrt p\_b}-\sqrt p\_a\right)
$$

Therefore, we have Delta and the Gamma of your LP tokens as follows:

$$
\Delta = \frac{\partial V}{\partial p}=L\left(\frac{1}{\sqrt p}-\frac{1}{\sqrt p\_b}\right)\\
\Gamma = \frac{\partial \Delta}{\partial p}=-\frac{L}{2p^{\frac{3}{2}}}
$$

Noticing $$L^2$$ is corresponding to $$K$$, we can see that LP position in Uniswap V3 has a smaller Delta than V2 (with an extra $$\frac{L}{\sqrt p\_b}$$term), but exactly the same Gamma. Therefore, only some small changes are needed to make the LP position Delta-neutral and Gamma-neutral.

## Hedging IL with Powers and Futures

Assume you need $$w$$ units of ETH^2 to make the portfolio Gamma-neutral:

$$
w\cdot\frac{2}{1-hT}-\frac{L}{2p^\frac{3}{2}}=0\\
$$

$$
w = \frac{(1-hT)L}{4p^\frac{3}{2}}
$$

And then you would need to take $$z$$ units of ETHUSD futures to make the portfolio Delta-neutral:

$$
z+L\left(\frac{1}{\sqrt p}-\frac{1}{\sqrt p\_b}\right)+w\cdot\frac{2S}{1-hT}=0\\
$$

$$
z=-\frac{3}{2}\frac{L}{\sqrt p}+\frac{L}{\sqrt p\_b}
$$

​In other words, you need to short $$L\left(\frac{3}{2\sqrt p}-\frac{1}{\sqrt p\_b}\right)$$ units of ETHUSD futures.

In practice, as a static hedge entered at $$p=p\_0$$, we just need to fix $$w$$ and $$z$$ with the value at this point.

To summarize, the following portfolio has 0 Delta and 0 Gamma at the entry point $$(x\_0, y\_0)$$ of the range order:

* Providing $$x\_0$$ ETH+$$y\_0$$ USDC to the ETH-USDT pair
* Long $$\frac{(1-hT)}{4p\_0^\frac{3}{2}}L$$ units of ETH^2 power perps
* Short $$\left(\frac{3}{2\sqrt p\_0}-\frac{1}{\sqrt p\_b}\right)L$$ units of ETHUSD futures

Please note that the $$L$$ is the measure of the liquidity density provided by this range order and is determined by $$(p\_0, p\_a, p\_b)$$. Given the amount of provided liquidity (given $$x\_0$$ and $$y\_0$$), the narrower the range is (the smaller $$(p\_b-p\_a)$$ is), the bigger $$L$$ would be (meaning the liquidity is more concentrated). $$L$$ can be calculated by solving the pricing formula, which leads to:

$$
L=\frac{\left(\frac{y}{\sqrt p\_b}+x\sqrt p\_a\right)+\sqrt{\left(\frac{y}{\sqrt p\_b}+x\sqrt p\_a\right)^2+4\left(1-\sqrt\frac{p\_a}{p\_b}\right)xy}}{2\left(1-\sqrt\frac{p\_a}{p\_b}\right)}
$$

For Uniswap V3, LP does not have to provide liquidity symmetrically (i.e., $$x\_0p\_0=y\_0$$). However, if we do follow this V2-tradition, then for 1 unit of ETH-USDC pair (i.e., 1ETH + $$p\_0$$USDC), we have

$$
\frac{L}{\sqrt p\_0}\triangleq R=\frac{\left(\sqrt \frac{p\_a}{p\_0}+\sqrt \frac{p\_0}{p\_b}\right)+\sqrt{\left(\sqrt \frac{p\_a}{p\_0}+\sqrt \frac{p\_0}{p\_b}\right)^2+4\left(1-\sqrt\frac{p\_a}{p\_b}\right)}}{2\left(1-\sqrt\frac{p\_a}{p\_b}\right)}
$$

Then we can rewrite the hedged portfolio as:

* Providing 1 unit (i.e., 1ETH+$$p\_0$$USDC) to the ETH-USDT pair
* Long $$\frac{(1-hT)R}{4p\_0}$$ units of ETH^2 power perps
* Short $$\left(\frac{3}{2}-\sqrt\frac{p\_0}{p\_b}\right)R$$ units of ETHUSD futures

## Numerical Analysis

Assume you provide one unit of ETH-USDC pair to Uniswap V3 when ETHUSDC=2000, *i.e.*, $$x\_0=1, y\_0=2000$$, with the range specified as $$p\_a=1800, p\_b=2200$$. With the formula above we have $$R=20.4374$$. Assuming volatility $$\sigma=100%$$ , we can calculate the values of the portfolio:

* Providing 1ETH+2000USDC to the ETH-USDC pair
* Long 0.00253 units of ETH^2 (equals to 2.53 units of mETH^2 on [Deri Protocol](https://deri.io/))
* Short $$\left(\frac{3}{2}-\sqrt\frac{2000}{2200}\right)\*20.4374=10.9646$$ units of ETHUSD futures

## Cost vs Income

Constructing the portfolio above comes at a cost. Usually, both the futures and powers positions would incur funding fees. However, the expectation of the futures funding fee is 0. Therefore, we only consider the funding fee of the powers. Per [the pricing of powers](https://github.com/deri-finance/whitepaper/blob/master/Pricing_Continuously_Funded_Power_Perpetuals.pdf), the theoretical funding fee of 1 unit of powers for one funding period is:

$$
F=P\_{power}-p^2 = p^2\frac{hT}{1-hT}
$$

This leads to an annualized cost in terms of a ratio of the LP value:

$$
C=\frac{w\cdot F}{2p\_0T}=\frac{hp^2R}{8p\_0^2}=\frac{R}{16}\cdot\sigma^2\cdot\left(\frac{p}{p\_0}\right)^2
$$

Let’s put this annualized cost into numerical scenarios:

<figure><img src="/files/PfcCtFXGuF6dW0wDmZPz" alt=""><figcaption></figcaption></figure>

Every second, the cost $$C$$ accumulates at the speed proportional to $$\sigma^2$$. To figure out the average cost, we need to estimate the average $$\sigma^2$$. Statistics show that, for the last 12 months, $$\bar{\sigma^2}\approx (97%)^2$$ for ETH. In the table above, we also show how the annualized cost varies when $$\bar{\sigma^2}\approx (97%)^2$$.

Please note the table above applies for BTC too. Statistics show that, for the last 12 months, $$\bar{\sigma^2}\approx (82%)^2$$ for BTC. We also list the corresponding cost ratio in the table.

**Extra Capital for the Derivative Margin**

The futures and powers positions require extra capital to be held as margin.

The power position needs:

$$
M\_{power}=wP\_{power}r\_{IM.power}=\frac{1}{4}Rp\_0r\_{IM.power}
$$

Currently, Deri required 16% as initial margin for powers on BSC and 8% on Arbitrum, which correspond to **1635U** on BSC and **817U** on Arbitrum respectively.

Similarly the futures position needs:

$$
M\_{futures}=\left(\frac{3}{2}-\sqrt\frac{p\_0}{p\_b}\right)Rp\_0 r\_{IM.futures}
$$

Currently, Deri required 8% as initial margin for futures on BSC and 4% on Arbitrum, which correspond to **1754 U** on BSC and **877 U** on Arbitrum respectively.

Therefore, the total required margin would be **3389 U on BSC** and **1678 U on Arbitrum**. Please note that this initial margin is sufficient to cover the price change of +/-10%, so you don’t need to worry about liquidation.


# Gamma Swap


# Introducing Gamma Swap

## Introduction

This paper introduces a new type of derivative, **Gamma Swap**, inspired by [Power Perpetuals](https://www.paradigm.xyz/2021/08/power-perpetuals). It is for the buyers (taking the long side) to gain the Gamma exposure of some underlying asset and the sellers (taking the short side) to earn the funding fees by providing that exposure.

We want to define the Gamma Swap of some underlying asset $$X$$for the long and short sides to have the following PnL, respectively:

* A long position pays the funding fee and has the $$PnL\propto(x-x\_0)^2$$  , where $$x\_0$$ is the entry price of the position;
* A short position collects the funding fee and has the $$PnL\propto-(x-x\_0)^2$$ , where $$x\_0$$  is the entry price of the position;

Mathematically, we can split $$(x-x\_0)^2$$  into the following two parts, which can be tracked by long Power Perps and short Perpetual Futures, respectively.

$$
(x-x\_0)^2=\[x^2-x\_0^2]-\[2x\_0(x-x\_0)]
$$

Due to the Gamma premium, [the theoretical price](https://github.com/deri-protocol/whitepaper/blob/master/Pricing_Continuously_Funded_Power_Perpetuals.pdf) of 1 unit of power perp is $$\frac{x^2}{1-hT}$$ , where $$T$$  is the funding period and $$h=r+\sigma^2$$  ($$r$$ is the risk-free interest rate and $$\sigma$$  is the volatility). Therefore, we define Gamma Swap as follows:

$$
1\text{GammaSwap}=1\text{PowerPerp}-\frac{2x\_0}{1-h\_0T}\text{PerpFutures}
$$

&#x20;where $$h\_0$$ is the value of $$h$$ at the entry point. That is, we define 1 unit of Gamma Swap has the PnL equivalent to the portfolio of long 1 Power Perp and short $$\frac{2x\_0}{1-h\_0T}$$  Perpetual Futures. Per this definition, Gamma swap has the following theoretical value:

$$
P\_{gamma}=\frac{1}{1-hT}(x^2-x\_0^2)-\frac{2x\_0}{1-h\_0T}(x-x\_0)
$$

When volatility stays still at $$h=h\_0$$  , we have:

$$
P\_{gamma}=\frac{1}{1-hT}(x-x\_0)^2
$$

which gives exactly the PnL that we want in our motivation. Now we have successfully structured a new derivative, Gamma Swap, to provide the wanted risk exposure.

#### Derivative v.s. Portfolio

However, the equivalency brings us to the question: why do we need such a new derivative instead of simply holding a portfolio of futures and powers? This is because the latter has the following two disadvantages:

* At the entry point, a unit of Gamma Swap has zero Delta, while the perp component and the power component have the exact opposite non-zero Delta. To long 1 power and short  $$\frac{2x\_0}{1-h\_0T}$$  perps separately, one needs to post margin for the power component (mostly for its positive Delta) as well as for the perp component (for its negative Delta), respectively. These two parts of margin are purely a waste of capital since the two corresponding parts of Delta are not wanted and canceled out.
* To construct such a portfolio, for the unwanted positive Delta and negative Delta, one is paying extra transaction fees and trading costs (slippage, funding fees, etc.).

Put simply, to obtain pure Gamma exposure by holding a portfolio of powers and perps, one has to allocate extra capital for margin as well as pay extra costs for 0 Delta. And Gamma Swap is introduced **to directly provide the Gamma exposure without such wastes.**

#### Trade with specified entry price

By default, a Gamma swap is traded with the current price as the entry price. However, one can also enter a Gamma swap position specifying the entry price $$x\_s$$ to gain the Gamma exposure around the specified point, i.e. to have $$Pnl\propto(x-x\_s)^2$$ . A Gamma swap traded with a specified entry price is treated per the following definition:

$$
1\text{GammaSwap}(x\_s)=1\text{PowerPerp}-\frac{2x\_s}{1-h\_0T}\text{PerpFutures}
$$

## Mark Price and Funding

To trade Gamma swap, we need a composite trading venue that contains two (virtual) primitive trading venues for power perps and perpetual futures, respectively. This paper only introduces the concept of Gamma swap and the implementation of the composite trading venue will be discussed in a subsequent paper. Here we just assume we already have such a composite trading venue that has real-time Mark prices for the (virtual) power perps and perpetual futures, denoted as $$M\_{power}$$  and $$M\_{perp}$$  respectively.

Hereafter, we use $$i$$ to represent the index price of the underlying, which is different from the general term of price $$x$$  in the previous conceptual discussion. Just as how perpetual futures and power perps are traded (with orderbook or AMM), the index price $$i$$  is an external input to the trading venue. With the composite trading venue giving $$M\_{power}$$  and $$M\_{perp}$$ , it is straightforward to define the mark price of Gamma swap as follows:

$$
M\_{gamma}=M\_{power}-\frac{2i\_0}{1-h\_0T}M\_{perp}+\frac{i\_0^2}{1-h\_0T}
$$

where $$i\_0$$  is the entry price (or the specified entry price). Note the third item on RHS is a constant to make the expression financially meaningful.

With such a set-up, Gamma swap does not have a simple mark-price-based funding mechanism (like power perp’s). Instead, we define that the Gamma swap has composite funding consisting of power funding and perp funding:

$$
F\_{gamma}=F\_{power}+\left(\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\right)F\_{perp}
$$

where$$(i\_0,h\_0)$$    are the $$(i,h)$$   as of the position entry point, and

$$
\begin{align\*}
F\_{power}=&\frac{M\_{power}-i^2}{T}\\
F\_{perp}=&\frac{M\_{perp}-i}{T}
\end{align\*}
$$

Notice that the coefficient of $$F\_{perp}$$  is a bit complicated, constantly varying with $$i$$ . Essentially, this can be understood as every unit of Gamma swap has $$-\frac{2i\_0}{1-h\_0T}$$  “real futures” as well as $$\frac{2i}{1-hT}$$  “virtual futures”, and hence totally $$\left(\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\right)$$  effective futures.

## The Greeks

The Greeks are the motivation to design Gamma Swap. We look into them in this section. To avoid confusion, in this paper the word “gamma” refers to the derivative Gamma swap, while the Greek letter $$\Gamma$$  refers to [the Greek](https://en.wikipedia.org/wiki/Greeks_\(finance\)).

Since$$1\text{GammaSwap}=1\text{PowerPerp}-\frac{2x\_0}{1-h\_0T}\text{PerpFutures}$$ , we have:

$$
\begin{align\*}
\Delta\_{gamma}&=\Delta\_{power}-\frac{2x\_0}{1-h\_0T}\Delta\_{perp}\\

&=\frac{2x}{1-hT}-\frac{2x\_0}{1-h\_0T}
\end{align\*}
$$

Especially, at the entry point, we have $$\Delta\_{gamma}=0$$ . This is exactly what we want from the Gamma swap: pure $$\Gamma$$  without $$\Delta$$ .

However, when the price changes while $$h$$  stays still $$(h=h\_0)$$ , we have:

$$
\begin{align\*}
\Delta\_{gamma}=\frac{2}{1-h\_0T}(x-x\_0)
\end{align\*}
$$

That is, when  $$x$$ drifts away from  $$x\_0$$, the Gamma swap will linearly build a non-zero $$\Delta$$ proportional to $$(x-x\_0)$$. This is the $$\Delta$$  “built” by the $$\Gamma$$  , which is the micro-process of how the Gamma swap works. Note that $$\Gamma$$   is the second-order differential, which would only affect PnL by its integral, i.e., the first-order differential, $$\Delta$$ .

Please note that a Gamma swap traded with a specified entry price $$x\_s$$  has a non-zero $$\Delta$$  at the beginning:

$$
\begin{align\*}
\Delta\_{gamma}(ent.price=x\_s)=\frac{2}{1-hT}(x\_0-x\_s)
\end{align\*}
$$

So, if wanting to obtain $$\Gamma$$ together with a non-zero $$\Delta$$, one can trade Gamma swap with a properly specified entry price.

The $$\Gamma$$ of Gamma swap is as follows:

$$
\begin{align\*}
\Gamma\_{gamma}&=\Gamma\_{power}-\frac{2i\_0}{1-h\_0T}\Gamma\_{perp}\\
&=\frac{2}{1-hT}
\end{align\*}
$$

which is a constant as long as volatility stays still. This is also what we want from the Gamma swap: almost constant $$\Gamma$$ .

#### The effects of varying volatility

The previous analyses assume volatility stays unchanged. So how would varying volatility affect Gamma swaps? It’s easy to see that a Gamma swap has the same Vega as power’s. So we only look into how volatility affects $$\Delta\_{gamma}$$  and $$\Gamma\_{gamma}$$ .

$$
\frac{\partial \Delta\_{gamma}}{\partial \sigma}=\frac{2xT}{(1-hT)^2}\frac{\partial h}{\partial \sigma}=\frac{4xT\sigma}{(1-hT)^2}
$$

A small change in volatility, $$\delta\sigma$$ , would cause:

$$
\delta\Delta\_{gamma}=\frac{\delta\sigma}{\sigma}\cdot\frac{4xT\sigma^2}{(1-ht)^2}\approx \frac{\delta\sigma}{\sigma}4T\sigma^2x
$$

For small $$T$$, e.g. 1 day or 1 week, this is usually a negligible amount.

Similarly, we have:

$$
\frac{\partial \Gamma\_{gamma}}{\partial \sigma}=\frac{4\sigma T}{(1-hT)^2}
$$

$$
\frac{\delta\Gamma\_{gamma}}{\Gamma\_{gamma}}=\frac{\delta\sigma}{\sigma}\cdot\frac{2\sigma^2 T}{1-hT}
$$

which is around 4% of $$(\delta\sigma/\sigma)$$  for $$T=1\text{week}$$ , or around 0.5% for $$T=1\text{day}$$ .

Therefore, we can conclude that varying volatility does not substantially affect the constancy of a Gamma swap’s $$\Gamma$$ , which is a very important feature for the use cases.

In summary, the analysis of the Greeks shows Gamma swap gives exactly what we want: **(almost) constant and pure** $$\Gamma$$ **without** $$\Delta$$ **.**

## Margin

One possible margin solution for Gamma swap could be the “Greek-based margin”. That is, with $$\Delta\_{gamma}$$  and $$\Gamma\_{gamma}$$ , we can estimate the change of the Gamma swap value due to the underlying price change from $$x$$  to $$x+\delta x$$ , with a second-order Taylor expansion:

$$
\delta P\_{gamma}\approx\Delta\_{gamma}\delta x+\frac{1}{2}\Gamma\_{gamma}\delta x^2
$$

And the margin system works as follows: the trader is required to post as collateral the possible loss associated with a specific risk scenario, e.g. $$\delta x/x =\pm5%$$ .

## Summary

This paper introduces a new type of derivative, **Gamma Swap**, to efficiently and directly provide almost constant and pure Gamma exposure for traders. However, as a composite derivative, it depends on a composite trading venue to facilitate the trading. We will discuss such a composite trading venue in a subsequent paper.

Application-wise, since Gamma is one of the most primitive elements in the financial world (probably only second to Delta), there would be many potential use cases of Gamma swap. In fact, it would be the go-to solution whenever pure Gamma is needed. We will discuss the applications of Gamma swap in subsequent papers.

Discussions are welcome. You can send emails to <0xAlpha@dfactory.tech>, or DM [0xAlpha](https://twitter.com/0x_Alpha) on Twitter.


# Gamma Swap by Deri Protocol

## Introduction

In [the previous paper](/library/academy/gamma-swap/introducing-gamma-swap), we introduced a new type of derivative, Gamma Swap. As discussed, the trading of Gamma swap depends on a composite trading venue consisting of two (virtual) primitive trading venues for power perps and perpetual futures. This paper explains the implementation of such a composite trading venue by the [DPMM of Deri Protocol](https://github.com/deri-protocol/whitepaper/blob/master/deri_v3_whitepaper.pdf).

## Composite DPMM of Gamma Swap

Following the terminology in the previous paper, in this paper, $$i$$  refers to the index price while $$M$$  refers to the different kinds of mark prices. **The core role of DPMM is to determine the mark prices based on the index price input and the trading activities.** Everything else (e.g., PnL, funding fees) is then based on the mark prices.

Internally, 1 unit of Gamma swap is treated as a portfolio of powers and perps. DPMM simultaneously keeps track of the power and perp positions and calculates their respective mark prices. When 1 unit of long Gamma swap is entered, the DPMM adds 1 unit of power and $$-\frac{2i\_0}{1-h\_0T}$$  units of perp to the two positions, respectively. One could also enter a Gamma swap position with a specified entry price $$i\_s$$ . In that case, DPMM would add 1 unit of power and $$-\frac{2i\_s}{1-h\_0T}$$  units of perp to the two positions, respectively. Denote the total net position of power as $$n$$  and total net position of perp as $$m$$ , then DPMM calculates the mark price of perp as follows:

$$
\frac{M\_{perp}-i}{i}=k\_{perp}\left(n\cdot\frac{2i}{1-hT}+m\right)=k\_{perp}m'
$$

where $$i$$ is the index price of the underlying, and $$m'=n\cdot\frac{2i}{1-hT}+m$$. Please note that:

* This is just the classical DPMM for perp with $$m'=\left(n\cdot\frac{2i}{1-hT}+m\right)$$  as the total net position, instead of just $$m$$.
* Notice that $$m'=0$$   at a “balanced point”, at which the liquidity pool has no Delta exposure. For example, immediately after the first position was opened, we have $$n =1$$   and $$m=-\frac{2i\_0}{1-h\_0T}$$  , hence $$m'=0$$ . A “balanced point” is equivalent to the scenario of zero net position in a regular DPMM of perp.
* A trading action reducing $$|m'|$$ (and thus bringing the system to the “balanced point”) enjoys a negative slippage of $$M\_{perp}$$  . However, since opening a new position at the current price (without specifying entry price) does not change $$m'$$  , it does not enjoy a negative slippage. This is a bit different from the case of perp DPMM, in which a new position reducing the total net position always enjoys negative slippage.

And the mark price of power is:

$$
\frac{M\_{power}-i\_{power}}{i\_{power}}=k\_{power}n
$$

where $$i\_{power}$$  is the theoretical price of the power, calculated just like that in the [power perp DPMM](https://github.com/deri-protocol/whitepaper/blob/master/Pricing_Continuously_Funded_Power_Perpetuals.pdf):

$$
i\_{power}=\frac{i^2}{1-hT}
$$

Now we have a composite DPMM that, at any point, takes the state variables $$(n, m, i, \sigma)$$  to determine $$(M\_{perp}, M\_{power})$$  and hence gives$$M\_{gamma}$$  as

$$
M\_{gamma}=M\_{power}-\frac{2i\_0}{1-h\_0T}M\_{perp}+\frac{i\_0^2}{1-h\_0T}
$$

$$M\_{gamma}$$determines the trading cost of every trade and consequently determines PnL.

## Funding Calculation&#x20;

1 unit of Gamma swap has composite funding based on the power funding and the perp funding:

$$
F\_{gamma}=F\_{power}+\left(\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\right)F\_{perp}
$$

where $$(i\_0, h\_0)$$  are the $$(i,h)$$   as of the position entry point, and

$$
\begin{align\*}
F\_{power}=&\frac{M\_{power}-i^2}{T}\\
F\_{perp}=&\frac{M\_{perp}-i}{T}=i\cdot\frac{k\_{perp}}{T}\left(n\cdot\frac{2i}{1-hT}+m\right)
\end{align\*}
$$

$$F\_{power}$$   is simply handled the same way as power perps.

Whereas the handling of $$F\_{perp}$$ is somewhat tricky, as the coefficient of the $$F\_{perp}$$ term is constantly changing with $$i$$ . Essentially, this can be understood as every unit of Gamma swap has $$-\frac{2i\_0}{1-h\_0T}$$   “real futures” as well as $$\frac{2i}{1-hT}$$   “virtual futures”, and hence totally $$\left(\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\right)$$   effective futures. The tricky part is the constantly varying virtual part. Because of this constantly varying virtual part, the perp funding should be calculated **per Gamma swap, instead of per futures**.

By definition, the exact funding fee of 1 unit of Gamma swap accumulated over the time period $$(t\_1, t\_2)$$   should be the integral of $$F\_{perp}$$  over this period.

$$
\begin{align\*}
\text{Funding}*{perp}(t\_1,t\_2)=&\int*{t\_1}^{t\_2}\left(\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\right) F\_{perp}dt
\\
\=&\int\_{t\_1}^{t\_2}\left(\frac{2i}{1-hT}\right) F\_{perp}dt-\frac{2i\_0}{1-h\_0T}\int\_{t\_1}^{t\_2} F\_{perp}dt
\\
\=&
A|*{t\_1}^{t\_2}-
\frac{2i\_0}{1-h\_0T}B|*{t\_1}^{t\_2}
\end{align\*}
$$

where $$A|*{t\_1}^{t\_2}$$  and $$B|*{t\_1}^{t\_2}$$  are the accumulated increment of $$A$$   and $$B$$   over $$(t\_i,t\_2]$$  :

$$
\begin{align\*}
A|*{t\_1}^{t\_2}=&\int*{t\_1}^{t\_2}\frac{2i}{1-hT}\cdot F\_{perp}dt=\int\_{t\_1}^{t\_2}\frac{2i}{1-hT}\cdot i\cdot\frac{k\_{perp}}{T}\left(n\cdot\frac{2i}{1-hT}+m\right)dt\\
B|*{t\_1}^{t\_2}=&\int*{t\_1}^{t\_2} F\_{perp}dt=\int\_{t\_1}^{t\_2} i\cdot\frac{k\_{perp}}{T}\left(n\cdot\frac{2i}{1-hT}+m\right)dt\\
\end{align\*}
$$

Please note that the two accumulating variables $$A$$   and $$B$$   are universal to all positions while $$\frac{i\_o}{1-h\_0T}$$   is position-specific. We need to track the accumulations of $$A$$ and $$B$$ separately and then for any position we can calculate its accumulated funding fee with its own value of $$\frac{i\_0}{1-h\_0T}$$  . That is, for a position of $$x$$ gamma swaps entered at $$t\_a$$   with entry values $$(i\_0, h\_0)$$  , its accumulated funding fee from $$t\_1$$ to $$t\_2$$ is:

$$
\left\[(A\_{t\_2}-A\_{t\_1})-(B\_{t\_2}-B\_{t\_1})\frac{2i\_0}{1-h\_0T}\right]\cdot x
$$

In practice, it is impossible to rigorously calculate $$A$$ and $$B$$ due to their path-dependencies. Hence, we need some numerical approximations.

#### Approximation Method 1

We assume the funding over the time period $$(t\_{i-1},t\_i]$$   is accumulated at the speed as of $$t\_i$$  . Essentially this assumes $$i=i(t\_2), \forall i \in(t\_{i-1}, t\_i]$$ . With this approximation, the two integrals over $$(t\_i,t\_2]$$   degenerate into simple multiplications:

$$
\begin{align\*}
A|*{t\_1}^{t\_2}=&\frac{2i}{1-hT}\cdot i \cdot\frac{k*{perp}}{T}\left(n\cdot\frac{2i}{1-hT}+m\right)\Delta t\\
B|*{t\_1}^{t\_2}=&
i \cdot\frac{k*{perp}}{T}\left(n\cdot\frac{2i}{1-hT}+m\right)\Delta t
\end{align\*}
$$

#### Approximation Method 2

A more reasonable approximation is to assume the index price $$i$$ changes linearly over $$(t\_1, t\_2]$$  :

$$
i(t)=i\_1+(i\_2-i\_1)\frac{t-t\_1}{t\_2-t\_1}, \forall i \in(t\_{i-1}, t\_i]
$$

Then we can calculate the accumulating variables $$A$$  and $$B$$   as follows:

$$
\begin{align\*}
A|*{t\_1}^{t\_2}=&\frac{2}{1-hT}\cdot\frac{k*{perp}}{T}\left(n\cdot\frac{2}{1-hT}\cdot\overline {i^3}+m\cdot\overline {i^2}\right)\Delta t\\

B|*{t\_1}^{t\_2}=&
\frac{k*{perp}}{T}\left(n\cdot\frac{2}{1-hT}\cdot\overline {i^2}+m\cdot\overline {i}\right)\Delta t
\end{align\*}
$$

where $$\overline {i^3}$$, $$\overline {i^2}$$ and $$\overline i$$   are the time-weighted average value of $$i^3$$  , $$i^2$$   and $$i$$   over $$(t\_1, t\_2]$$  , respectively:

$$
\begin{align\*}
\overline{i^3}&=\frac{1}{\Delta t}\int\_{t\_1}^{t\_2}i^3dt=\frac{(i\_1+i\_2)(i\_1^2+i\_2^2)}{4}\\

\overline{i^2}&=\frac{1}{\Delta t}\int\_{t\_1}^{t\_2}i^2dt=\frac{i\_1^2+i\_1i\_2+i\_2^2}{3}\\

\overline{i}&=\frac{1}{\Delta t}\int\_{t\_1}^{t\_2}idt=\frac{i\_1+i\_2}{2}\\
\end{align\*}
$$

With this approximation, the power funding component can be calculated similarly:

$$
\text{Funding}*{power}(t\_1,t\_2) = \frac{(k*{power}n+hT)}{(1-hT)T}\cdot \overline{i^2} \Delta t= A\_{power}|\_{t\_1}^{t\_2}
$$

where $$A\_{power}|\_{t\_1}^{t\_2}$$   is the accumulating variable tracking the accumulation of power funding. In practice, the two  $$A$$ variables of power and futures can be combined into a single variable.

## Summary

The [previous paper](/library/academy/gamma-swap/introducing-gamma-swap) introduces the concept of Gamma Swap, a new type of derivative depending on a composite trading venue consisting of two primitive trading venues for power perps and perpetual futures. This paper explains the implementation of such a composite trading venue by the DPMM of Deri Protocol. With the DPMM for Gamma Swap constructed, now we are ready to roll out a comprehensive solution for Gamm Swap.


# Hedging Impermanent Loss with Gamma Swap

Our previous articles explained a theoretical methodology for hedging impermanent loss (IL) using Power Perpetuals. However, as explained in [the introductory paper of Gamma Swap](/library/academy/gamma-swap/introducing-gamma-swap), hedging IL with Power Perpetuals has an extremely low capital efficiency, which makes it not practical at all. This article explains how to hedge IL with Gamma Swap.

As mentioned in the introduction, when volatility stays still, Gamma Swap has the following theoretical price:

$$
P\_{gamma}=\frac{1}{1-h\_0T}(p-p\_0)^2
$$

where $$p$$ and $$p\_0$$ are the current underlying price and the entry price, while $$h\_0=r+\sigma\_0^2/2$$. We will see that impermanent loss has a very similar dynamic.

## LP Position Value

Let’s take the ETH-USDC pair on Uniswap V3 as example. Suppose an LP position contains $$x$$ ETH and $$y$$ USDC. Then $$x$$ and $$y$$ are functions of the ETH price p (in this article we follow the denotation of [Uniswap V3 whitepaper](https://uniswap.org/whitepaper-v3.pdf)):

$$
x=L\left(\frac{1}{\sqrt p}-\frac{1}{\sqrt p\_b}\right)\\
y=L\left(\sqrt p-\sqrt p\_a\right)
$$

The value of the LP position is as follows, for $$p\in(a,b)$$ :

$$
V=xp+y=L\left(2\sqrt p-\frac{p}{\sqrt p\_b}-\sqrt p\_a\right)
$$

Suppose the LP position is added at $$p=p\_0$$ , with $$x\_0$$  ETH and $$y\_0$$  USDC. The following equation should hold with these initial variables:

$$
L=\frac{x\_0}{\frac{1}{\sqrt p\_0}-\frac{1}{\sqrt p\_b}}=
\frac{y\_0}{\sqrt p\_0-\sqrt p\_a}
$$

## Hedge Impermanent Loss

Impermanent Loss refers to the loss of the LP position relative to the value of holding the original portfolio, $$x\_0$$  ETH and $$y\_0$$  USDC:

$$
\begin{align\*}
IL&=V-(x\_0p+y\_0)\\
&=(x-x\_0)p+(y-y\_0)\\
&=L\left(2\sqrt p-\frac{p}{\sqrt p\_0}-\sqrt p\_0\right)

\end{align\*}
$$

Denoting $$\Delta p = p-p\_0$$ , with Taylor expansion, we have

$$
\sqrt p=\sqrt p\_0\left\[1+\frac{1}{2}\frac{\Delta p}{p\_0}-\frac{1}{8}\frac{\Delta p^2}{p\_0^2}+O\left(\frac{\Delta p^3}{p\_0^3}\right)\right]
$$

$$
\begin{align\*}
IL&=-\frac{1}{4}Lp\_0^{-\frac{3}{2}}\Delta p^2+O\left(\frac{\Delta p^3}{p\_0^3}\right)\\

&\approx -\frac{1}{4}Lp\_0^{-\frac{3}{2}}(p-p\_0)^2
\end{align\*}
$$

It is very straightforward to hedge this $$IL$$  with Gamma Swap. We just need to long $$g$$  units of Gamma Swap such that

$$
IL+pP\_{Gamma}=0
$$

which leads to

$$
g=\frac{1}{4}Lp\_0^{-\frac{3}{2}}(1-h\_0T)
$$

where $$L=\frac{x\_0}{\frac{1}{\sqrt p\_0}-\frac{1}{\sqrt p\_b}}= \frac{y\_0}{\sqrt p\_0-\sqrt p\_a}$$ .

Please note that, since the Taylor-expansion-based approximation has an error \~ $$O\left(\frac{\Delta p^3}{p\_0^3}\right)$$ , this only ensures the portfolio has almost 0 IL around the entry point. For a typical position in Uniswap V3 with a range about $$\pm10%$$  around the current price, the error is negligible as $$\left|\frac{\Delta p^3}{p\_0^3}\right|<0.001$$ .

Obviously, this hedging comes at a cost, the funding fee of the Gamma Swap. The next section analyzes the cost. We will see that such a cost, although not constant, is reasonably predictable. That’s the whole point of this hedging operation.

## Hedging Cost

The theoretical funding fee of 1 unit of Gamma Swap for 1 funding period is:

$$
F= p^2\frac{hT}{1-hT}
$$

The annualized cost of $$g$$  units of Gamma Swap is

$$
\frac{gF\cdot1year}{T}=\frac{1}{4}Lh\frac{p^2}{p\_0^\frac{3}{2}}=\frac{1}{4}L\frac{p^2\sigma^2}{p\_0^\frac{3}{2}}
$$

Let’s discuss a specific example: a range order$$\pm10%$$  around the current price, i.e. $$p\_a=0.9p\_0, p\_b=1.1p\_0$$ . Then, for $$x\_0=1$$  ETH, we need $$y\_0=\frac{\sqrt p\_0-\sqrt p\_a}{\frac{1}{\sqrt p\_0}-\frac{1}{\sqrt p\_b}}\approx 1.1p\_0$$  USDC, and $$L=11\sqrt p\_0$$ .

{% hint style="info" %}
Numerical example: When ETHUSDC = 1000, for every 1 ETH added to a range order (900, 1000), $$y\_0$$ =1102.7 USDC is needed.
{% endhint %}

Then the annualized cost ratio of the position value is:

$$
R=\frac{5.37p^2\sigma^2}{p\_0p+1.1p\_0^2}
$$

Let’s put this annualized cost ratio into numerical scenarios:

<table><thead><tr><th> </th><th width="137">Price Change</th><th width="113"> </th><th width="119"> </th><th width="126"> </th><th> </th></tr></thead><tbody><tr><td>Volatility</td><td>-10% </td><td>-5% </td><td>0% </td><td>5% </td><td>10%</td></tr><tr><td>40%</td><td>35%</td><td>38%</td><td>41%</td><td>44%</td><td>47%</td></tr><tr><td>50%</td><td>54%</td><td>59%</td><td>64%</td><td>69%</td><td>74%</td></tr><tr><td>60%(~current BTC&#x26;ETH)</td><td>78%</td><td>85%</td><td>92%</td><td>99%</td><td>106%</td></tr><tr><td>70%</td><td>107%</td><td>116%</td><td>125%</td><td>135%</td><td>145%</td></tr><tr><td>80%</td><td>139%</td><td>151%</td><td>164%</td><td>176%</td><td>189%</td></tr></tbody></table>

Now, this liquidity-providing business turns into a question: **would the income of liquidity-providing (i.e. the transaction fee on the pair) cover the cost of hedging?** Given that both the income and the cost are reasonably predictable, this is a very simple math problem.

Essentially, hedging the Uniswap LP position with Gamma Swap turns the exchange-risk-with-income game into an exchange-cost-with-income one. The latter is much easier to manage and thus suitable for most investors, including those risk-averse ones that otherwise would never take risks to provide liquidity to Uniswap. **As long as the transaction fee income is greater than the hedging cost, the portfolio is profitable, with reasonable certainty.**


# A New Transaction Fee Algorithm for Gamma Swap

Since its introduction earlier this year, Gamma Swap has garnered significant attention. Despite its appeal, the beta phase highlighted several concerns. Most technical issues have been addressed, yet the matter of transaction fees demands a novel solution.

Under the existing fee algorithm, closing a Gamma Swap position often incurs an exorbitant cost. This issue originates from the absence of a pre-existing model for fee calculation during the initial design phase of Gamma Swap, a pioneering derivative product. Initially, we adopted a straightforward method, imposing fees on the power perpetual component, but this approach has been shown to be impractical.

To remedy this, we propose the ***Info-Advantage-Based fee algorithm***. The idea of this model is to neutralize the profits that a trader might gain with an informational edge of a certain size. Take, for example, a front-runner who has the ability to get ahead of the DPMM by a margin of 0.1% in price movement. The fee structure is designed so that the gross revenue they would make from a round trade (opening and closing a position) would be offset by the transaction fee.

Employing this principle, we've formulated the following fee algorithm:

$$
\begin{align\*}
Fee\_{Gamma} &= i^2\cdot 0.002 \cdot 0.02 + (i-i\_0)i \cdot 0.004\\
&\approx M\_{power}\cdot 0.002\cdot 0.02 + m'M\_{futures}\cdot0.002

\end{align\*}
$$

where

* &#x20;$$i$$ represents the index price of the underlying (e.g. the price of BTC)
* $$M\_{power}$$  the mark price of the power perp component; $$M\_{power}$$  the mark price of the futures component
* $$m'=\frac{2i}{1-hT}-\frac{2i\_0}{1-h\_0T}\approx2(i-i\_0)$$  is the number of effective futures.

Inside the code, this is the algorithm of calculating the exact amount of the fee charged on a specific trade:

$$
Fee = Cost\_{Power}\cdot 0.002\cdot 0.02+Cost\_{EffectiveFutures}\cdot 0.002
$$

{% hint style="info" %}
The current transaction fee is $$Cost\_{Power}\cdot 0.002$$ &#x20;
{% endhint %}

Please note the figures 0.002 and 0.02 are illustrative parameters chosen to demonstrate the mechanics of the new algorithm. The final parameters will be established upon the official release of Gamma Swap featuring the updated fee algorithm.

We will officially release the Gamma Swap with this new fee algorithm in Deri V4.


# Glossary

**Market**

<table><thead><tr><th width="220.92236740968488">Term</th><th width="593.4285714285713"></th></tr></thead><tbody><tr><td><strong>Perpetual Futures</strong></td><td>Perpetual futures are futures contracts with no expiration date. The “perpetual” status is maintained by paying/receiving the funding fee.</td></tr><tr><td><strong>Everlasting Options</strong></td><td>Everlasting options are the equivalent of perpetual futures for options which gives traders long-term options exposure without the effort, risk, or expense of rolling positions.</td></tr><tr><td><strong>Power Perpetuals</strong></td><td>A power perpetual is a perpetual derivative indexed to a power of the price of some underlying instrument.<br><br>First of all, we specifically implemented the case of <span class="math">p=2</span>, i.e. the perpetuals of BTC^2 and ETH^2. Since the square of BTC price is a huge number, we downscale it to a smaller unit - milli (prefix for 1/1000). Namely, the object being traded on Deri is <strong>mBTC^2</strong> and <strong>mETH^2</strong>, which correspond to 1/1000 of BTC^2 and ETH^2, respectively.</td></tr><tr><td><strong>Base Token</strong></td><td>Base tokens are the tokens accepted by Deri Protocol as contributed liquidity by the liquidity providers or as collateral by the traders.</td></tr><tr><td><strong>Daily Funding</strong></td><td><p>This is the fund fee converted to a time unit of one day. The funding that one long contract pays one short contract is always accrued on a second basis, so daily funding really means the following: </p><p>Daily funding = funding rate per second * 864000, </p><p>where 864000 is the number of seconds per day. </p><p>Please note that a positive funding fee means that longs are paying shorts, while a negative funding fee means that shorts are paying longs.</p></td></tr><tr><td><strong>Delta  (Everlasting Options Only)</strong></td><td>The ratio of option price change to the underlying price change. Mathematically, Delta is the first-order differential of the option price as a function of the underlying price.</td></tr><tr><td><strong>Funding Period</strong></td><td><p>For perpetual futures, Funding period is the time period for which the funding fee (MARK-INDEX) is paid. </p><p>For everlasting options, Funding period is the time period for which the funding fee (MARK-PAYOFF) is paid. For example, if for everlasting options Funding Period = 7 days, then every second a long (short) contract pays (receives) a funding fee = (MARK-PAYOFF)/7<em>2*4*</em>60*60</p></td></tr><tr><td><strong>Gamma (Everlasting Options Only)</strong></td><td>The ratio of option Delta change to the underlying price change. Mathematically, Gamma is the second-order differential of the option price as a function of the underlying price.</td></tr><tr><td><strong>Index Price</strong> </td><td>Spot price of the underlying asset. The Index Prices on Deri Protocol are provided by Oracle.</td></tr><tr><td><strong>Mark Price</strong></td><td>Price of the market, given by Deri Proactive Market Making (DPMM). This is the trading price of a trade with an infinitely small trading volume (i.e. without slippage) at the current moment.</td></tr><tr><td><strong>Min Trade Unit (Notional)</strong></td><td>The volume of any trade (in terms of notional) must be an integer multiple of Min Trade Unit.</td></tr><tr><td><strong>Settlement Token (Base0)</strong></td><td>Among all the base tokens, Base0 is used as the accounting unit and to settle the PnL. Essentially, this token plays the role of “cash” in the trading business.</td></tr><tr><td><strong>Theoretical Price of Everlasting Options</strong></td><td>The theoretical price of everlasting options calculated by the model. This is used as the starting point of the DPMM (in place of the Index Price for the futures DPMM).</td></tr><tr><td><strong>Total Net Position</strong></td><td>Total long positions minus total short positions for the current trading symbol. If positive (negative), traders’ total positions on the long side are more (less) than the short side, which means the pool is passively taking a short (long) position.</td></tr><tr><td><strong>Trade Price</strong></td><td>The average price paid when trade is executed</td></tr></tbody></table>

**User Account**

<table><thead><tr><th width="207">Term</th><th width="587.184855233853">Description</th></tr></thead><tbody><tr><td><strong>Available Margin</strong></td><td>The part of funds in your margin account that is <strong>not frozen as collateral</strong> for the open positions and thus <strong>available to withdraw</strong>.</td></tr><tr><td><strong>Dynamic Effective Balance</strong></td><td><p>Dynamic Effective Balance = Total discounted margin + Unrealized Pnl+ Accrued Funding Fee</p><p></p><p>Total discounted margin =∑ base token balance *<em>base token price *</em> discount factor</p><p></p><p>Please note that the Unrealized PnL is calculated by the mark price, which might be different from the realized pnl when the position is actually closed (due to the slippage).</p></td></tr><tr><td><strong>Initial Margin Ratio</strong></td><td>The percentage of the notional value that you must cover with collateral when opening a new position.</td></tr><tr><td><strong>Maintenance Margin Ratio</strong></td><td>The percentage of the notional value that you must cover with collateral to keep your open positions from being liquidated.</td></tr><tr><td><strong>Margin Usage</strong></td><td>The part of funds in your margin account that is <strong>frozen as collateral</strong> for the open positions and thus <strong>unavailable to withdraw</strong>. Margin Usage is determined by Initial Margin Ratio.</td></tr><tr><td><strong>Mining Pnl</strong></td><td><p>Mining Pnl is a liquidity provider’s PnL in terms of the base token that is caused by the trading activities on the involved liquidity pool. Specifically,</p><p>Mining Pnl = 20% of Transaction Fee + Funding Fee + Shared remaining margin in liquidated Positions + Traders’ loss (-Traders’ profit)</p><p></p><p>Please note that the following three parts of income are NOT included in the Mining PnL:<br>1. the DERI token reward</p><p>2. the interests accrued from the money market protocol (e.g. Venus)<br>3. the token reward by the money market protocol (e.g. XVS)</p><p></p><p>Refer to <a href="/pages/CkJUdqDmlqKjO8ip0tge">Mining</a> for more details.</p></td></tr></tbody></table>

**Position**

<table><thead><tr><th width="214.31578947368422">Term</th><th width="596.4285714285713">Description</th></tr></thead><tbody><tr><td><strong>Accrued Funding</strong></td><td>The part of the funding fee that is accrued (i.e. recorded) but not settled yet. It will be settled at the next settlement action (usually taking place with your next trading action). If positive, the pool owes you; otherwise you owe the pool.</td></tr><tr><td><strong>Entry Price</strong></td><td>The average price for establishing the current position. If the position is established with multiple trades, then this equals the total cost of all the trades divided by the position volume.</td></tr><tr><td><strong>Liq. Price(est.)</strong></td><td>The estimated liquidation price. If the index price of the contract reaches below the liquidation price (when long) or above (when short), the trader’s account will be liquidated.</td></tr><tr><td><strong>Unrealized PnL</strong></td><td>The profit or loss that would be realized if the position were closed at the moment.</td></tr></tbody></table>


# FAQs

FAQs

{% content-ref url="/pages/45RHX13tAbzEyXmnvZsM" %}
[Trading FAQ](/library/faqs/trading-faq)
{% endcontent-ref %}

{% content-ref url="/pages/Arfp9nEymYNHroHXzSkt" %}
[Mining FAQ](/library/faqs/mining-faq)
{% endcontent-ref %}

{% content-ref url="/pages/EgscJLQRKrZJGR0DrEX8" %}
[Mini-App FAQ](/library/faqs/mini-app-faq)
{% endcontent-ref %}


# Trading FAQ

General

## How do the various mechanisms of Deri Protocol work?

Refer to our *How it works section* - [Architecture](/how-it-works/architecture)

## Why is the Deri website sometimes slow?

In most cases, a slow data connection is just temporary, and caused by the RPC node.

Deri Protocol is a group of smart contracts deployed on the blockchain, where the exchange of risk exposures takes place completely on-chain. The RPC is quite important from a user's perspective because it allows you to query data and submit transactions on the blockchain on which Deri Protocol operates.

There may be times when the RPC URL is not as responsive as it should be. At these times, you may notice data being slow to load or not loading on Deri Protocol's trading page.

To continue using Deri Protocol during these times, we recommend you change the RPC URL in the network settings of your wallet. The page should load faster after changing the PRC URL.

For a list of RPC URLs and their statuses: <https://chainlist.org/>.

## Specific FAQs

### [Perpetual Futures](/library/faqs/trading-faq/perpetual-futures)

### [Everlasting Options](/library/faqs/trading-faq/everlasting-options)

## Which derivative should I trade? Everlasting Options or Perpetual Futures?

The rationale between choosing between Futures & Options is: what kind of risk you are willing to take/hedge & what kind of costs you are willing to pay. The advantage of futures is that the funding fee is pretty small (fluctuating around 0). Let’s say you are long BTCUSD, you make profits when BTC goes up, whereas you bear a loss when it goes down. The risk profile is symmetric. However, let’s say you are long some out-of-money BTCUSD option with the strike at 50000. The risk profile is asymmetric: you make profits when BTC goes above 50000, whereas you have just a little loss when it goes down. But there is no free lunch. For such asymmetric benefit, you need to pay the option premium, which in the case of Everlasting Options: the funding fees that you need to pay (presumably much higher than that of Futures).

## What do I have after placing an order?

When you successfully place an order, you have a PToken minted to your address on the blockchain. PToken (P for position) is a non-fungible token (NFT) containing your position information: direction\&volume, cost, your margin, cumulative funding rate at the minting block.

The PToken is how your position exists on the blockchain. You can send it to another address just like you send any NFT or fungible token (e.g. ERC20 token). That is, PToken is a tokenized position. Or, from a financial perspective, it's a tokenized risk exposure.

## What happens when I open 2 positions of the same symbol in opposite directions at the same time?&#x20;

You cannot open a long and a short position of the same symbol simultaneously. If you enter a long option and then go short for the same volume of the same option, you end up with an empty position. It’s just like you closed your long position.

## If I have positions in several symbols of one trading pool, would the total margin requirement be calculated for all of my positions?

Yes, should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions. Please note accordingly, forced liquidations are executed on the account level too. For more information check out our [Margin Requirement](/how-it-works/margin-requirement) article

## What happens if I do not meet my maintenance margin requirements? Will my position get liquidated?

To maintain those positions open, traders have to keep a certain percentage of the position's value on Deri Protocol, which is called "Maintenance Margin". The minimum Maintenance Margin requirements can be found on the Contract Info panel on the trading interface. If the Maintenance Margin requirement is not met, the position will be liquidated and your margin balance will be permanently lost. You can avoid this by adding additional margin.

Please note that we calculate the margin requirement on the account level. That is, should you have positions in several symbols of one trading pool, a total margin requirement would be calculated for all of your positions. Accordingly, forced liquidations are executed on the account level too. That is, upon forced liquidation, all of your positions in this pool will be closed and you will lose all of your margin balance in this pool.

## Would I lose some or all of my margin balance of a certain trading pool in the event of a forced liquidation of my account?

In that case, you would lose all of your margin balance related to this specific trading pool, i.e. your margin balance would become 0.

## Are unrealized profits and losses & Funding Fees deducted and added to the dynamic balance in real-time?

Yes, they are counted in the real-time dynamic balance. Funding fees are also counted in but settled every time the user changes the leverage or add/remove Margin

## Why is the liquidation price not displayed sometimes?

There are two cases when a “liquidation price” is not displayed:

1. **-- / --** : This symbol means the trader will not be liquidated for price move in this direction
2. **?**: this symbol means our simple algorithm cannot determine the liquidation price in this (selected) direction. Please manage your risk carefully.

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. \
\
We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!

## How to become a qualified liquidator on Deri Protocol?

Step 1: Approve Privileger smart contract in DERI token smart contract (<https://bscscan.com/address/0xe60eaf5A997DFAe83739e035b005A33AfdCc6df5#writeContract>)

![Approve Privileger smart contract](https://miro.medium.com/max/1400/1*k1Tw29bgOep7puJdV_UN0Q.png)

Step 2. You can find the number of DERI tokens and qualified liquidators on BSCscan. The average staking amount = Number of DERI tokens/Number of Liquidators.

![Check the average staking amount](https://miro.medium.com/max/1400/1*hEatrvMLfQJQtqX6I9nASg.png)

Step 3: Deposit your DERI tokens into the Privileger smart contract. The staking amount has to be no less than the average level.

![Deposit DERI tokens](/files/oU8EbDpwf9iF8NAMtEXa)

## How to Select Trading Symbols

1. Go to the Futures/Options/Powers trading interface and click on the trading symbol to open the search box.

![](/files/wGU01qnmgNwhQNXNoRSr)

2\. There are 3 types of derivatives: Futures, Options and Powers. Select your preferred product. For example, if you want to trade Everlasting Options, click **"Options"**. If you want to trade Powers, click **"Powers"**.

![](/files/IxDL8HpuxJ0oPQkQK8pu)

3\. Select the trading symbol you want to trade.

4\. Alternatively, you can search for a specific trading symbol using the search bar. For instance, if you search for “BTC”, all BTC derivatives (Futures, Options and Powers) will be displayed in the dropdown menu.

![](/files/q2juSA3Sk602WRHQkBrg)


# Perpetual Futures

## Is the Funding Fee charged only once at the opening of a position?&#x20;

No, it’s not just charged up-front (this is where Perpetual Futures differ from classic ones). It’s accrued per second but is settled every time you take an action (let's say you add some position).

## How can I add or remove margin?

Refer to our  [Trading \[Guide\]](/trading/deri-lite) article

## What is Funding Fee?&#x20;

Refer to our *How it works section* - [Funding Fee](/how-it-works/funding-fee)

## DPMM of Perpetual Futures

Refer to our *How it works section* - [DPMM (Proactive Market Making)](/how-it-works/dpmm-proactive-market-making)

## What is Perpetual Futures Liquidation based on?

For perpetual futures, the index price is the pivotal variable for calculating the liquidation

## Where can I find Initial Margin Ratio, Maintenance Margin Ratio, Transaction Fee of a specific trading symbol?

It’s shown on the trading page, once you select the specific trading symbol. if you move your mouse over the marked words, within the Contract Info panel, you will see a hove explaining how they're calculated/charged.

## Where can I claim my XVS reward?

XVS mining rewards can be claimed at the trading User interface. You will find a small downward pointing arrow below the "Dynamic Effective Balance", which when clicked, a Collect button will appear. Hit the "Collect" Button to claim your XVS reward

## What are the Smart Contract addresses of Deri Position Token (DPT)?

The DPT Token is available & active on the following networks with the following smart contract addresses:\
\
**BSC**: [0x2aa5865bf556ab3f6cd9405e565099f70234df05](https://bscscan.com/token/0x2aa5865bf556ab3f6cd9405e565099f70234df05)\
**POLYGON**: [0x0757bc621a32b1134ecf2843955b0bbc8ca13ba1](https://polygonscan.com/address/0x0757bc621a32b1134ecf2843955b0bbc8ca13ba1)

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. \
\
We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# Everlasting Options

## Is the Funding Fee charged only once at the opening of a position?&#x20;

No, it’s not just charged up-front (this is where Everlasting Options differ from classic ones). It’s accrued per second but is settled every time you take an action (let's say you add some position). The same also applies to the Funding Fee for perpetual futures.

## How can I add or remove margin?

Refer to our  [Trading \[Guide\]](/trading/deri-lite) article

## What is Funding Fee?&#x20;

Refer to our *How it works section* - [Funding Fee](/how-it-works/funding-fee)

## What is Funding Period?&#x20;

Funding period is the time period for which the funding fee (MARK-PAYOFF) is paid. For example, if funding period is 1 week, it means every second a long contract pays a funding fee:\
(MARK-PAYOFF)/(7\*24\*60\*60)

## DPMM of Everlasting Options

Refer to our *How it works section* - [DPMM (Proactive Market Making)](/how-it-works/dpmm-proactive-market-making)

## Can the Option Price appear negative?

Theoretically, option price should never be negative. However, there is no mechanism in our DPMM algorithm to stop this scenario. So hypothetically, if there is a huge selling order, it might cause DPMM to give a negative price, under some special circumstances. If that happens, you can buy in to take the arbitrage. That is, you get paid to own an option

## How is Option Price calculated?

Please refer to our [whitepaper](/library/whitepaper), or this article specifically for everlasting option pricing:\
<https://deri-protocol.medium.com/pricing-continuously-funded-everlasting-options-acf609a06937>

## How are the Initial Margin Ratio, Maintenance Margin Ratio, Transaction Fee calculated?

It’s explained on the trading page, once you select the specific trading symbol. if you move your mouse over the marked words, within the Contract Info panel, you will see a hove explaining how they're calculated/charged.

## What is Option Liquidation based on?

For Everlasting Option, DPMM takes two inputs from the oracle: the underlying price and volatility. It calculates then the theoretical price i for the option, whereof the liquidation is based on. (refer to the [EO whitepaper](/library/whitepaper#deri-protocol-everlasting-options-whitepaper) for the math of the pricing).

## Where can I claim my XVS reward?

XVS mining rewards can be claimed at the trading User interface. You will find a small downward pointing arrow below the "Dynamic Effective Balance", which when clicked, a Collect button will appear. Hit the "Collect" Button to claim your XVS reward

## Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. \
\
We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!


# Mining FAQ

Mining

## **Q: I have USDC in my Arbitrum address, but the Pools page shows my wallet balance of USDC is 0. Why?**

**A:** There are two versions of USDC on Arbitrum (and some other blockchains), native USDC and USDC.e. Deri V4 supports the former. So, if you have USDC.e, instead of native USDC, in your wallet, it won’t be recognized by Deri V4 website. You need to Swap USDC.e to native USDC (e.g. on[ Uniswap](https://uniswap.org/)) in order to stake into Deri.

Please read this document for [more details about native USDC vs USDC.e](https://docs.arbitrum.io/bridge-tokens/concepts/usdc-concept#:~:text=Arbitrum%20One%20has%20supported%20Bridged,Native%20USDC%20on%20Arbitrum%20One.)

## Why is there an additional ETH payment in addition to the regular gas fee?

**TLDR:** The additional part is the pre-paid gas fee for the subsequent step(s). This is because certain operations aren’t completed within the single user-initiated transaction. It’s akin to when you bridge tokens from Ethereum to a Layer 2 (e.g. Linea): you pay the standard gas fee on Ethereum, plus an additional “pre-paid” gas fee, which covers the bridge operation’s cost to complete the subsequent step on Linea for you.

**Details:**

As an xDapp, Deri V4 splits an operation (e.g., trade, add/remove margin, add/remove liquidity) into several steps executed on different blockchains.&#x20;

For instance, consider an “Add Liquidity” action initiated on Linea (the iChain), which involves three steps:

1. LP calls requestAddLiquidity on Linea.
2. Executor calls executeAddLiquidity on Deri Chain.
3. Executor calls finishAddLiquidity on Linea.

In step 1, the LP pays the regular gas fee for calling requestAddLiquidity and a prepaid gas for the executor to perform steps 2 and 3.

**Prepaid gas = dChain Fee + iChain Fee,**

where dChain Fee covers step 2, and iChain Fee covers step 3.

Given that step 2 occurs on L3, the dChain Fee is minimal, currently set at 0.00025ETH (higher on Linea due to its higher gas cost), and will be further reduced as we refine our architecture.

The iChain Fee is equivalent to the gas fee for calling finishAddLiquidity and varies based on the specific iChain.

Another instance, consider a “Trade” action initiated on Linea (the iChain), which involves two steps:

1. Trader calls requestTrade on Linea.
2. Executor calls executeTrade on Deri Chain.

Here is the detailed breakdown of Prepaid gas in ETH for each step. Please note that these figures are based on the actual gas costs across different networks and will be dynamically updated to reflect real-time network conditions.

<table><thead><tr><th width="190">Step</th><th width="187">Arbitrum</th><th width="159">zkSync Era</th><th width="161">Linea</th><th width="156">Scroll</th><th width="212">Polygon zkEVM</th><th width="158">Manta</th><th data-hidden>BNBChain</th><th data-hidden></th><th data-hidden></th></tr></thead><tbody><tr><td>Add Liquidity</td><td>0.000109650232</td><td>0.00012064345</td><td>0.00012364822</td><td>0.00065974594</td><td>0.00045773479498628</td><td>0.00016229668</td><td>0.00016229668</td><td></td><td></td></tr><tr><td>RemoveLiquidity</td><td>0.000139243414597</td><td>0.00012510142</td><td>0.00020119114</td><td>0.00091474552</td><td>0.00055887436</td><td>0.000462034787018205</td><td>0.000462034787018205</td><td></td><td></td></tr><tr><td>AddMargin</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td></td><td></td></tr><tr><td>RemoveMargin</td><td>0.000105963904</td><td>0.00011450449</td><td>0.00020308186</td><td>0.00086763208</td><td>0.00040942324</td><td>0.0002050594</td><td>0.0002050594</td><td></td><td></td></tr><tr><td>Trade</td><td>0.0001</td><td>0.0001</td><td>0.0001</td><td>0.0001</td><td>0.0001</td><td>0.0001</td><td>0.0001</td><td></td><td></td></tr><tr><td>TradeAndRemoveMargin(Lite Mode)</td><td>0.000105963904</td><td>0.00011450449</td><td>0.00020308186</td><td>0.00086763208</td><td>0.00040942324</td><td>0.0002050594</td><td>0.0002050594</td><td></td><td></td></tr></tbody></table>

## **Q: Does that mean I need to pay three times the regular gas fee?**

**No, you are paying less.**

Deri V4 merely breaks down the procedure into three parts executed on different blockchains. This approach causes almost zero additional cost compared to a scenario where the entire procedure is consolidated into one function call and completed in a single transaction on one blockchain. In the one-chain-one-transaction setup, you are still paying gas to finish all the procedures of the three steps, and your cost for step 2 would likely be much higher as it would be processed on iChain.

Therefore, by executing a considerable portion of the process on Deri Chain (an extremely cost-effective L3), the overall gas cost is actually reduced.

## How is the APY of AMM Liquidity Mining calculated & how can I verify it?

There are three fundamental factors that influence the displayed APY of a AMM mining pool. These are:

1. Both a rising and dropping value of DERI against USD, influence the displayed APY&#x20;
2. &#x20;The APY is generally dynamic, fundamentally influenced by how popular the pool is, the APY increases when liquidity decreases and decreases when liquidity increases.&#x20;
3. Mining on Deri Protocol is based on the S2F principle (similar to Bitcoin), the number of total DERI's mined per week is decreasing over time. Please note that the mining phase is going to take decades! For more information kindly check out our Tokenomics article

The APY of liquidity mining only includes the yield of DERI award, whereas the profit of the base token is not included.  To verify the displayed APY of liquidity mining for a certain pool, you can refer to the following formula:

1. At t0, record "My Harvest in Current Epoch" as H0;
2. At t1, record "My Harvest in Current Epoch" as H1;
3. Calculate $$APY=\frac{P\_{DERI}(H\_1-H\_0)Y}{(t\_1-t\_0)L}$$ , where $$P\_{DERI}$$ is the price of DERI, *Y* is one year's time, *L* is your liquidity contribution.

Please wait to have (t1-t0) long enough (e.g. 30 min) so that the estimation is close.

## Is DEX Liquidity Mining risk-free?

No, it is not. Liquidity mining on Uniswap are subject to the risk of impermanent loss. Any resulting permanent loss caused by removing the liquidity is in the user's responsibility. \
\
Use only the listed pools on our website to add liquidity. Adding liquidity on empty pools directly over Uniswap can cause a huge or total loss. Any resulting permanent loss caused by removing the liquidity is in the user's responsibility

## Is the AMM Liquidity Mining on Deri pools risk-free?

No, it isn't.  In general, it is essential to comprehend that liquidity providers are the counterparts of traders on Deri Protocol. When traders realize profits, they do so at the expense of liquidity provider's provided liquidity. When traders realize losses or are liquidated, liquidity providers realize profits at the expense of traders. Therefore a market risk exists for Liquidity Provider!

However, please note that such market risk is different from the *impermanent loss* of spot exchanges (e.g. Uniswap or Sushiswap). First of all, the fact it is called "risk", instead of "loss", indicates that the mining PnL/LSV result could be negative but also positive (For more details, check out: [Mining (AMM Liquidity Mining)](/how-it-works/mining-amm-liquidity-mining)). \
\
Secondly, the probability of a negative result (a loss) on Deri liquidity mining pools is much smaller than that of typical spot exchanges due to the protection by arbitrageurs, although a certain market risk remains. \
\
You might think of liquidity mining on Deri as investing in a low-risk fund with potentially very high profit, whereas that risk-free liquidity mining is like depositing your money into a bank saving account.

Please refer to our [whitepaper](https://github.com/deri-finance/whitepaper/blob/master/deri_whitepaper.pdf) for further details regarding the protection by the arbitrage mechanism.

## Since AMM liquidity mining is not risk-free, can I hedge the market risk of my liquidity contribution?

Yes, it is possible. Actually, it's quite convenient for sophisticated liquidity providers to do so: Liquidity miners merely need to hedge the portion of the risk exposure associated with their liquidity contribution.

For example, if you contribute 1% of the pool TVL and currently, the risk exposure (i.e. the net position) of the pool is 10 BTC and -1000 ETH, then you just need to hedge the part of the risk exposure for your part, i.e. 0.1BTC and -10ETH.


# Mini-App FAQ

## What is the Deri mini-app/bot?

The mini-app/bot is a version of the Deri platform adapted to Telegram for mobile users. It is a combination of a Telegram bot (a messaging interface that responds to your commands) and a mini-app (a mini-browser inside Telegram).&#x20;

## How can I quickly access the Deri mini-app?

If you haven’t interacted with the Deri mini-app yet, go to <https://t.me/DeriTradingBot>, or search for "@DeriTradingBot" or "Deri Trading Bot" in the Telegram search box to start a conversation with the Deri Trading bot. Make sure that you are indeed interacting with the bot with the handle "@DeriTradingBot" as some malicious actors could try to copy our bot in order to scam users.

Once you've interacted with the bot, it will appear in your conversation list. To make it even easier to find next time, you can pin the conversation with the Deri Trading bot or create a folder (e.g., "App") and add the Deri Trading bot to it.&#x20;

## Do I need to share my private key to use the Deri mini-app?

No. Unlike many Telegram mini-apps that require you to submit your private key or mnemonic phrase, the Deri mini-app **never** asks for such sensitive information. (We don’t agree with those practices either.) Instead, the mini-app generates a "smart account" for you.

## So, do you control the private key of the "smart account" you generated for me?

No. "Smart accounts" are smart contracts and therefore do not have private keys. Your smart account acts as an affiliated proxy of your linked wallet address. Its role is to trade and hold positions on behalf of your wallet address (i.e., on your behalf).

## Can you or anyone else access the funds in my smart account?

No. The code of the smart account ensures that the funds within it can only be used to trade derivatives on Deri or to be withdrawn back to your linked wallet address. The funds cannot be transferred elsewhere.

## What happens if your server gets hacked like those at centralized exchanges? Will my funds be lost?

No. Your funds are stored in your smart account, not on our servers or in our account. The smart account’s code guarantees that the funds can only be sent back to your linked address, nowhere else. Even in the unlikely event that our server is hacked (which, for the sake of argument, we assume could happen), your funds remain safe.

## Can I change the linked address associated with my smart account?

No. Once created, a smart account is permanently bound to its linked address, which cannot be changed. If you want to use a different linked address, you would need to delete the current smart account and create a new one.

## What if I lose access to the linked address? Can you recover the funds in my smart account?

If you completely lose control of the linked address (e.g., you lose your wallet and cannot recover it with the mnemonic phrase), then you lose access to the funds in the smart account as well. Unfortunately, there is nothing we can do in this case.

If someone else gains control of your linked address (e.g., an attacker steals your private key), they can access the funds in your smart account. Again, there's nothing we can do to prevent this.

Remember, the smart account is an affiliated account to your linked wallet address, meaning control of the linked address equals control of the smart account.

## What’s the difference between trading via the Deri mini-app and via the website deri.io?

Trading via deri.io follows the standard Web3 style, requiring you to confirm every action with your wallet (e.g., MetaMask). In contrast, trading via the Deri mini-app ressembles centralized exchange trading—no wallet confirmation is needed (Web2 style). However, since the smart account executes trades on your behalf, your funds remain nearly as secure as with the standard DeFi approach. You don’t have to worry about the risks associated with centralized exchanges, such as scams/fraud (like FTX) or hacks (like Mt. Gox).

In short, trading via the Deri mini-app offers the convenience of Web2 with the security of Web3.

## Is my smart account tied to the current blockchain? Can I switch to another blockchain for trading?

Yes, your smart account is linked to the blockchain where it was created, and this cannot be changed. To switch to another blockchain for trading, you’ll need to delete your current smart account and then create a new one, choosing the desired blockchain during the creation process.

## What are the costs of trading on the Deri mini-app?

You’ll incur transaction fees and gas fees. The transaction fees work similarly to those on centralized exchanges. The gas fees cover the cost of executing your transactions on the blockchain. However, unlike when you execute transactions yourself and only ETH is accepted for gas, Deri mini-app smart accounts support multiple gas tokens, such as ETH, USDC, and others. Typically, all tokens accepted as collateral for trading are also accepted as gas tokens.

<br>

\
\
\
\ <br>


# How to find the Token ID associated with your account

The Token ID is a unique identifier generated by the Deri Protocol, representing your on-chain identity for holding positions and assets. Whenever you engage in activities on the Deri Protocol, such as adding or removing liquidity or trading, you need to provide your corresponding Token ID. Since a user may have multiple Token IDs, it's important to identify the specific Token ID you wish to use for a particular operation. Here's a guide to help you locate your Token ID.

### For Liquidity Providers

**Step 1:**

* Navigate to a block explorer and search for transactions under your wallet address that are labeled with the method "Request Add Liquidity".

**Step 2:**

* Access the transaction details page to extract the Token ID.
* Refer to a transaction and click on 'decode input data'. The first parameter, typically labeled `ltokenId`, is the Token ID you're looking for.

<figure><img src="/files/UomiTGndg43Euj08jwUs" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/wYDIWJKfNLbNUIfWNdQL" alt=""><figcaption></figcaption></figure>

### For Traders

**Step 1:**

* Navigate to a block explorer and find transactions under your wallet address with the method "Request Trade".

**Step 2:**

* Access the transaction details page to extract the Token ID.
* For example, refer to a transaction and click on 'decode input data'. Again, the first parameter, usually `pTokenId`, is the required Token ID.

<figure><img src="/files/ENT4qiJtn5c9G62ozWcL" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/s4iKxwmISC3LO9260RZW" alt=""><figcaption></figcaption></figure>

### For Traders in Lite Mode

* If you are trading in lite mode, you might find your token ID in transactions with the method name "Add Margin And Trade". Follow the same process as above to locate your Token ID.

<br>


# Ideas to build

Deri Protocol is very versatile and committed to being a key block of the DeFi world, so we encourage developers to build their own products based on Deri Protocol.&#x20;

Here are some ideas to get started. If you would like to claim one of the ideas below or if you have an even better one, please contact us by telegram/discord. We can work out a plan to help you build it.

## DERI for Dummies

Builds an extremely simplified trading interface based on Deri protocol. Ideally, the interface should only have buy/long and sell/short buttons, and users can place orders with just simple clicks. The interface should be easy to understand and operate for those not quite financially savvy.

## Stats Dashboard&#x20;

Provides a stats dashboard similar to [info.deri.io](https://info.deri.io/#/info), but with more data of interest to the community, such as daily protocol revenue, daily and accumulative net pnl of traders, open interest of different symbols, the daily number of new traders and lp. daily transaction num, etc.

## Limit Order&#x20;

Currently, all transactions on deri.io are market orders based on the AMM mechanism, and users can not submit limit orders for the time being. You can use a third-party protocol such as [Chainlink.keeper](https://docs.chain.link/docs/chainlink-keepers/introduction/), [Gelato](https://www.gelato.network/) or any other smart contract automation services to help implement limit order function for all users.

## Position Builder

Similar to [Deribit position builder](https://pb.deribit.com/#/BTC), users can create their own portfolios from Deri’s futures, options and powers, and easily get the portfolio's PnL curve, and the net delta and gamma.

## Liquidation Board

Liquidation is open to anyone in DERI, but running a liquidation bot requires professional computer engineering knowledge, which prevents many people in the community from participating. A public liquidation board provides an open space to list all accounts at risk of liquidation. When an account reaches the liquidation line, anyone can click the liquidation button to help the system liquidate and get a liquidation reward.

## Impermanent Loss Hedger

The property of constant gamma of powers makes it perfect for hedging out impermanent losses together with futures. You can build a tool where the users input how much BTC or ETH amm liquidity they’d like to hedge, then the tool can automatically output the exact amount of futures to short and powers to long as needed. It should also display the payout curve of the hedged portfolio.


# Submit a question

Go to our Discord [#Support#](https://discord.gg/bdk6JutcWj) Channel and submit a ticket if you’re facing any difficulties.

{% embed url="<https://discord.com/invite/bdk6JutcWj>" %}


# Bug Report & Suggestions

Go to our Discord [#Support#](https://discord.gg/bdk6JutcWj) Channel and submit a ticket to report bugs and suggestions.

I. Bugs, incorrect information, broken links etc.

II. Suggestions regarding missing features, missing assets, responsiveness, design or missing information for Deri Protocol

[Verified Security Bugs](<https://immunefi.com/bounty/deriprotocol/ >) are awarded up to $10,000 in $DERI.&#x20;

{% embed url="<https://immunefi.com/bounty/deriprotocol>" %}


# Brand Asset

## Symbol

Theme color

<figure><img src="/files/19PmgtbClsalrmH5VTM5" alt=""><figcaption></figcaption></figure>

White:

<figure><img src="/files/3CaNKmn9mRZxnllIQxWE" alt=""><figcaption></figcaption></figure>

Black:

<figure><img src="/files/xCWvy7GIehXZoWUtqVVp" alt=""><figcaption></figcaption></figure>

SVG

<figure><img src="/files/vloxHZDMQlrTPu4cRgam" alt=""><figcaption></figcaption></figure>

AI

{% file src="/files/XjyWFfwPYNv9Ew4EeapK" %}

## Logo

Theme color

<figure><img src="/files/G2aeI5PnvK92b7KtgAyP" alt=""><figcaption></figcaption></figure>

White

<figure><img src="/files/AFHrgDxq5PLLwcr4pv57" alt=""><figcaption></figcaption></figure>

Black

<figure><img src="/files/4Vleuh0Yr2Wp0oEeSHQs" alt=""><figcaption></figcaption></figure>

SVG

<figure><img src="/files/BBZzbrpxAo7fB3uycBgo" alt=""><figcaption></figcaption></figure>

AI

{% file src="/files/xOUnezd41NcTWkfPRrim" %}


