Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 2.61 KB

File metadata and controls

62 lines (41 loc) · 2.61 KB

Bridge workflow

Use this workflow when the user wants to bridge tokens across chains.

Reference command syntax in references/swap.md. The CLI uses the same swap commands for bridging. Set --to-chain to a different chain than --from-chain.

Flow

  1. Quote.
  2. Confirm with the user.
  3. Execute and track status.

Don't skip the quote review step. The user needs to see output amount, fees, route, and slippage before executing.

Quote

mm swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137 --slippage 0.5

Required flags: --from, --to, --amount, --from-chain, and --to-chain.

If the user wants the bridged tokens sent to a different wallet on the destination chain, add --to-address:

mm swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137 --to-address 0x742d...f2bD18

If the recipient may have no native gas on the destination chain, add --refuel to bundle a destination gas top-up into the quote (cross-chain only, opt-in, best-effort — see references/swap.md). Do not add --refuel when the destination token is the destination chain's native gas asset (e.g. bridging into ETH on Arbitrum) — the backend returns 0 quotes in that case:

mm swap quote --from USDC --to USDC --amount 50 --from-chain 1 --to-chain 42161 --refuel

Persist the quote id for execution. Show the quote to the user before execution. Confirm source token, destination token, amount, source chain, destination chain, slippage, expected output, fees, route, recipient address (if --to-address was set), and the destination gas top-up (if --refuel was set).

Execute

mm swap execute --quote-id "QUOTE_ID"

Prefer executing by quote ID. Re-quote-and-execute flags exist, but quote ID execution keeps the reviewed quote tied to the submitted action.

Status

mm swap status --quote-id "QUOTE_ID"
mm swap status --quote-id "QUOTE_ID" --tx-hash 0xabc123

Use status polling for bridges where the destination side can lag behind the source transaction.

Edge cases

  • Quote expired: re-quote and ask the user to review the new quote.
  • Insufficient balance: surface the error verbatim.
  • Slippage exceeded: only increase --slippage if the user explicitly accepts more slippage. Always warn the user if slippage is increased above 1% that it will affect the minimum received.
  • Missing chain: use mm chains list before guessing a chain ID.
  • Refuel into a native asset: if --refuel is set and the destination token is the destination chain's native gas asset, the backend returns 0 quotes (NO_QUOTES). Re-quote without --refuel.