Liquidation
Last updated
Last updated
Flash Trade protocol has mechanisms to handle orders that have not been fulfilled within a certain time limit. If an order reaches its timeout and expires uncompleted, a Liquidator can step in to fill this order and refund a User.
In this flow, a Liquidator fills the expired order by sending their own assets to a User instead of a Resolver.
Order liquidation is performed by calling the sendOrderLiqAsset
method of the OrderSender
contract. This method sends the liquidator's to
asset in the amount specified in the order to the from
actor address specified there as well. Anyone can be the liquidation caller of this method. When succeeded, the AssetLiqSend
event is emitted, which should then be proved by liqSendProof
.
The method becomes available once the send deadline is exceeded and until the liquidation send deadline is reached.
Slashing collateral is possible when two proofs are provided to slashOrderLiqCollateral
method of OrderResolver
:
order asset received on "from" chain (receiveProof
)
order asset sent on "to" chain by liquidator (liqSendProof
)
Providing valid proofs allows collateral to be slashed in favor of the liquidator; thus, Liquidators can profit from filling the expired orders.
When neither the Resolver nor Liquidator sends assets, a slash by the User is activated. In this flow, the User gets the Resolver's collateral instead of the "to" asset. To do that, no-send
event must be reported on the "to" chain (by the User or an arbitrary Liquidator) by calling the corresponding method slashOrderCollateral
. It allows collateral slash in favor of the User when two proofs are provided to the method slashOrderCollateral
of the OrderResolver
contract:
order assets received on the "from" chain (receiveProof
);
order assets not sent on the "to" chain (noSendProof
).
Note that the Liquidator in this flow may call both report and slash methods. The main share of the order collateral still goes to the User in this case. At the same time, the Liquidator gets rewarded for performing two transactions with a smaller collateral share as specified in the order.
If the collateral and the OrderSender
contract are located on the same network, a failed order could be liquidated in a single transaction using a flash loan. A flash loan is a feature in DeFi that allows the Liquidator to borrow assets without any collateral as long as the borrowed assets are returned within the same transaction. Flash loans enable Liquidators to complete the liquidation process more efficiently without the need for additional transactions or collateral.