Skip to content

Repository files navigation

Proxy Patterns

A comprehensive reference implementation of major EVM proxy patterns with unified test specifications.

Patterns

PatternEIPKey Mechanism
Transparent ProxyEIP-1967Admin-gated fallback routing via msg.sender check
UUPSEIP-1822 + EIP-1967Upgrade logic in implementation; immutable __self guard
Beacon ProxyEIP-1967Fleet of proxies reading implementation from a shared beacon
ClonesEIP-116745-byte delegating bytecode via CREATE / CREATE2

Project Structure


proxy-patterns/
├── src/
│ ├── clone/
│ │ └──	Clones.sol
│ ├── ERC1967/
│ │ ├──	beacon/
│ │ │ ├── BeaconProxy.sol
│ │ │ └── UpgradeableBeacon.sol
│ │ ├──	transparent/
│ │ │ ├── ProxyAdmin.sol
│ │ │ └── TransparentUpgradeableProxy.sol
│ │ ├──	uups/
│ │ │ ├── UUPSProxy.sol
│ │ │ └── UUPSUpgradeable.sol
│ │ ├──	ERC1967Proxy.sol
│ │ └──	ERC1967Utils.sol
│ ├── diamond/
│ │ │ faces/
│ │ │ ├── DiamondCutFacet.sol
│ │ │ ├── DiamondLoupeFacet.sol
│ │ │ └── OwnershipFacet.sol
│ │ ├── interfaces/
│ │ │ ├── IDiamondCut.sol
│ │ │ ├── IDiamondLoupe.sol
│ │ │ └── IERC173.sol
│ │ ├── Diamond.sol
│ │ └── LibDiamond.sol
│ ├── utils/
│ ├── Initializable.sol
│ └── Ownable.sol
├── test/
├── script/
└── foundry.toml

Usage

Build

$ forge build

Test

$ forge test

Gas Snapshots

$ forge snapshot

Deploy

$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>

About

A comprehensive reference implementation of major EVM proxy patterns with unified test specifications

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages