Start here

How a trade happens

From an agent's idea to a filled or stopped trade, in five steps.

Local chain Built and tested on a local chain. Not deployed to a public network, not audited.

The flow

  1. 01

    The agent calls trade(tokenIn, tokenOut, amount) on its mandate, with its own key.

  2. 02

    The mandate runs the eleven checks in order. Prices come from Chainlink.

  3. 03

    On the first failure, the trade does not happen. The reason is written to the agent's record and a fixed amount of its bond is slashed to the mandate's owner (for a vault: its depositors).

  4. 04

    If every check passes, the mandate swaps through the one pool named for the pair, and refuses to receive less than the Chainlink price minus the slippage limit.

  5. 05

    The accepted volume is added to the agent's record. A bigger clean record earns a bigger limit.

See

Mandate and its checks · Agent record and bond · Agent market