Ethereum-Solidity Quiz Q2: What is a proxy in Solidity?
Source: Dev.to
What is a proxy in Solidity?
A proxy in Solidity is a design pattern used to enable contract upgradability. This is important because smart contract code is immutable once deployed on the blockchain.
A proxy is a smart contract that stores state variables while delegating all its logic to one or several implementation contracts. When the proxy receives a call, it forwards it to the logic contract using a low‑level delegatecall, which executes the code from the implementation contract but within the context (storage, msg.sender, msg.value, etc.) of the proxy contract itself.
Basic upgradeable architecture
- Proxy contract – Stores the state and delegates calls to the implementation.
- Implementation contract – Contains the actual logic.
- Admin – A separate address (or multisig, even better) that can upgrade the implementation contract address stored in the proxy.
Common proxy patterns
- UUPS (Universal Upgradeable Proxy Standard) – The upgrade logic resides in the implementation contract.
- Transparent Proxy – Uses a more complex pattern to avoid function selector conflicts between admin and user functions.
- Beacon Proxy – Multiple proxies can point to a single beacon contract that holds the implementation address.