# What is the proxy pattern in smart contracts?

URL: https://shield.quillaudits.com/learn/glossary/proxy-pattern/

The proxy pattern splits a contract in two: a proxy that holds the storage, the balance and the address users call, and an implementation that holds the code. The proxy forwards every call with [delegatecall](https://shield.quillaudits.com/learn/glossary/delegatecall/), so implementation code runs against proxy storage, and pointing the proxy at a new implementation upgrades the contract.

Last updated 3 December 2026. 2 minute read. By the QuillAudits Team.

## How does a proxy forward calls?

Its fallback function copies the calldata, delegatecalls the implementation and returns or reverts with whatever came back. ERC-1967 keeps the implementation address at the hash of `eip1967.proxy.implementation` minus one, a slot the compiler never gives to a variable, so the implementation can't overwrite it by accident ([ERC-1967](https://ercs.ethereum.org/ERCS/erc-1967)).

**A forwarding proxy using the ERC-1967 slot, with no upgrade function (illustrative, not audited code)** `ForwardingProxy.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract ForwardingProxy {
    bytes32 internal constant IMPLEMENTATION_SLOT =
        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    constructor(address implementation) {
        assembly { sstore(IMPLEMENTATION_SLOT, implementation) }
    }

    fallback() external payable { _delegate(); }

    receive() external payable { _delegate(); }

    function _delegate() internal {
        assembly {
            calldatacopy(0, 0, calldatasize())
            let ok := delegatecall(gas(), sload(IMPLEMENTATION_SLOT), 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch ok
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }
}
```

## Which proxy types are there?

| Type | Upgrade logic | Trade-off |
| --- | --- | --- |
| [Transparent](https://shield.quillaudits.com/learn/glossary/transparent-proxy/) | In the proxy, callable only by its admin | Admin calls never reach the implementation |
| [UUPS](https://shield.quillaudits.com/learn/glossary/uups-proxy/) | In the implementation | An implementation without it freezes the proxy |
| Beacon | In a beacon contract many proxies read | One upgrade moves every proxy |
| Minimal clone | None | Cheap copies of fixed code |

## What goes wrong with proxies?

- **Storage collisions.** A new implementation that reorders, removes or retypes variables reads old storage as something else.
- **Uninitialized implementations.** Constructors don't run in the context of the proxy, so setup moves to an `initialize` function. OpenZeppelin advises locking the implementation with `_disableInitializers` in its constructor ([OpenZeppelin](https://docs.openzeppelin.com/contracts/api/proxy)).
- **Upgrade keys.** Whoever can upgrade can replace all the code, so that power belongs behind a [multisig](https://shield.quillaudits.com/learn/glossary/multisig/) and a [timelock](https://shield.quillaudits.com/learn/glossary/timelock/).

## Sources

- [ERC-1967: Proxy Storage Slots, Ethereum Requests for Comment](https://ercs.ethereum.org/ERCS/erc-1967) · checked 3 December 2026
- [Proxies API, OpenZeppelin docs](https://docs.openzeppelin.com/contracts/api/proxy) · checked 3 December 2026
