tennisonchan / brownie-contract-upgrades

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brownie Contract Upgrades

Showcasing how to use proxy, TransparentUpgradeableProxy to achieve upgrading the contracts

  • Smart contracts are immutable but it can be "mutable" for upgrade or bug fixing
  • 3 methods for upgrading:
    • Parameterize
    • Migration
    • Proxies

Parameterization

Migration

Proxies

  1. Implementation contract, has all the protocols. we launch a new implementation contract when we upgrade
  2. Proxy contract, which points to the implementation contract
  3. User, making calls to the proxy contract
  4. Admin, who can upgrade the contract

Potential Issues

  • Storage clashes
    • Delegated function only storage value based on position, not by variable name
  • Function selector clashes
    • The clashes of the functions with the same function selector in both implement contract and the proxy contract

Transparent Proxy Pattern

Universal Upgradable Proxies (UUPS)

  • AdminOnly upgrade functions are in implementation contract
  • Saving Gas
  • Proxy contract is smaller

Diamond Proxies, Multi-Facet Proxy

About


Languages

Language:Solidity 58.9%Language:Python 40.6%Language:Shell 0.5%