1. Minimal Proxy (EIP-1167)
A Minimal Proxy contract is designed for creating multiple lightweight copies of a contract (clones), without redeploying the entire contract logic each time.
Key Idea
- Imagine you have a Wallet contract or Escrow contract with certain logic.
- Many users want to use this wallet, but you don't want to deploy the same full contract for every user because:
- It is expensive (high gas fees).
- The logic is the same for all users.
Solution:
- Deploy the original contract (the logic contract) once.
- For each new user, deploy a small proxy (clone) that:
- Delegates calls to the main logic contract.
- Has its own storage and state variables, so each user’s data is separate.
This clone contract is extremely small (only contains a few opcodes) and is called minimal because it:
- Does not duplicate logic.
- Only forwards calls to the main contract using
DELEGATECALL.
How it works
-
When a user calls a function on the clone contract, the call is delegated to the logic contract.
-
The logic (code) of the logic contract is used.
-
The storage (state) remains inside the clone contract.
So, each user’s clone has its own data.
Why use Minimal Proxy?