I have a contract that uses the ERC20 token contract for making payments. Now, in the ERC20 token contract we have the following implementation of approve function:
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
The problem is that the msg.sender within the approve() function of ERC20 holds the address of the service contract (the contract that uses the ERC20 contract for making payments and not the address of the user who wants to make the payment). So, how do I let the approve function know the address of the user who wants to make the payment ?
The work-around for this is to call the approve function directly instead of via
another contract. Is this the way to do it ?