{"id":33731207,"url":"https://github.com/MetaMask/delegation-framework","last_synced_at":"2025-12-09T15:00:40.262Z","repository":{"id":247538553,"uuid":"823822789","full_name":"MetaMask/delegation-framework","owner":"MetaMask","description":"The contracts that power the Delegation Framework","archived":false,"fork":false,"pushed_at":"2025-12-06T03:44:48.000Z","size":4720,"stargazers_count":167,"open_issues_count":26,"forks_count":84,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-08T09:54:19.367Z","etag":null,"topics":["4337","account-abstraction","delegation","metamask","smart-wallet","solidity","web3"],"latest_commit_sha":null,"homepage":"https://gator.metamask.io","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetaMask.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE2.md","code_of_conduct":null,"threat_model":null,"audit":"audits/cyfrin/cyfrin-3-25.pdf","citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":null,"open_collective":"metamask","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2024-07-03T19:44:33.000Z","updated_at":"2025-12-04T08:27:36.000Z","dependencies_parsed_at":"2024-07-09T09:14:03.935Z","dependency_job_id":"9b64fd1a-2a2d-4868-a14f-c2ff5b8cc24f","html_url":"https://github.com/MetaMask/delegation-framework","commit_stats":null,"previous_names":["metamask/delegation-framework"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/MetaMask/delegation-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaMask%2Fdelegation-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaMask%2Fdelegation-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaMask%2Fdelegation-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaMask%2Fdelegation-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetaMask","download_url":"https://codeload.github.com/MetaMask/delegation-framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaMask%2Fdelegation-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27621219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-09T02:00:09.185Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["4337","account-abstraction","delegation","metamask","smart-wallet","solidity","web3"],"created_at":"2025-12-04T15:00:44.093Z","updated_at":"2025-12-09T15:00:40.242Z","avatar_url":"https://github.com/MetaMask.png","language":"Solidity","readme":"# Delegation Framework\n\n\u003e [!WARNING]\n\u003e We use tags for audited versions of code releases and the `main` branch is the working development branch. All PRs should be based against `main` branch.\n\n### Getting Started\n\n1. **Fork the repository**:\n\n   - Click the \"Fork\" button at the top right of the repository page.\n\n2. **Clone your fork**:\n   ```shell\n   git clone https://github.com/\u003cyour-username\u003e/delegation-framework.git\n   ```\n3. **Create Working Branch**:\n   ```shell\n   git checkout -b feat/example-branch\n   ```\n\n# DeleGator Smart Account\n\nA DeleGator Smart Account is a 4337-compatible Smart Account that implements delegation functionality. An end user will operate through a DeleGatorProxy which uses a chosen DeleGator implementation.\n\n## Overview\n\nAn end user controls a DeleGator Proxy that USES a DeleGator Implementation, which IMPLEMENTS DeleGatorCore and interacts with a DelegationManager.\n\n### Delegations\n\nA Delegation enables the ability to share the capability to invoke some onchain action entirely offchain in a secure manner. [Caveats](#caveats) can be combined to create delegations with restricted functionality that users can extend, share or redeem.\n\nA simple example is \"Alice delegates the ability to use her USDC to Bob limiting the amount to 100 USDC\".\n\n[Read more on \"Delegations\" -\u003e](/documents/DelegationManager.md#Delegations)\n\n### DeleGator\n\nA DeleGator is the contract an end user controls and uses to interact with other contracts onchain. A DeleGator is an [EIP-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy contract that uses a DeleGator Implementation which defines the granular details of how the DeleGator works. Users are free to migrate their DeleGator Implementation as their needs change.\n\n### DeleGator Core\n\nThe DeleGator Core includes the Delegation execution and ERC-4337 functionality to make the Smart Account work.\n\n[Read more on \"DeleGator Core\" -\u003e](/documents/DeleGatorCore.md)\n\n### EIP7702 DeleGator Core\n\nThe DeleGator 7702 Core includes the Delegation execution and ERC-4337 functionality to make the Smart Account work but without UUPS proxy functionalities.\n\n[Read more on \"EIP7702 DeleGator Core\" -\u003e](/documents/EIP7702DeleGator.md)\n\n### DeleGator Implementation\n\nA DeleGator Implementation contains the logic for a DeleGator Smart Account. Each DeleGator Implementation must include the required methods for a DeleGator Smart Account, namely the signature scheme to be used for verifying access to control the contract. A few examples are the MultiSigDeleGator and the HybridDeleGator.\n\n[Read more on \"MultiSig DeleGator\" -\u003e](/documents/MultisigDeleGator.md)\n\n[Read more on \"Hybrid DeleGator\" -\u003e](/documents/HybridDeleGator.md)\n\n[Read more on \"EIP7702 Stateless DeleGator\" -\u003e](/documents/EIP7702DeleGator.md)\n\n### Delegation Manager\n\nThe Delegation Manager includes the logic for validating and executing Delegations.\n\n[Read more on \"Delegation Manager\" -\u003e](/documents/DelegationManager.md)\n\n### Caveat Enforcers\n\nCaveats are used to add restrictions and rules for Delegations. By default, a Delegation allows the delegate to make **any** onchain action so caveats are strongly recommended. They are managed by Caveat Enforcer contracts.\n\nDevelopers can build new Caveat Enforcers for their own use cases, and the possibilities are endless. Developers can optimize their Delegations by making extremely specific and granular caveats for their individual use cases.\n\n[Read more on \"Caveats\" -\u003e](/documents/DelegationManager.md#Caveats)\n\n### Security\n\nSee [Security Guidelines](/documents/Security.md) for security considerations.\n\n## Development\n\n### Third Party Developers\n\nThere's several touchpoints where developers may be using or extending a DeleGator Smart Account.\n\n- Developers can build custom DeleGator Implementations that use the [DeleGator Core](/src/DeleGatorCore.sol) or [EIP7702 DeleGator Core](/src/EIP7702/EIP7702DeleGatorCore.sol) to create new ways for end users to control and manage their Smart Accounts.\n- Developers can write any contract that meets the [DeleGator Core Interface](/src/interfaces/IDeleGatorCore.sol) to create novel ways of delegating functionality.\n- Developers can create custom Caveat Enforcers to refine the capabilities of a delegation for any use case they imagine.\n- Developers can craft Delegations to then share onchain capabilities entirely offchain.\n\n### Foundry\n\nThis repo uses [Foundry](https://book.getfoundry.sh/).\n\n#### Build\n\n```shell\nforge build\n```\n\n#### Test\n\n```shell\nforge test\n```\n\n#### Deploying\n\n1. Copy `.env.example` to `.env` and populate the variables depending on the deployment scripts that you will execute.\n\n```shell\nsource .env\n```\n\n2. For local testing, use [Anvil](https://book.getfoundry.sh/reference/anvil/) to run a local fork of a blockchain to develop in an isolated environment. Or obtain the RPC url for the blockchain to deploy.\n\n```shell\n# Example of a forked local environment using anvil\nanvil -f \u003cyour_rpc_url\u003e\n```\n\n3. Deploy the necessary contracts.\n\n\u003e NOTE: As this system matures, this step will no longer be required for public chains where the DeleGator is in use.\n\n```shell\n# Deploys the Delegation Manager, Multisig and Hybrid DeleGator implementations\nforge script script/DeployDelegationFramework.s.sol --rpc-url \u003cyour_rpc_url\u003e --private-key $PRIVATE_KEY --broadcast\n\n# Deploys all the caveat enforcers\nforge script script/DeployCaveatEnforcers.s.sol --rpc-url \u003cyour_rpc_url\u003e --private-key $PRIVATE_KEY --broadcast\n\n# Deploys the EIP7702 Staless DeleGator\nforge script script/DeployEIP7702StatelessDeleGator.s.sol --rpc-url \u003cyour_rpc_url\u003e --private-key $PRIVATE_KEY --broadcast\n\n# Deploys a MultisigDeleGator on a UUPS proxy\nforge script script/DeployMultiSigDeleGator.s.sol --private-key $PRIVATE_KEY --broadcast\n```\n\n### Deployments\n\n[Read more on \"Deployments\" -\u003e](/documents/Deployments.md)\n\n### Javascript\n\nCurrently in Gated Alpha phase. Sign up to be an early partner [here](https://gator.metamask.io).\n\n### Notes\n\n- We're building against Solidity [v0.8.23](https://github.com/ethereum/solidity/releases/tag/v0.8.23) for the time being.\n- Format on save using the Forge formatter.\n\n### Style Guide\n\n[Read more on \"Style Guide\" -\u003e](/documents/StyleGuide.md)\n\n### Core Contributors\n\n[Dan Finlay](https://github.com/danfinlay), [Ryan McPeck](https://github.com/McOso), [Dylan DesRosier](https://github.com/dylandesrosier), [Aditya Sharma](https://github.com/destroyersrt), [Hanzel Anchia Mena](https://github.com/hanzel98), [Idris Bowman](https://github.com/V00D00-child), [Jeff Smale](https://github.com/jeffsmale90), [Kevin Bluer](https://github.com/kevinbluer)\n\n## Relevant Documents\n\n- [EIP-712](https://eips.ethereum.org/EIPS/eip-712)\n- [EIP-1014](https://eips.ethereum.org/EIPS/eip-1014)\n- [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271)\n- [EIP-1822](https://eips.ethereum.org/EIPS/eip-1822)\n- [EIP-1967](https://eips.ethereum.org/EIPS/eip-1967)\n- [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337)\n- [EIP-7201](https://eips.ethereum.org/EIPS/eip-7201)\n- [EIP-7212](https://eips.ethereum.org/EIPS/eip-7212)\n- [EIP-7579](https://eips.ethereum.org/EIPS/eip-7579)\n- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702)\n- [EIP-7710](https://eips.ethereum.org/EIPS/eip-7710)\n- [EIP-7821](https://eips.ethereum.org/EIPS/eip-7821)\n","funding_links":["https://opencollective.com/metamask"],"categories":["Delegations"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetaMask%2Fdelegation-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMetaMask%2Fdelegation-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetaMask%2Fdelegation-framework/lists"}