How does the insurance pool in Derify works

in dex •  3 years ago 

derify6.png

Just like all CEX that supports perpetual trading, the insurance pool plays an important role in all DEX: When facing drastic price fluctuations, there may be some positions with losses exceeds the account balance, which means after liquadation, the remaining account balance will still unable to pay off the debt incurred during a margin call, causing the account to be bankruptcy, all excess losses will thus be borne by the exchange, thus an Insurance Pool is vital.

Derify will also use funds from the insurance pool to cover similar losses. The insurance pool is the most important layer of our risk control, and loss distribution will happen when the insurance pool is also short in funds (centralized exchanges reduce their own risk by automatically closing trader’s profitable positions, but this brings poor user experience). Derify Protocol’s insurance pool mechanism will be elaborated in detail here.

The role of the insurance pool in Derify Protocol

As we know from the previous article on market making and Position Change Fees, instead of using an order-book to match transactions, Derify controls the risk by keeping the balance between long positions and short positions. The smart contract calculates the profit/loss at the price of opening/closing positions directly and provides incentives for arbitrageurs to maintain such balance. However, in the actual trading, risk exposure will always be present because of the responding delay of arbitrageurs (motivation for arbitrage only comes after naked positions appear) , and the risk exposure may be quickly magnified due to mandatory liquidation in a volatile market (such as a price spike or crash). In Derify’s, when the system is in a net loss and the user’s profitable positions are closed, funds from the insurance pool will be used as a supplement to ensure the normal settlement of the profitable positions.

How to calculate the insurance payout

As said, when the system generates a net loss, the funds in the insurance pool will be used for payout, and when the system generates a net profit, it injects funds into the insurance pool. But for traders, when does the insurance pool payout be triggered and what is the specific payout ratio for each transaction? We can calculate it according to the mathematical formula provided in section 2.7.1 of the whitepaper, and the details are explained according to the following diagram and examples.

derify6 01.png

derify6 02.png

Example: In a BTC/USD contract, suppose the total profit of profitable positions is 11 million USD and the net loss of the system is 1 million USD. At this point Alice has a profitable position to close, with an unrealized PnL of 1100 USD. She will receive 1100 USD of realized PnL after closing the position, of which 1000 USD (1100–1100*1 million/11 million) is covered by market liquidity (position pool) and the remaining 100 USD is covered by the insurance pool.

derify6 03.png

derify6 04.png

Example: In the BTC/USD contract, the total loss of losing positions is 11 million USD and the net profit of the system is 1 million USD. At this point Bob has a losing position to close, with an unrealized PnL of -1100 USD. He will receive -1100 USD of realized PnL after closing the position, of which -1000 USD (1100–1100*1 million/11 million) is left to the market liquidity (position pool) and the remaining 100 USD is injected into the insurance pool.

The cashflow of the Insurance Pool

The cashflow of the insurance pool is related to the closing of positions, fees, mandatory liquidation and Position Change Fees. The insurance pool will have different rules for inflows and outflows depending on the status of the fund.

Regular status: no deficit and no overflow

derify6 05.png

When the insurance pool fund is sufficient and overfunding state is not triggered (overfunding status is when the fund in the insurance pool is greater than or equal to 200% of the total net loss of losing positions), the cash inflow includes distributed loss of traders, the buyback fund (including 20% of the trading fee), the insurance fund (20% of the trading fee + remaining Partner awards), users’ position change fees, and the remaining margin for forced closing positions. The position change fees paid to users and the distributed profit for traders are covered by the outflows from the insurance pool.

Overfunding status: the fund of the insurance pool is greater than or equal to 200% of the total net loss of the losing positions

derify6 06.png

This status means that the fund of the insurance pool is sufficient, and the excessive fund is used to redeem the bonds. At the same time, instead of being injected into the insurance pool, the buyback fund will be not be injected into the insurance pool, instead used for repurchase and burn DRF tokens.

Underfunded status: the insurance pool is depleted

derify6 07.png

When there are no cash left in the insurance pool, bonds will be issued to cover traders’ profit and position change fees.

Derify’s goal is to optimizing the insurance pool mechanism and increasing the size and security of the insurance pool. In order to ensure safety while maximizing the capital utilization rate, we adopt the following principles: when the insurance pool is underfunded, the rate of injection is accelerated; when the insurance pool is overfunded, the rate of injection is reduced. Even so, we still cannot guarantee the insurance pool is always full and without any accidents, especially in extreme market conditions.

Therefore, we have introduced a bond mechanism based on the insurance pool, which provide more protection to the insurance pool, and the details will be described in next article.

Please spread the words, for the future of DeFi community.

Follow/Subscribe us for more updates!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!