ERC-8349 · Draft · ERC · 2026-07-25
ERC-8349: Index-Based Multi-Facet Proxy
A multi-facet proxy design ('Cento') that routes calls by a one-byte facet index appended to calldata instead of by function selector, so routing data scales with modules rather than functions.
What problem does it solve?
Multi-facet proxies such as ERC-2535 Diamonds (and the simpler ERC-8167) keep one contract address but split logic across many "facets". They decide which facet runs by looking up the 4-byte function selector. That means:
- the routing table grows with every exported function, not with the number of modules;
- every upgrade has to update entries selector by selector, even when a whole facet is swapped;
- independently written facets must never expose the same selector.
ERC-8349 argues that "which module runs" and "which function is called" are separate concerns, and gives facets an explicit identity of their own.
How it works
The proposal calls its routing model Cento. The proxy ("router") supports two paths:
- Protocol Routing. The caller appends one byte, a routing index from 0 to 255, to the end of the calldata. The router reads it, looks up the facet in its routing table, strips the byte and
delegatecalls the facet with the original calldata. The facet sees a normal call, so existing Solidity code works unchanged, and selectors only need to be unique within a facet. - Compatibility Routing. Standard interfaces that wallets and tools call without an index (for example ERC-165
supportsInterfaceor ERC-173owner) are recognised by selector and mapped to the right index. How the router tells the two paths apart is implementation-specific; the spec's example uses odd vs. even calldata length.
Management and introspection:
atomicUpdate(setF, addI, remI, migrator, data)installs, replaces or removes facets, registers or unregisters ERC-165 interface IDs and optionally runs a storage migration viadelegatecall, all or nothing, and emitsAtomicUpdate.IObservabilityexposesgetFacets,getFacetEntries,getFacetAt,getFacetCountandgetFirstFreeSlot.- Routers start with three core facets: index 0 facet manager, index 1 ownership, index 2 ERC-165 plus observability.
Sample code
Calling a protocol function through the router by appending the facet index (ethers v6):
import { Interface, concat, toBeHex, Contract } from "ethers";
const vaultFacet = new Interface(["function deposit(uint256 amount)"]);
const VAULT_INDEX = 3; // routing index assigned to this facet
const data = concat([
vaultFacet.encodeFunctionData("deposit", [1_000n]),
toBeHex(VAULT_INDEX, 1), // one trailing routing byte
]);
await signer.sendTransaction({ to: ROUTER, data });
// Compatibility path: no index byte, plain selector call
const router = new Contract(ROUTER, ["function getFacetAt(uint8) view returns (address)"], provider);
console.log(await router.getFacetAt(VAULT_INDEX));
Things to know
- Status: Draft.
- Calls through Protocol Routing need the extra byte, so generic tooling that only knows the facet ABI will not reach those functions unless it appends the index.
- Routers should reject EOAs, code-less addresses and EIP-7702 delegated EOAs as facets (the reference implementation checks for the
0xef0100prefix), and must never delegate toaddress(0)or themselves. - Empty calldata must not reach the fallback; stripping an index from zero bytes can underflow and burn all gas. Provide a
receive()or an explicit length check. - Gate
atomicUpdatewith strong access control, consider time-locks, and use namespaced storage such as ERC-7201 to avoid facet storage collisions. - It is not compatible with selector-based Diamonds; both models are intended to coexist.