Giter Site home page Giter Site logo

Versioning about motoro HOT 3 OPEN

blockchain-iot avatar blockchain-iot commented on May 22, 2024
Versioning

from motoro.

Comments (3)

jaszczw avatar jaszczw commented on May 22, 2024

There is a couple of ways of achieving that:

You can use delegatecall available in solidity that will call a method in another smart contract together with changeable variable currentVersionAddress we can call 'current' version of the contract from our 'proxy'.

example from https://github.com/shaunazzopardi/smart-contract-versioning called 'Proxy/Interface method'


    address currentVersion = <someAddress>;
    
    <type> <varName>;
    function <methodName>() public returns(<type>){
        if(currentVersion.delegatecall(msg.data)){
            returns <varName>;
        }
        else{
            revert();
        }
    }

Only Owner of the contract can modify the currentVersionAddress.

In more details it concept is explained on https://ethereum.stackexchange.com/questions/2404/upgradeable-smart-contracts

One of the limits of that approach is that you can have only variables available in the original contract, meaning you would have to either know a priori what will you require or provide a magic map of anything.

Sources:

  1. https://github.com/shaunazzopardi/smart-contract-versioning
  2. https://ethereum.stackexchange.com/questions/2404/upgradeable-smart-contracts
  3. https://forum.ethereum.org/discussion/4595/versioning-of-smart-contracts

from motoro.

michalmikolajczyk avatar michalmikolajczyk commented on May 22, 2024

Versioning best practices
https://blog.zeppelin.solutions/proxy-libraries-in-solidity-79fbe4b970fd
https://medium.com/rocket-pool/upgradable-solidity-contract-design-54789205276d

from motoro.

michalmikolajczyk avatar michalmikolajczyk commented on May 22, 2024

Consider moving to Zeppelin OS https://docs.zeppelinos.org/docs/start.html

from motoro.

Related Issues (20)

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.