Service
DeFi Protocol Upgradeability — UUPS Proxy, Timelocks, and Governance Integration
Choosing whether and how to make your DeFi protocol upgradeable is one of the most consequential architectural decisions. Upgradeable contracts fix bugs but introduce governance attack surface. Immutable: Users trust what they audited. No upgrade mechanism means no upgrade mechanism attack surface. Bugs cannot be patch...
// Implementation contract (contains logic + upgrade function) import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; contract ProtocolV1 is UUPSUpgradeable, OwnableUpgradeable { // Storage variables MUST maintain same la...
1. Developer proposes upgrade (new implementation contract deployed) 2. On-chain governance proposal submitted: 'Upgrade proxy 0x... to implementation 0xNew...' 3. Community votes (3-day voting period) 4. If quorum (4% of supply) and majority: proposal passes 5. TimelockController enforces 48-hour delay 6. After 48 hou...
The most common upgrade bug: storage collision. When V2 introduces a new variable at an existing slot, it overwrites existing data.
// WRONG: V2 adds variable before existing storage contract ProtocolV2_WRONG is ProtocolV1 { uint256 public newVariable; // COLLIDES with totalDeposits slot! // totalDeposits is now 0, newVariable reads user's former totalDeposits } // CORRECT: V2 adds variable after existing storage contract ProtocolV2_CORRECT is Prot...
Common integrations: The Graph, Alchemy/Infura, OpenZeppelin Defender, and popular wallet providers.
Clarify requirements, compliance needs, architecture risks, and launch goals.
Implement core contracts, integrations, product flows, tests, and deployment automation.
Run QA, prepare audit handoff, deploy infrastructure, and support production rollout.
No — proxy upgrades change the implementation for all users simultaneously without their individual consent. This is why: (1) the upgrade governance process must be transparent and well-documented, (2) the timelock allows users to exit if they disagree with an upgrade, (3) some protocols provide 'emergency exit' functions that allow users to withdraw assets even if the protocol is paused.
Schedule a discovery call and receive a tailored scope and estimate. No commitment required.