---
eip: 3448
label: ERC-3448
title: MetaProxy Standard
status: Final
type: Standards Track
category: ERC
created: 2021-03-29
official: https://eips.ethereum.org/EIPS/eip-3448
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3448.md
canonical: https://eips.huatuo.xyz/eip-3448/
lang: en
tldr: "A minimal DELEGATECALL proxy whose bytecode ends with immutable metadata that gets appended to every call's calldata, giving cheap clones with per-instance parameters and no storage reads."
tags: [proxy, clones, bytecode, gas, factory]
---

# ERC-3448: MetaProxy Standard

> A minimal bytecode implementation for creating proxy contracts with immutable metadata attached to the bytecode

**TL;DR:** A minimal DELEGATECALL proxy whose bytecode ends with immutable metadata that gets appended to every call's calldata, giving cheap clones with per-instance parameters and no storage reads.

## What problem does it solve?

Factories often deploy many copies of the same logic with different parameters: one vault per token, one pool per pair. [ERC-1167](/eip-1167/) minimal proxies make the copies cheap, but every instance then has to store its parameters in storage via an `init` call and read them back with `SLOAD` on every use.

ERC-3448 (MetaProxy) puts those parameters in the proxy's **bytecode** instead. They are fixed at deploy time, cost nothing to read from storage, and tools like block explorers can recognise the proxy and show its target and metadata.

## How it works

The proxy is a fixed 54-byte runtime code with the target address patched in:

```
363d3d373d3d3d3d60368038038091363936013d73<20-byte target>5af43d3d93803e603457fd5bf3
```

After those 54 bytes comes arbitrary metadata, and the **last 32 bytes** of the code hold the metadata length:

```
<54 bytes MetaProxy> <metadata> <uint256 metadata length>
```

On every call the proxy:

1. Copies the incoming calldata to memory.
2. Copies everything after the 54-byte header (metadata plus its length word) right after it.
3. `DELEGATECALL`s the target with that combined buffer.
4. Returns or reverts with the target's return data.

So inside the implementation, the last 32 bytes of `calldata` are the metadata length, and the metadata sits just before them. Revert reasons bubble up unchanged.

## Sample code

Reading the metadata inside the implementation contract (adapted from the spec's examples):

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

contract Vault {
    /// Decodes metadata appended by the MetaProxy to the calldata.
    function _metadata() internal pure returns (address token, uint256 fee) {
        bytes memory data;
        assembly {
            let posOfSize := sub(calldatasize(), 32)
            let size := calldataload(posOfSize)
            let start := sub(posOfSize, size)
            data := mload(0x40)
            mstore(0x40, add(data, add(size, 32)))
            mstore(data, size)
            calldatacopy(add(data, 32), start, size)
        }
        return abi.decode(data, (address, uint256));
    }

    function feeBps() external pure returns (uint256 fee) {
        (, fee) = _metadata();
    }
}
```

A factory would deploy a proxy for each instance with metadata `abi.encode(token, fee)`. The spec's reference `MetaProxyFactory` provides helpers like `_metaProxyFromBytes(target, bytes)`.

## Things to know

- Status is **Final**.
- Because metadata is appended to calldata, functions in the implementation see extra trailing bytes. Normal ABI decoding ignores them, but code that checks `msg.data.length` or uses raw calldata must account for it.
- Calling the implementation contract directly (not through a proxy) means there is no metadata, so `_metadata()` would read garbage. Guard against direct use where it matters.
- Metadata is immutable. Anything that must change later still belongs in storage.
- The spec says its reference implementation is only an example; research the side effects for your design and get it audited.


---

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