Skip to main content
A taker fills against one or more Shard Books with a single instruction, match_taker_order. This works like an ordinary taker order: the taker sets a total size to fill and a worst acceptable price, and the instruction settles against whichever resting orders can fill it at the best price, up to that limit. The Shard Books involved still have to be passed in as accounts, the way any Solana instruction needs the accounts it touches, but which ones actually get filled depends on where the best price is sitting, not on anything the taker singles out. For each Shard Book the taker included, the program looks at the best resting order, skips it if it has expired, and fills as much of the taker’s remaining size as that order can take. Settlement happens in the same instruction: tokens move directly between the taker’s token accounts and the filled maker’s vault, using a checked token transfer, so there is no separate step where a fill is promised but not yet paid for.

Two protections against toxic flow

Beyond the ordering guarantees described on the Sequence Numbers and ACE page, every Shard Book can turn on two independent, optional protections that shape the price a taker actually pays as they fill. Both only ever move a price against the taker, never in their favor, and a maker who leaves them off is unaffected. Same-slot flow makes a side dearer as it fills. A maker can set a curve that says: the more size has already traded against one side of this book since its last reprice, the worse the price gets for the next bit of that same flow. A bot trying to drain one side of a book in a single slot pays a gradually rising cost instead of filling an unlimited amount at one stale price. This protection fades over time on its own, at a maker-chosen rate, and resets the moment the maker reprices with update_mid, since it is tied to the same sequence number used there. A maker’s own inventory can defend itself. A maker can also set a target balance for a token across their vault. If a series of fills has pushed the maker’s holdings away from that target, the price on the side that would push them further away gets worse for the taker, while the side that would bring them back toward target is left untouched. Because it never improves either side and only ever worsens the side that is hurting the maker, this cannot be used to sandwich the maker: no sequence of trades through it ever prices a buyer below the mid or a seller above it.