Batches · chain 4663
The batch hook settles a pool in rounds. Orders are cast into the open batch; when it closes, buys and sells match each other at the pool's own price and only the residual reaches the pool, as one swap. Here you can run that settlement over a live pool's numbers and see exactly what the ledger would record.
Cast an order
The open batch
| # | Side | Amount | At spot |
|---|---|---|---|
| No orders yet. | |||
What the chain would see
| Cast two orders on opposite sides and watch them net. |
Two orders that match never reach the pool.
Residual is signed the way the hook will report it: negative means the quote currency was sold into the pool. A batch whose two sides match to the wei never reaches the PoolManager at all, and the row says so.
Once our hook is on chain, this page stops simulating and reads the hook's own events: the orders cast, what matched inside at the pool's price, and the one residual swap, or none, that reached the pool.