1

I am trying to wrap my head around all this and am looking for someone to help clarify.

Lets say I have the following:

contract Test {
    public c = 3;
    function A(uint a) returns(uint){
    
       uint b = a - c;
       return b;
    }
    
    function B() returns(uint){
       return b + a;
    }
    
}

Now I have found a bug in my code and function A should be this:

contract Test {
    public c = 3;
    function A(uint a) returns(uint){

       uint b = a - C();
       return b;
    }

    function B() returns(uint){
       return b + a;
    }
    
    function C() returns(uint) {
       return c * 2;
    }
}

Would this work in with upgrading proxy?

1 Answer 1

1

Yes. If you are using the proxy delegate pattern, your upgrade would work!

One important rule is to avoid overwriting your state. So, in your case, your contracts would break if you added a new variable on the line before public c = 3;.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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