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.addressandmsg.sender = user1, and it delegatecalls to HumanStandardTokentransfermethod. InHumanStandardToken.transferwe havethis = custody.addressandmsg.sender = user1. Delegatecall do not changethisnormsg.sender. – Ismael Sep 26 '17 at 03:02