Repository navigation
Conversation
ff660b3 to
7995fa6
Compare
6ac8476 to
4049a6b
Compare
Authorize one open-route MetaSwap settlement with exact input constraints, signed approval flexibility, minimum output, and atomic one-shot consumption.
Fold RedeemerEnforcer, TimestampEnforcer, IdEnforcer, and ERC20/Native balance-change semantics into MetaSwapFlexibleSettlementEnforcer so one MetaSwap-router caveat can settle native or ERC-20 swaps (optional approval) with an allowlisted redeemer. Timestamp bounds of zero disable time checks; id zero keeps hash-based one-shot consumption while a non-zero id uses the per-delegator bitmap for mutual exclusion.
e40716c to
1455eac
Compare
The id bitmap already rejects a replay and any sibling order that shares it, so the hash one-shot is unused.
GasEstimated transaction gas: Calldata-pinned dual-root is the stacked-enforcer baseline on
Calldata-pinned dual-root — how the delegations are builtTwo root delegations in one redemption (native input: swap root only). Approval uses id Approval root (ERC-20 in only; single
Swap root (always single
This pins the same settlement fields the flexible enforcer encodes in terms ( |

Summary
MetaSwapFlexibleSettlementEnforcer: MetaSwap-router caveat for one native/ERC-20 swap (optional approve / reset-approve).ApprovalModepins the batch shape; routeaggregatorId/datastay redeemer-selected.Combined behavior
MetaSwap.swap± approval legs (BATCH_DEFAULT_MODE)tokenOutMin(tokenOut == address(0)→ native)0disables a bound (non-inclusive, likeTimestampEnforcer)(manager, delegator, id)blocks a replay and any sibling order that shares the idNative input requires
None; ERC-20 requiresSkipApproval/Approve/ResetApprove. Failed fills roll back the id.Terms
Approve spender / swap token words must be canonical ABI addresses. Swap calldata ≥ 196 bytes.
Security
Trust MetaSwap, adapters, and redeemer-chosen routes. Min output can be met by any balance increase. Residual allowance may remain. Input ≠ output.
Deployment
script/DeployCaveatEnforcers.s.sol· verify viascript/verification/verify-enforcer-contracts.shNote
Medium Risk
New settlement path touches approvals, swaps, and balance-based min-output checks with unrestricted routes and known gaming vectors (any balance increase counts); extensive tests mitigate but delegators must understand trust assumptions.
Overview
Adds
MetaSwapFlexibleSettlementEnforcer, a single caveat that authorizes one MetaSwap-router settlement in batch default mode while folding several policies into packedterms.Signed terms pin the router, input amount, output recipient, minimum balance increase (ERC-20 or native when
tokenOut == address(0)), a required redeemer allowlist, and anApprovalModethat fixes batch shape: native-only swap, or ERC-20 swap with skip / approve / reset-approve legs. Swap validation checks target, value, selector, token word, and amount; routeaggregatorId/datastay redeemer-chosen.One-shot consumption uses a required non-zero
id. An IdEnforcer-style bitmap per(manager, delegator)blocks a replay and any replacement order that shares the id. Optional timestamp bounds mirrorTimestampEnforcer.afterHookcompares recipient balance delta totokenOutMin; failed redemptions revert atomically so the id bit rolls back.Also wires CREATE2 deploy in
DeployCaveatEnforcers.s.sol, documents terms/trust assumptions inCaveatEnforcers.md(plus minor doc table formatting), and adds broad Foundry coverage including end-to-end redemption throughDelegationManager.Reviewed by Cursor Bugbot for commit 1455eac. Bugbot is set up for automated code reviews on this repo. Configure here.