ERC20 token standard uses approve() and transferFrom() to do the indirect transfer.
function approve(address spender, uint256 value) public returns (bool success) {
allowance[msg.sender][spender] = value;
Approval(msg.sender, spender, value);
return true;
}
As shown above, the approve() method uses the variable - allowance to add the mapping, so the owner can allow multiple spenders at the same time.
But I am just thinking if the approve() is the method to add the allowance why the ERC20 standard doesn't have any method to remove spender when the token owner doesn't want to give allowance. If allowance[msg.sender][spender] =0
, why the standard doesn't just delete the allowance[msg.sender][spender.
And given the structure allowance[msg.sender][spender] = uint256
, what is the maximum memory this structure will take for the contract?