Skip to content

v2.0.0

Choose a tag to compare

@mmsaki mmsaki released this 12 Nov 17:15
06146f8

Async Swap v2.0.0 adds flash fills and non-numeraire pools, so any asset can trade for any asset through the order books with no filler inventory. It is a new hook and Router deployment; v1 hooks are unchanged and stay indexed.

What's new

  • Flash fills (#94): Router.fillOrderWithCallback credits an order's input to the filler as ERC-6909 claims, calls IAsyncSwapFlashFiller.asyncSwapFlashFill inside the Router's PoolManager unlock, then collects the maker's output as claims. Inside the callback the filler can route through any v4 pool and fill other orders with fillOrderInCallback / matchBookInCallback. Integrators call these through IAsyncSwapCallback(router).
  • Non-numeraire pools (#95): a pool such as ETH/AMD can be opened once both tokens have a numeraire pool on the hook with the same tick spacing. currency1 is its quote side, each side's minimum is the token's decimal floor, and it takes no priority bid.
  • Layout under EIP-170 (#95): the Router's flash surface lives in a RouterFlashFills module run by DELEGATECALL; the hook's side and pool setup live in the new linked MultiAsset library.

Validation

Result
Full Solidity suite (solc 0.8.26, as CI) 1,123 tests passed
Invariants 64 runs × 64 actions
Production sizes and formatting Passed (AsyncSwap 23,825 B, Router 24,337 B, AsyncMatching 24,070 B)

Testnet deployments (#97)

Unichain Sepolia (1301) Robinhood testnet (46630)
AsyncSwap 0x919Dc5DD035Ad1E4D58250691E2840724e0De888 0x91c8C21285a3e247bf72b395D568488aa8132888
Router 0x3bEaBd857B2E87E6871376A2B3bf4fC7558946A9 0x5D2100D5583D3Ce50f5b57b92d7fc4d4c531baf0
MultiAsset 0xA706e93Cbfe71AA126629B3a214A1De33015ad38 same

Sources verified. Pools: ETH/USDC on 1301; ETH, AMD, AMZN, NFLX, PLTR, TSLA against USDG and ETH/AMD on 46630.

Not audited and not deployed to mainnet. Before audit: invariant handlers for the new paths, a route through an LP-backed v4 pool inside the callback, callback-token reentrancy on the maker payout, and the Lean CtorSpec model for the Router's FLASH_FILLS immutable.

Source: 06146f8d761cfb9545e4c4a4331dd6d24e8d4d60.