I've a state variable
address public current;
which stores the address of the latest updated contract. This value can be modified with a function.
Then, I've a function of this kind
function example(string param1, string param2, string param3, uint256 param4) public {
if (current == address(this)) {
do things...
}
else {
current.delegatecall(bytes4(sha3("example(string,string,string,uint256)")), param1, param2, param3, param4);
}
}
Obviously, the new contract has the function example
with the same signature of the older version. However, when I try to call this function in Remix with current=another_address
, the transaction does not modify the storage of the calling contract. It's as if it did nothing.
Am I doing something wrong?
Thank you.