Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 2.31 KB

DeleGatorCore.md

File metadata and controls

28 lines (17 loc) · 2.31 KB

DeleGator Core

Defines the interface needed for a DelegationManager to invoke an Execution on behalf of the delegator.

This contract does not implement ERC7579 see ERC-7579 Details.

MetaMask's DeleGatorCore

Contains the logic needed for an ERC4337 SCA with delegation functionality. We provide two different "DeleGator implementations" for use: MultiSigDeleGator and HybridDeleGator. The distinction between the two is the signing mechanisms.

The DeleGatorCore implements the UUPS proxy, which is inherited by the implementations. There are two methods available to upgrade your account to a different implementation.

  • upgradeToAndCall - This method upgrades the account to a different implementation, and by default will clear the storage associated with the account's signer configuration.
  • upgradeToAndCallAndRetainStorage - This method upgrades the account to a different implementation and retains the storage associated with the account's signer configuration.

Signing a UserOperation

Contracts that extend the DeleGatorCore contract MUST use EIP712 typed data signatures for User Operations to provide legibility when signing. The typed data to be signed is a PackedUserOperation.

Rules

  • A DeleGator Implementation MUST use namespaced storage for ALL variables if it is extending MetaMask's DeleGatorCore.
  • DeleGator Implementations MUST inherit from DeleGatorCore as the "most base-like" (furthest right, more info)
  • DeleGator Implementations MUST implement ERC-1271 Standard Signature Validation Method for Contracts
  • DeleGator Implementations SHOULD return a non ERC-1271 magic value when encountering an invalid signature
  • DeleGator Implementations SHOULD implement a function to clear the storage related to the account's signer configuration, inside the function _clearDeleGatorStorage.

NOTE: If a DeleGator Implementation implements reinitialize it SHOULD gate the method to onlySelf to ensure no one can unexpectedly take over the DeleGator.