allowance (required)

A token owner can approve not only one, but multiple different accounts as delegates. So, for example, Alice can grant both Bob and Carol permission to make transfers from her account on her behalf. Extending this example, Alice can approve any number of any other accounts as delegates. These delegate accounts must be kept track of, and to do so again utilizes Solidity's mapping type, this time in a nested way:

mapping(address => mapping(address => uint256)) public allowance;

Here, the outer mapping maps Alice's address to an inner mapping. The inner mapping maps the delegate accounts (that is, the accounts granted permission to transfer on Alice's behalf) to the values they have been granted control over.

As in previous cases, this public state variable can be accessed using its getter function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset