2

I understand one of the best ways to make your contracts upgradeable is to separate into 3 separate contracts and send via delegate call from the proxy to the functional contract. The design is usually...

1.)Proxy contract (the one the users interact with) 2.)Functional contract (This holds all the app logic) 3.)Storage contract- holds strorage variables & data (both the proxy functional contracts inherit from the storage contract)

Anyone know of any projects on Mainnet ETH that have a similar contract design? Or can you recommend any resources that discuss how to implement this kind of upgradeability? Or is there any Open Zepp standard library contracts that help with this? Thanks

1 Answer 1

2

you are describing: upgradable storage proxy contracts

... The proxy contract, as well as the logic contract, will inherit the same storage contract so that their storage references align in the EVM. The proxy contract will have a fallback function that will delegate call the logic contract so that the logic contract can make changes in the storage of the proxy. The proxy contract will be eternal. This saves us the gas required for multiple calls to the storage contract as now, only one delegate call is needed no matter how many changes made in the data.

There are three components of this technique

Proxy contract: It will act as eternal storage and delegate call the logic contract.

Logic contract: It will do all the processing of the data.

Storage structure: It contains the storage structure and is inherited by both proxy and logic contracts so that their storage pointers remain in sync on the blockchain.

enter image description here

read more here

take a look at this article and this one that describe what are the key differences between three patterns in terms of handling storage collision.

  1. Inherited Storage
  2. Eternal Storage
  3. Unstructured Storage

there are plugins that you can use with tuffle and hardhat take a look at this link

The plugins support the UUPS, transparent, and beacon proxy patterns.

and Openzeppelin Proxy patterns

3
  • ooh. I like that
    – sola24
    Jun 15 at 16:36
  • Thank you for the response and links. Since you seem pretty knowledgable on the subject i am wondering if you know of any projects running on Ethererum that use an upgradeable proxy storage pattern? I am hoping to find an example of a project that uses it so I can see all the smart contracts & code on Etherescan or elsewhere so I can see how it all works together? Thanks again.
    – Blockpain
    Jun 16 at 14:50
  • you can find a good exaple here: github.com/OpenZeppelin/openzeppelin-labs/tree/master/… Jun 16 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.