UUPS ERC-1822 Proxy Contract Implementation
Posted on Fri 21 April 2023 in tech
Universal Upgradeable Proxy Standard UUPS ERC-1822 Tutorial and Complete Working Example
The first time I had to implement a UUPS proxy I found no clear example anywhere on the Internet. There are many trial implementations and even builders that enable one to implement a proxy in the background. It is impossible to achieve a clear understanding of the ERC-1967 proxy and UUPS proxy without a clean example. I am providing the complete source code for the proxy pattern that I use on GitHub
UUPS is a smart contract design pattern that allows for upgrading smart contracts without breaking their dependencies. When using a UUPS contract the logic contract determines if it should be upgradeable in a given instance rather than assigning that role to the proxy itself. There is a unique storage slot in the proxy contract to store the address of the logic contract. The UUPS proxies are implemented using an ERC1967Proxy. The logic contract provides the delegated implementation bytecode for particular calls, however the data is stored in slots in the proxies address space. In this way the delegated logic can be upgraded while state data may remain stable over time.