Offers and fills
An offer has a side, a price in USDC per unit, a quantity and a minimum fill.
- Sell offer. The maker deposits collateral:
ceil(quantity x price x collateralBps / 10,000). A buyer fills it by payingfill x price. - Buy offer. The maker deposits the full payment,
quantity x price. A seller fills it by posting collateral for the fill. - Minimum fill. A taker takes at least the minimum, except the last remainder, which always fills.
- Cancel. The maker takes back the unfilled part at any time and in every phase. Collateral is computed on cumulative fills, so the collateral of every fill plus what a cancel returns is exactly the deposit (a property the fuzz tests check).
- Self-fill. A maker cannot fill its own offer.
Prices use USDC's 6 decimals. Quantities are whole units.