Giter VIP home page Giter VIP logo

upgradablecontractsboilerplate's Introduction

Upgradable contracts boilerplate

Building smart contracts that are completely upgradable

This design was inspired by the talk Jorge Izquierdo gave at devcon3 link

Solidity smart contracts are immutable but as the technology is at a very early stage and contracts need to have feature/security upgrades some sort of upgradability mechanism is needed.

The way we are achieving upgradability is through the delegateCall functionality which can call from one contract to another, delegating all the storage and msg data with the call.

We can see in more detail how the system would work from the following diagram:

diagram

As you can see the user (your application) only needs to interact with the Relay contract, which will in turn forward all the call to the currently active Upgradable contract.

Manager will be used by the owner of the contract to set the new versions of the Upgradable contract which will be used by the Relay to call the correct contract. All the memory will be in the Relay contract so when upgrading to a new contract your data is not lost, just be careful when adding new data that you don't override the existing one (always add new variables at the end and be careful with structs and dynamic arrays)

upgradablecontractsboilerplate's People

Contributors

yippee-ki-yay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.