What I would like to do is something like this:

function testCall(uint amount) public virtual returns (bool) {
address tta = address(0xE7B6....);    
(bool success, bytes memory result) = tta.delegatecall(abi.encodeWithSignature("approve(address, uint256)", address(this), amount));
return success;

The token looks like this (has the approve function)

However, whenever the function is executed, it reverts with an error.

What am I doing wrong?

What I need to accomplish is to let the user approve the contract to make a transferFrom by executing the contract's testCall() function first.

  • Get rid of the space character in "approve(address, uint256)". Commented Aug 22, 2020 at 18:42
  • As you can learn from the official documentation: "Parameter types are split by a single comma - no spaces are used". Commented Aug 22, 2020 at 18:50

1 Answer 1


You are adding a space in your function which is producing a different method signature.

> provider.eth.abi.encodeFunctionSignature('approve(address, uint256)')


If you remove the space, it should work!

  • Edit: yes, it works! (sorry it took so long to approve the answer) Commented Aug 29, 2020 at 11:30

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.