Skip to content
log(swap)

Settlement

One lock, all markets

Core operations move no tokens. They accrue signed transient deltas per (token, locker) using EIP-1153, and settlement happens once, when the lock closes. The lock cannot close with any delta outstanding — debt or credit.

The lock is manager-wide, and that is the singleton's structural dividend: a route through several markets accrues deltas per token, so intermediate tokens net to zero and never move. A three-hop route pays two transfers total, at its endpoints.

Two modes share one set of functions:

  • EOA — call mint / swap / … directly; an auto-lock wrapper opens, runs, settles, closes.
  • Locker — call unlock(data) first; the wrapper sees an open lock and does nothing, so deltas accumulate across many operations and settle once.

So a router opens one lock across many operations: blending two ladder rungs, or funding a mint from a swap, costs one transfer per token.

Delta sinks

directiontoken pathclaim path
positive deltatakemintClaims — tokens stay inside
negative deltasync → transfer → settleburnClaims

A token claim is an ERC-6909 IOU on tokens left inside the manager. Because the manager is a singleton, one parked balance serves every market at once — which is why claims were correctly skipped per-pool and are worth having now. A market maker can park inventory and serve every market from it.

Backing needs no new machinery: minting a claim debits the caller exactly as a withdrawal would, so the close-time zero-delta check is the guarantee.

Why this replaces re-entrancy guards

A locker re-enters by design, so nonReentrant is not available. What replaces it is narrower and stronger:

Re-entry is permitted. Leaving a debt is fatal.

No token moves mid-computation, a delta is zeroed before its transfer, and anything a re-entrant call accrues is still outstanding at the close check.

The two singletons settle separately

ManagerC and ManagerF hold separate locks — a distinct contract is a distinct transient namespace — but both settle the same way: open the lock, run the operations as deltas, pay the manager directly from the payer. Neither router custodies anything, and each is its own Permit2 spender.