Skip to content

Batch auction

ELI5: Many buy and sell orders for the same pair clear at one price in a single transaction — like a sealed-bid auction where everyone gets the same clearing price.

What you can do

Actor Action
Solver execute_batch with fills
User Included via signed intent

Flywheel fit

Uniform clearing enables fair CoilMaker market-making — strategy quotes against known clearing math, not sandwichable AMM path.

Contract walkthrough

Uniform clearing price per token pair in batch:

clearing_price = total_buy_amount / total_sell_amount

All fills in batch use same price → no in-batch front-running.

Solvency guard — measure buy-token balance before/after solver pull (fee-on-transfer safe):

balance_before: uint256 = staticcall buy_token.balanceOf(self)
# ... execute fills ...
# assert actual received >= expected

Bounded arithmetic: fill_amt, sell_amount, price_component < 2**128 (overflow-proof settlement).

sequenceDiagram
    participant S as Solver
    participant C as Coil.vy
    participant T as Tokens
    S->>C: execute_batch(intents, fills)
    C->>C: verify signatures + nonces
    C->>T: pull/push per fill
    C->>C: fee deduction

What can go wrong

Risks

  • Solver must be whitelisted — centralization vector.
  • Bad batch construction → whole tx reverts.
  • MAX_FEE_BPS = 100 (1% cap).

Source: Coil-DEX/src/Coil.vy, SECURITY.md