The allowance function

The allowance() function returns the token amount remaining, which the spender is currently allowed to withdraw from the owner's account. This function returns the remaining balance of tokens from the allowed mapping. The allowed mapping is updated when approve(), transferFrom(), and advanced functions such as increaseApproval() or decreaseApproval() are present and executed.

The following is the API for the allowance() function:

function allowance(address owner, address spender) external view returns (uint256 remaining);

The allowance() function takes two arguments:

  • owner: The address of the owner of the token who previously called the approve() function
  • spender: The address of  spender, who is allowed to withdraw ...

Get Mastering Blockchain Programming with Solidity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.