Saturn Library
Library how everything here works, in plain words
26guides
Trade

TWAMM, swapping over time

Split a large trade into chunks fired over minutes or hours.

Open TWAMM

In shortSplit a big trade into chunks over time. Each chunk goes through when someone fires it, and whoever fires it earns a bounty.

Pacing
at least 60 seconds between chunks
Bounty
50 = 0.5% of each chunk's output
Floor
a price, from contract 4.2.4
Cancel
any time while it runs

A big swap in one go pushes the price against you and invites bots to trade around it. A TWAMM stream escrows the whole amount and swaps it into the pool in chunks over minutes or hours. Every chunk pays the pool's normal swap fee.

Splitting alone does not make the trade cheaper. Chunks land closer to the market price only when other traders move the price back between them; if nobody does, the stream moves the pool as much as one swap of the same size would.

Placing a stream

  1. Choose the pool and the token you sell, for example KCAL into TAZ. Pools with the same pair can have very different fees, and the picker shows each one's.
  2. Enter the total amount and the duration in minutes.
  3. Set the chunk pacing, the minimum seconds between two chunks. 60 is the lowest the chain allows. Each on-time chunk has to clear the chain's minimum swap, 0.01 of the input token for most tokens; the contract refuses a stream whose chunks would be smaller.
  4. Set the floor: what an on-time chunk must pay at least. It is a price. A chunk twice as big needs twice the output, a small last chunk proportionally less. The page suggests 90% of what an on-time chunk pays today.
  5. Set the bounty, 0 to 500 per 10,000. It comes out of each chunk's output and goes to whoever fires it.
  6. Sign. Your input is held by the TWAMM contract from that moment.

While it runs

  • A chunk goes through when someone fires it: Saturn's keeper, anyone else, or you with Execute chunk on the stream's card. The TWAMM page says whether the keeper runs on the network you are on. It leaves streams without a bounty alone.
  • A chunk carries everything owed since the last one. However late it is fired, it has to pay your floor price, so it cannot be pushed through at a worse price by waiting or by swaps wrapped around it. If the price falls under your floor, chunks wait until it comes back.
  • The output collects inside the contract and you can claim it whenever you like. When the stream completes, the rest is paid to you in the same transaction.
  • Cancel at any time while the stream runs. The unswapped input and all output collected so far come back to you in the same transaction.

Contract 4.2.3, still live on a network until its upgrade, works differently: the floor there is one fixed amount per chunk, a small last chunk can fall under it and get stuck (Cancel returns it), and a completed stream's last output has to be claimed. The TWAMM page follows whichever version the network runs.