Liquidation
About Liquidation process
The process of liquidation on D4X could be managed by:
Liquidation Engine (LE)
Manual Liquidator
Case of the Liquidation Engine:
Smart contract of the D4X platform regularly calculates the critical (liquidation) level of the exchange rate of cryptocurrencies in relation to the trader’s open position. When the corresponding rate reaches the liquidation value, the D4X platform initiates the process of liquidation of the trader’s open position. When the corresponding exchange rate reaches the liquidation value, the D4X platform’s Liquidation Engine (LE) initiates the process of liquidation of the trader’s open position.
The special task "Liquidation" deployed in the decentralized automation service checks every period (each block or each small period depends on the kind of automation service) if some positions have to be liquidated. This task runs liquidation functions for all positions that have to be liquidated according to the queue.
More information about LE:
Liquidation EngineCase of a Manual Liquidator
Everybody from the D4X community could initiate liquidation by running if LE doesn't work. This gives D4X an additional layer of risk stability and decentralization.
In this case, the position will be checked on readiness for liquidation by the smart contract.
Manual Liquidator will receive a liquidation fee.
Example of Liquidation
There is the standard case of liquidation - when coverage by iFund is not needed
The next image shows a flow diagram describing a series of actions related to a D4X Liquidation process involving different entities and funds transferring between them:
Here are the actions described in the scheme:
Описать входные данные по Open position
Start Balances (before the deal):
Balance controlled by D4X main smart contract:
Balance of external Lending protocol in ETH: 5.000822 ETH = 5.0 ETH position body + reward at an annual rate 2% for 3 days 0.000822
Balance controlled by ALP:
Balance of external Lending protocol in USDT: 0 USDT
Balance of Trader: 0 USDT
Actions:
Liquidation Engine (LE) or a manual liquidator
Action 1: The Liquidation Engine (LE) or a Manual Liquidator initiates the liquidation process.
D4X Smart Contract
Action 2: D4X requests receiving stored funds in ETH.
Transfer 2.1 from Lending protocol: 5.000822 ETH is transferred as the lending body, and +0.000822 ETH as the lending reward, from the External Lending Protocol to the D4X Smart Contract.
Action 3: D4X starts exchange at an external Decentralized Exchange (DEX).
Transfer 3.1 to DEX: Temporary before exchange: 5.000822 ETH from the D4X Smart Contract to External DEXes.
External DEXes conduct an exchange: 5.000822 ETH to 9101.50 USDT (exchange rate 1820 USDT for 1 ETH).
Transfer 3.2 from DEX: Temporary after the exchange: 9101.50 USDT from External DEXes to the D4X Smart Contract.
Action 4: D4X distributes swapped amounts between interested parties.
Transfer 4.1 to Trader: 82.60 USDT to Trader.
Transfer 4.2 to iFund: 0.89 USDT to iFund (10%).
Transfer 4.3 to Auto Leverage Pool: 9008.01 USDT to ALP (Auto Leverage Pool) + 8.01 (90% of reward).
Transfer 4.4 to Liquidation Engine: Liquidation Engine receives +10 USDT.
ALP Auto Leverage Pool
Action 5: ALP initiates sending received amounts to External Lending Protocol.
Transfer 5.1 to Lending Protocol: 9008.01 USDT from the ALP to the External Lending Protocol.
End Balances (after the deal):
Balance controlled by D4X main smart contract:
Balance of external Lending protocol in ETH: 0 ETH
Balance controlled by ALP:
Balance of external Lending protocol in USDT: 9008.01 USDT
Balance of Trader: 82.60 USDT (from 1000.00 USDT that trader has sent in position)
Result
Result for Trader: The trader experienced a loss of -91.8%, receiving only 82.60 from 1000.00 USDT because his opened position received a loss.
Result for ALP: ALP saved all funds and received credit body and reward
Result for iFund: iFund received fee
Result for Liquidation Engine (LE) or a Manual Liquidator: Received liquidation fee
Other cases of Liquidation
Liquidation (covered by iFund)Liquidation (no iFund)Last updated