How metamask/delegation-framework works
• User/Client – represents the end user initiating transactions and delegations.
• DeleGator Proxy (Smart Account) – acts as an ERC-1967 proxy that forwards interactions to the chosen implementation.
• DeleGator Implementations – include multiple variants (e.g., MultiSigDeleGator, HybridDeleGator, EIP7702 Stateless) that encapsulate the business logic for handling the smart account operations.
• DeleGator Core / EIP7702 Core – contain the core delegation execution logic and ERC-4337 functionalities.
• Delegation Manager – validates and executes delegation instructions, ensuring secure off-chain delegation execution.
• Caveat Enforcers – plugins (external contracts) that apply rules and restrictions to delegated operations.
• Supporting Libraries and Interfaces – include the various libraries (e.g., SCL, FCL, OpenZeppelin contracts) and interfaces used throughout the system.
• Deployment/Verification Scripts – although not part of runtime, include the “script” directory components to show the presence of automated workflows and deployment steps.
Out the relationships and interactions
• The user interacts with the DeleGator Proxy.
• The Proxy delegates calls to the underlying DeleGator Implementation—this is an upgradeable contract model following the EIP-1967 proxy pattern.
• The Implementation leverages either the DeleGator Core or the EIP7702 variant to process delegations.
• The Delegation Manager is used by the DeleGator Core to coordinate and execute delegation logic.
• Caveat Enforcers are used by both the Delegation Manager and the implementation layer to ensure that any invoked delegation complies with restrictions.
• Supporting libraries and interfaces underpin and standardize interactions between these components.
Architectural patterns and design principles
• Use of the Proxy pattern (EIP-1967) to allow upgradeability by decoupling storage from logic.
• Modular design with clear separation between core delegation logic, implementation variations, and enforcement of security restrictions.
• Emphasis on extensibility so that developers can build custom implementations and caveat enforcers.
• Incorporation of development/testing tools (Foundry, anvil, Forge build scripts) shown in the “script” and “lib” directories.
Details
• Use of Foundry for building, testing, and deploying (supported by the “foundry.toml” and various scripts).
• Optionally, indicate the file structure groupings (for example, under “src” for main contracts, “lib” for imported libraries, “test” for test suites, and “script” for deployment/verification scripts).
• That each component is clearly named and has a brief description of its role.