Skip to content

feat: experimental MetaSwap intent delegation manager - #206

Closed
hanzel98 wants to merge 7 commits into
mainfrom
feat/metaswap-intent-delegation-manager
Closed

feat: experimental MetaSwap intent delegation manager#206
hanzel98 wants to merge 7 commits into
mainfrom
feat/metaswap-intent-delegation-manager

Conversation

@hanzel98

@hanzel98 hanzel98 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Experimental purpose-specific MetaSwapIntentDelegationManager for two MetaSwap flows (not a drop-in for the generic DelegationManager).

Intent Product User signs Redeemer may change
ExactCalldata Gasless exact swap Full batch hash Nothing
FlexibleSettlement Limit order Economics + approval shape Route / aggregatorId only

Also includes experimental flexible-only prototypes (Hookless, ExecutionBuilder) for comparison.

Gas (approve + swap, EIP-7702, DirectECDSA)

Approach Gas
Generic ExactBatch + LimitedCalls(1) ~231k
Unified ExactCalldata ~159k (~31% cheaper)
Unified FlexibleSettlement / Hookless ~167k
Unified + ERC1271 +~1.9k vs DirectECDSA

Included

  • Contracts: intent manager + shared bases + two flexible prototypes
  • Docs: documents/MetaSwapSpecializedDelegationManagers.md
  • Tests: intent + specialized suites (100% line coverage on new manager contracts)
  • Deploy: script/DeployMetaSwapIntentDelegationManager.s.sol
  • Verify: script/verification/verify-metaswap-intent-delegation-manager.sh

Limits

  • One root delegation, one self-caveat, batch/default only
  • No chains / try-mode / pause / enableDelegation
  • Gasless expiry remains off-chain

Test plan

  • forge test --match-contract 'MetaSwapIntent|MetaSwapSpecialized'
  • forge coverage --match-contract 'MetaSwapIntent|MetaSwapSpecialized' --report summary (manager src files at 100% lines)
  • Dry-run deploy script with SIGNATURE_MODE=0
  • Confirm verify script reads META_SWAP_INTENT_DELEGATION_MANAGER_ADDRESS + SIGNATURE_MODE

Note

High Risk
New on-chain swap/limit-order authorization moves funds via approvals and MetaSwap routes with documented trust in delegates and balance-based min-output checks; specialized managers bypass generic caveat composition.

Overview
Adds experimental MetaSwap settlement paths alongside the generic delegation manager: a unified MetaSwapIntentDelegationManager (ExactCalldata gasless swaps vs FlexibleSettlement limit orders with redeemer-chosen routes), shared MetaSwapDelegationManagerBase, and flexible-only prototypes (Hookless, ExecutionBuilder). Also introduces alternate specialized managers (GaslessSwapDelegationManager, MetaSwapMinimalDelegationManager) that reuse existing enforcers or inline enforcement for EIP-7702 swap/limit-order profiles.

New caveat enforcers cover MetaSwap batch shapes and settlement economics— notably MetaSwapFlexibleSettlementEnforcer (one-shot consumption, min output, retry on revert)— plus MetaSwap7702CalldataEnforcer, batch/calldata validators, and adapter/prefund variants. DeployCaveatEnforcers deploys the flexible settlement enforcer; new deploy/verify scripts and META_SWAP_INTENT_DELEGATION_MANAGER_ADDRESS env support the intent manager. Docs describe terms encoding, trust assumptions, gas comparisons, and limitations.

Broad Foundry test suites exercise redemption, replay/cancel, signature modes, insufficient output retry behavior, and gas benchmarks vs generic enforcer stacks.

Reviewed by Cursor Bugbot for commit 50169ec. Bugbot is set up for automated code reviews on this repo. Configure here.

Authorize one open-route MetaSwap settlement with exact input constraints, signed approval flexibility, minimum output, and atomic one-shot consumption.
Support exact-calldata gasless swaps and flexible limit-order
settlements in one hookless manager, with gas benchmarks against
the generic ExactBatch+LimitedCalls and FlexibleSettlement paths.
Introduce a purpose-specific manager for ExactCalldata gasless swaps and
FlexibleSettlement limit orders, with prototype managers, docs, deploy
and verify scripts, and ~100% line coverage on the new contracts.
@hanzel98
hanzel98 requested a review from a team as a code owner September 9, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant