I am trying to make use of delegatecall function in solidity.
function delegateTokens(uint256 _value) returns (bool result) {
tokens[msg.sender] = _value;
return token.delegatecall(bytes4(sha3("transfer(address,uint256)")), address(this), _value);
}
There is no error thrown but values are not changed. Code is available at https://github.com/nirmalgupta/delegatecall steps to reproduce is also available there. Any help with this is appreciated.
custody.delegateTokens(100, {from: user1});
. Then we have inCustody.delegateTokens
:this = custody.address
andmsg.sender = user1
, and it delegatecalls to HumanStandardTokentransfer
method. InHumanStandardToken.transfer
we havethis = custody.address
andmsg.sender = user1
. Delegatecall do not changethis
normsg.sender
.