---
eip: 8167
label: ERC-8167
title: Modular Dispatch Proxies
status: Final
type: Standards Track
category: ERC
created: 2026-02-16
official: https://eips.ethereum.org/EIPS/eip-8167
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8167.md
canonical: https://eips.huatuo.xyz/eip-8167/
lang: en
tldr: "A minimal standard for proxies that route each function selector to its own logic module via delegatecall, with two view functions so tools can discover the proxy's ABI and upgrade history."
tags: [proxy, upgradeability, delegatecall, modular, standard]
---

# ERC-8167: Modular Dispatch Proxies

> Proxy-level function dispatch via delegatecall

**TL;DR:** A minimal standard for proxies that route each function selector to its own logic module via delegatecall, with two view functions so tools can discover the proxy's ABI and upgrade history.

## What problem does it solve?

Most proxy contracts forward every call to a single implementation contract. That works, but has limits:

- A big monolithic implementation can hit the contract code size limit.
- Upgrading means swapping the whole implementation at once, which is risky and hard to verify.
- Contracts that share most of their logic (say, two tokens with the same balance code but different metadata) still need fully separate implementations.

The alternative, routing different functions to different logic contracts, already exists in [ERC-2535](/eip-2535/) "Diamonds". ERC-8167 standardizes the same idea with a much smaller surface and without the diamond terminology, so explorers, wallets and indexers can reliably work out what such a proxy does.

## How it works

- A **dispatch proxy** reads the first four bytes of calldata (the function selector), looks up the **delegate** (logic module) registered for it, and `delegatecall`s that delegate with the full calldata.
- Two view functions are **required**:
  - `implementation(bytes4 selector)` returns the delegate for a selector, or `address(0)` if none.
  - `selectors()` returns all selectors that have an implementation.
- **Recommended:** emit `SelectorDelegated(selector, delegate)` whenever a mapping changes (`address(0)` means removed), and revert with `FunctionNotFound(selector)` for unknown selectors.
- The introspection functions should themselves be implemented by delegates, not hard-coded in the proxy, and the constructor should install at least one delegate.

The standard deliberately does **not** define an upgrade function or a storage layout; those are left to implementations or later standards. Removing the upgrade selectors turns an upgradeable proxy into an immutable one.

To rebuild a proxy's ABI, a tool calls `selectors()`, maps each to `implementation(selector)`, and pulls the verified ABI of each unique delegate.

## Sample code

The interface and a bare-bones dispatch fallback (no admin logic, illustration only):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC8167 {
    event SelectorDelegated(bytes4 indexed selector, address indexed delegate);
    error FunctionNotFound(bytes4 selector);
    function implementation(bytes4 selector) external view returns (address);
    function selectors() external view returns (bytes4[] memory);
}

contract DispatchProxy {
    mapping(bytes4 => address) internal delegates; // use a namespaced slot in practice

    fallback() external payable {
        address target = delegates[msg.sig];
        if (target == address(0)) revert IERC8167.FunctionNotFound(msg.sig);
        assembly {
            calldatacopy(0, 0, calldatasize())
            let ok := delegatecall(gas(), target, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            if iszero(ok) { revert(0, returndatasize()) }
            return(0, returndatasize())
        }
    }
}
```

## Things to know

- **Status: Final.**
- Upgrade functions need access control; the standard leaves the design to you.
- Delegates should never be able to self-destruct, or they can break every proxy using them.
- All delegates share the proxy's storage. Use one common base storage layout, or namespaced storage such as [ERC-7201](/eip-7201/) or [ERC-8042](/eip-8042/), to avoid collisions.
- Existing single-implementation proxies can migrate by populating a selector-to-delegate map and then switching to a dispatch implementation. Modular designs also suit [EIP-7702](/eip-7702/) delegated EOAs.
- A related draft, [ERC-8349](/eip-8349/), explores an index-based variant of the multi-facet proxy.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8167
