Comment on page
Fill an order
This sequence of actions forms a complete cycle of order processing in the Flash Trade system. It illustrates how orders are received, processed, and completed across different blockchains.
- 1.Order Confirmation:Order confirmation process
- 1.A User requests prices from resolvers.
- 2.A Resolver provides price rates by User quotes.
- 3.If the User agrees to a rate, they check the collateral state of the Resolver.
- 4.If the Resolver has enough collateral, the User can form and sign the order.
- 5.The User approves the transfer of the order asset to the Resolver.
- 6.The Resolver receives an order from the User in the initial blockchain.
- 7.The order is received by the "OrderReceiver" smart contract that transfers the order asset to the Resolver.
- 1.OrderReceiver computes the locked collateral for the order. The locked collateral is the sum of the order amount and the liquidation bounty. The liquidation bounty is an amount set aside to incentivize Liquidators to step in and complete the order if the Resolver fails to do so. The size of the collateral is always higher than one, is calculated depending on the asset, and depends on the execution time. Moreover, the collateral for stablecoins will be smaller than for native coins or tokens.
- 2.If the unlocked collateral is smaller than the required collateral (locked collateral), a transaction revert will occur, and the Resolver will fail to confirm the order. An unlocked collateral is the Resolver’s balance that is not currently involved in securing transactions.
- 3.If the unlocked collateral is bigger than the required collateral amount, the OrderReceiver updates the state and emits an "AssetReceived" event, signaling that the order assets have been received successfully.
- 3.Order filling:Order filling process
- 1.After successfully receiving the order asset in the initial blockchain, the Resolver fills the order in the destination blockchain.
- 2.The order is filled by the "OrderSender" (another smart contract), which transfers the order assets to the User.
- 3.After transferring the assets to the User, the OrderSender emits an "AssetSend" event, signaling that the order assets have been sent successfully.