Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning #16

Open
patrykmat opened this issue Feb 20, 2018 · 3 comments
Open

Versioning #16

patrykmat opened this issue Feb 20, 2018 · 3 comments
Assignees

Comments

@patrykmat
Copy link
Contributor

Feature request

As a CTO
I want to be able to upload different versions of the smart contracts
then I expect to have an additional smart contract
Where I can redirect all requests from the old version of contract to a new one

@jaszczw
Copy link

jaszczw commented Feb 20, 2018

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

@michalmikolajczyk
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants