feat: experimental MetaSwap intent delegation manager - #206
Closed
hanzel98 wants to merge 7 commits into
Closed
Conversation
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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Experimental purpose-specific
MetaSwapIntentDelegationManagerfor two MetaSwap flows (not a drop-in for the genericDelegationManager).aggregatorIdonlyAlso includes experimental flexible-only prototypes (
Hookless,ExecutionBuilder) for comparison.Gas (
approve + swap, EIP-7702, DirectECDSA)Included
documents/MetaSwapSpecializedDelegationManagers.mdscript/DeployMetaSwapIntentDelegationManager.s.solscript/verification/verify-metaswap-intent-delegation-manager.shLimits
enableDelegationTest plan
forge test --match-contract 'MetaSwapIntent|MetaSwapSpecialized'forge coverage --match-contract 'MetaSwapIntent|MetaSwapSpecialized' --report summary(manager src files at 100% lines)SIGNATURE_MODE=0META_SWAP_INTENT_DELEGATION_MANAGER_ADDRESS+SIGNATURE_MODENote
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), sharedMetaSwapDelegationManagerBase, 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)— plusMetaSwap7702CalldataEnforcer, batch/calldata validators, and adapter/prefund variants.DeployCaveatEnforcersdeploys the flexible settlement enforcer; new deploy/verify scripts andMETA_SWAP_INTENT_DELEGATION_MANAGER_ADDRESSenv 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.