Trade Lifecycle
Flow of Funds

Step 1: User Signs the Trade
The user calls the placetrade
function which signs permission for the user's limit order on the source chain.
Step 2: Market Maker Matches the Trade
The market maker calls placetrade
with inverse inputs, to match the user's limit order with an equal and opposite order.
Step 3: Market Maker Proposes and Executes the Match
The market maker calls proposematch
and executematch
on both chains. These functions link the user's order with the market maker's inverse order, preparing both sides for finalization.
Step 4: Market Maker Finalized Trade - Funds are Settled
The market maker calls finalizetrade
only on the source chain. This completes the trade, transferring the tokens between the user and the market maker parties and settles the transactions.
Trade Lifecycle
Alice places an order seeking to convert 100 units of Asset Y into Asset X.
Bob places an order to trade 100 units of Asset X for 100 units of Asset Y.
If Assets X and Y are on a different blockchains, the orders are passed to the destination blockchain via layer0
Otherwise, the matching occurs locally.
Every 5 minutes, orders are paired.
If there is a taker order from X to Y, this is paired with Alice’s order
If there is no taker order but there is a maker order, Alice is paired with the market maker.
The maker has 15 minutes to fund Alice’s trade. If the maker fails to fund Alice’s trade, they forfeit their collateral and lose their position in the queue.
Once matched, the smart contracts confirm that both sides are funded, authorizing the release of funds on the opposing chain.
Last updated