Unlock collateral
This sequence of actions illustrates how the Flash Trade system confirms the successful processing of orders. It involves verifying the successful transfer of the order asset, adjusting the collateral status, and confirming the successful processing of the order.
Verify that the transfer took place:
The Resolver provides two proofs (
receiveProof
andsendProof
) by calling theconfirmOrderAssetSend
method of theOrderResolver
contract.OrderResolver
verifies bothAssetReceive
andAssetSend
events with the help ofLightClient
, which signals that the order has been completed.If any of the events is not verified,
OrderResolver
reverts the transaction.
Unlock collateral:
If both events are verified,
CollateralManager
adds the order collateral amount to the unlocked collateral (unlockCounter
). The unlocked collateral is the amount of collateral that is not currently in use.CollateralManager
sets the nonce bit of the order to 1, effectively invalidating the nonce. A nonce is a number used once, and in this context, it is used to ensure each transaction is processed only once.CollateralManager
emits anOrderSendConfirm
event, signaling that the order asset has been sent and the process has been confirmed successfully. Consequently, collateral for this order gets unlocked and can be reused for further orders.
Last updated