Build
Resting orders
Name a price in shares and walk away. The book holds it, the router fills it, every fill burns.
A stock token on this chain trades at whatever the last order left behind, and that is routinely far from what the share is worth. A trader who would buy at fair value, and not above it, had no way to say so. The order book lets them: an order is money held in a contract with the least the owner will accept back, in the pool’s own units, and it fills through the Collapick router the moment the pool can pay that.
How a fill works
Anyone may call execute on an open order. It does one thing: asks the router to trade the whole order with the owner’s minimum as the bound. The router refuses a fill the pool cannot pay, so a fill either happens at the named price or better, or nothing moves. Nobody sets a price, keeps a book off chain, or is trusted. The output goes straight to the owner; the router’s quarter per cent goes to the buyback, as on every order.
The keeper
A wallet of ours reads every open order once a minute, asks the router what it would pay right now, simulates the fill, and sends the ones that clear. It holds nothing but gas, has no special rights, and anyone running the same loop would fill the same orders. An expired order is sent home by the same loop, or by anyone who calls expire.
Sizes and limits
- 01Orders are named in shares; the ticket converts to tokens through the multiplier and to USDG through your price.
- 02A buy holds USDG and names the least tokens back. A sell holds tokens and names the least USDG back.
- 03Up to twenty open orders per wallet. An order rests up to a year.
- 04Cancel returns the money at once. Expire returns it after the time you set.
- 05The fee on a fill is the router’s, 0.25%, and the waiver for holders does not apply: the book is the trader the router sees.
place(pool, zeroForOne, amountIn, minOut, expiry) -> id execute(id) anyone; reverts through the router if the pool cannot pay cancel(id) owner only, at once expire(id) anyone, after expiry ordersOf(owner) -> ids orders(id) -> (owner, pool, tokenIn, zeroForOne, amountIn, minOut, expiry, placedAt, status) No owner, no pause, no upgrade. The router address is immutable.
