Skip to content

Coil intents

ELI5: An intent is a signed note saying "I'll sell X of token A for at least Y of token B before deadline D" — you sign with your wallet, solver executes later.

What you can do

Step Where
Build intent struct Off-chain / frontend
Sign EIP-712 Wallet (EOA or EIP-1271 smart wallet)
Submit to solver Off-chain API
Cancel cancel_intent on Coil contract

Flywheel fit

CoilMakerStrategy posts intents as EIP-1271 contract signer — same batch machinery as retail users.

Contract walkthrough

Intent typehash (Coil.vy):

INTENT_TYPEHASH: constant(bytes32) = keccak256(
    "Intent(address owner,address sell_token,address buy_token,"
    "uint256 sell_amount,uint256 min_buy_amount,uint256 deadline,uint256 nonce)"
)

Verification:

  • EOA → ecrecover
  • Contract wallet → EIP-1271 isValidSignature (magic 0x1626ba7e)
  • Reject owner == zero before recover (F3)
  • Nonce replay protection per owner

Permits: revert_on_failure=False + allowance check in Phase 1 (anti-frontrun F1).

Limits:

  • MAX_BATCH_SIZE = 50
  • MAX_INTENT_LIFETIME = 7 days
  • Decimal-aware min_order_size per token

What happens in your wallet

  1. Approve sell token (or sign EIP-2612 permit in intent).
  2. Sign typed data — no gas yet.
  3. Solver settles — one tx executes swap; balances update.

What can go wrong

Risks

  • Intent expires unfilled.
  • Solver censorship — must trust whitelisted solver set.
  • Partial fills if batch clearing allows.

Source: Coil-DEX/src/Coil.vy