EIPs Explained

ERC-7710 · Draft · ERC · 2024-05-20

ERC-7710: Smart Contract Delegation

A minimal interface that lets a smart account delegate bounded permissions to other contracts or EOAs, which redeem them through a Delegation Manager with one call.

What problem does it solve?

Smart accounts can do a lot, but letting someone else act on their behalf is clumsy. Today you either hardcode permissions, deploy a bespoke intermediary contract, or ask the user to sign every single action. That is painful for session keys, automated agents, subscriptions or "invite links" that should carry a limited capability.

ERC-7710 standardizes how a delegated permission is redeemed: one signature can create a long-lived, policy-constrained delegation, and any compliant Delegation Manager can verify it and execute the action from the delegator's account.

How it works

Roles:

  • Delegator: the smart account granting authority.
  • Delegate / redeemer: a contract or EOA allowed to use the delegation.
  • Delegation Manager: a contract implementing ERC7710Manager. It checks the delegation and then calls the delegator to execute. An account can be its own manager.

The delegate calls redeemDelegations with three equal-length arrays, read as tuples:

Array Meaning
_permissionContexts[i] Proof of authority; format chosen by each manager (e.g. a signed delegation chain)
_modes[i] ERC-7579 execution mode (single call, batch, ...)
_executionCallDatas[i] ERC-7579-encoded execution (target, value, calldata)

The function reverts on length mismatch and the whole batch is atomic. The delegator does not need any special interface; it only needs to trust the manager it issued permission contexts for, and to accept ERC-7579 style executions from it.

How delegations are requested and granted is out of scope; ERC-7715 is one way wallets can hand them out.

Sample code

The interface and a delegate redeeming a single call:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

interface ERC7710Manager {
    function redeemDelegations(
        bytes[] calldata _permissionContexts,
        bytes32[] calldata _modes,
        bytes[] calldata _executionCallDatas
    ) external;
}

contract Redeemer {
    bytes32 constant SINGLE_CALL = bytes32(0); // ERC-7579 mode: callType 0x00, execType 0x00

    function pull(ERC7710Manager mgr, bytes calldata ctx, address token, address to, uint256 amt) external {
        bytes[] memory ctxs = new bytes[](1);
        bytes32[] memory modes = new bytes32[](1);
        bytes[] memory execs = new bytes[](1);
        ctxs[0] = ctx;
        modes[0] = SINGLE_CALL;
        // ERC-7579 single execution: abi.encodePacked(target, value, callData)
        execs[0] = abi.encodePacked(token, uint256(0),
            abi.encodeWithSignature("transfer(address,uint256)", to, amt));
        mgr.redeemDelegations(ctxs, modes, execs);
    }
}

Things to know

  • Status: Draft. The interface has already changed once (from a single Action tuple to ERC-7579 executions).
  • There is no "check permission" view. Apps should simulate redeemDelegations first and request new permissions if it fails.
  • A delegation received earlier may be revoked, expire or become invalid; never assume it still works.
  • The spec points to the MetaMask Delegation Framework as a full implementation, with EIP-712 signed delegations, ERC-1271 signatures and caveat enforcers. Works with, but does not require, ERC-4337.
  • Security considerations are still marked "needs discussion"; audit any manager carefully.

#account-abstraction #delegation #permissions #smart-accounts

Details

Authors
Ryan McPeck (@McOso), Dan Finlay (@DanFinlay), Rob Dawson (@rojotek), Derek Chiang (@derekchiang)
Status
Draft
Type
Standards Track / ERC
Created
2024-05-20
Requires
Required by

Machine-readable: Markdown · JSON