Upgradeable Contract

Smart Contract Updated Jun 2026

What is an Upgradeable Contract?

An upgradeable contract is a smart contract whose code logic can be changed after it’s deployed on the blockchain. This is achieved through a proxy pattern: users interact with a proxy contract that delegates all function calls to an implementation contract. To upgrade, the admin changes which implementation the proxy points to.

Blockchain’s core promise is immutability — once deployed, code can’t change. Upgradeable contracts are a deliberate exception to this rule, trading immutability for flexibility.

How Upgradeable Contracts Work

User → Proxy Contract (storage + admin) → delegates to → Implementation V1

                                          Admin upgrades → Implementation V2

The proxy contract holds all state (user balances, settings, etc.) but contains no business logic. When a user calls a function on the proxy, it uses delegatecall to execute the corresponding function from the implementation contract. The implementation code runs within the proxy’s storage context.

The Delegatecall Risk

delegatecall executes another contract’s code using the caller’s storage. If the implementation contract’s storage layout differs from the proxy’s, variables get mixed up — balances can become corrupted. This is why storage layout compatibility is critical in upgradeable contracts.

Common Proxy Patterns

1. Transparent Proxy (EIP-1967)

The most widely used pattern. The proxy checks whether the caller is the admin:

  • Admin calls → go to proxy admin functions (upgrade, change admin)
  • User calls → forwarded to implementation

Used by: OpenZeppelin, most production protocols

2. UUPS (EIP-1822)

Upgrade logic lives in the implementation contract itself, not the proxy:

  • Simpler proxy (just delegatecall)
  • Upgrade function is in implementation, protected by access control
  • Smaller deployment cost

Risk: If an upgrade removes the upgrade function, the contract is permanently frozen.

3. Beacon Proxy

Multiple proxies share a single “beacon” that points to the current implementation:

  • Upgrade once → all proxies using that beacon are updated
  • Efficient for protocols with many contract instances

Used by: Uniswap V3 pools

Upgrade Risks

RiskDescriptionReal Example
CentralizationAdmin can change anything, including stealing fundsNumerous DeFi exploits via admin key
Storage collisionNew version corrupts existing state if layout changesMany near-misses in production
Rug vectorDeveloper upgrades to a malicious implementationMagnate Finance ($6.5M loss)
Timelock bypassIf upgrade isn’t timelocked, instant changes are possibleNomad Bridge exploit contributed by upgrade confusion

The Paradox of Upgradeability

PerspectiveView
Developer”We need upgrades for bug fixes and new features”
User”If they can change the code, they can steal my funds”
RealityBoth are right — the question is who controls the upgrade key

How to Evaluate Upgrade Risk

1. Who Controls Upgrades?

ControllerRisk LevelExamples
EOA (single key)CriticalMany small protocols
Multi-sig (3/5)MediumCommon in DeFi
DAO governance voteLowUniswap, Compound
Timelock + DAOLowestAave, MakerDAO
No upgrade pathNone (immutable)Uniswap V2 core

2. Check on Etherscan

  1. Find the proxy contract address
  2. Read the contract → look for admin() or implementation() functions
  3. Check “More” → “Is this a proxy?” → Etherscan shows the current implementation
  4. Check who the admin is — is it an EOA or a governance contract?

3. Read the Audit Report

Reputable audits specifically review upgrade mechanisms and access controls. Look for:

  • Is the upgrade path time-locked?
  • Who can propose upgrades?
  • What functions can be changed?

Frequently Asked Questions

Q: If a contract is upgradeable, is it unsafe? A: Not necessarily. Upgradeability adds risk proportional to how centralized the upgrade power is. A DAO-controlled, timelocked upgrade mechanism is far safer than a single-key admin, but risk is never zero.

Q: How do I check if a contract is upgradeable? A: On Etherscan, look for EIP-1967 admin slot (0x360894...). If it’s non-zero, the contract is a proxy. You can also check “Contract” → “More” → “Is this a proxy?”

Q: Can an upgrade steal user funds? A: Yes. If the admin upgrades to a malicious implementation that adds a withdrawAll() function, they can drain all user deposits. This has happened in multiple DeFi incidents.

Q: What’s the difference between UUPS and Transparent Proxy? A: Transparent Proxy handles admin/user separation in the proxy itself (more gas for users). UUPS puts upgrade logic in the implementation (cheaper for users, but harder to verify and risk of accidental lock).