Module Deep DivesExecution Layer
Execution Layer
Runtime orchestration modules that gate swaps and settle mint/redeem flows.
What It Does
The Execution Layer is the runtime path for user intent. It converts swap or mint/redeem requests into explicit allow/reject outcomes using hook checks, collateral accounting, and bounded settlement callbacks.
Runtime Contract
Execution modules are expected to preserve these guarantees:
- risk checks happen before state-changing settlement
- settlement deltas stay within configured absolute bounds
- rejected paths fail with explicit errors or rejection events
- transient hook state is cleared after settlement
Request Flow
In practice:
- User intent enters a Uniswap v4 pool using
HybridCollateralSettlementHook. - Unsigned swaps pass through with zero hook delta and no vault settlement when pool liquidity is allowed.
- Signed swaps validate pool config, safe mode, oracle output, and the full requested amount against the transaction limit.
- Signed hook sizing asks the manager/controller for
vaultSettlementSpecifiedAbs, checks that leg against the block limit in ExternalSettlementVolume mode, then previewspreviewSwapExternalonly when the vault leg is nonzero. - Signed
afterSwapenforces each token'sPoolAssetRiskConfig.maxSettlementAbsDelta, records executed external settlement volume or all volume under the selected block-cap mode, callssettleSwapExternalwhen a vault leg is active, consumes a valid zero-vault signed quote otherwise, emits telemetry, and clears transient state. AllVolume mode also counts ordinary pool swaps.
Signed settlement mode rules:
- No signed quote supplied => pure AMM pass-through when
poolAllowedis true, with no vault rail. - Signed quote supplied and valid => signed quote settlement path.
- Signed quote supplied but invalid => revert; no same-transaction fallback to unsigned settlement.
Primary Modules
Swap Lifecycle Walkthrough
Layman-friendly 16-step breakdown of a hook-enabled swap.
HybridCollateralSettlementHook
Swap interception, pre-trade gating, and bounded post-trade settlement.
CollateralManager
Collateral/debt state transitions with oracle, cap, and solvency enforcement.
Failure Signals to Monitor
- Hook risk-gate errors such as
GlobalPaused,OraclePaused,PriceDeviationTooHigh, andBlockCapExceeded. - Settlement bound failures via
SettlementDeltaTooLarge. - Settlement callbacks are executed only via the authorized hook and are risk-checked by
HybridCollateralSettlementHook+CollateralManager. - Cap/debt failures from manager paths via
CapExceeded,DebtCeilingExceeded, orGlobalDebtCeilingExceeded.