August 2019
Intermediate to advanced
486 pages
13h 52m
English
The balanceOf() function returns the token balance of the given address. The balances of each account are maintained in a mapping. This function just returns the uint256 balance data from the mapping.
The following is the API of the balanceOf() function:
function balanceOf(address who) external view returns (uint256 balance);
The balanceOf() function takes a single argument:
The function returns the token balance as a uint256 type. The following is the function implementation, where it reads the data from the balances mapping and returns the token balance:
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner];}