I'm getting this error in remix:
"TypeError: No matching declaration found after argument-dependent lookup. require(_spender.call.value(msg.value)(_data));
^-----^ "
function approveAndCall(address payable _spender, uint256 _value, bytes memory _data) public payable returns (bool) {
require(_spender != address(this));
this.approve(_spender, _value);
require(_spender.call.value(msg.value)(_data));
return true;
}
Please I need help on how to resolve this. Thanks
Best Answer
When you use the
call
function, you can control the returned success condition as abool
and check if thecall
succeed or not.From docs: