In the code of Coin
contract at:
https://solidity.readthedocs.io/en/latest/introduction-to-smart-contracts.html#subcurrency-example
there is the following function which requires the amount to be smaller than 10^60
.
function mint(address receiver, uint amount) public {
require(msg.sender == minter);
require(amount < 1e60);
balances[receiver] += amount;
}
I thought that the maximum number an uint
can hold is 2^256 ~= 10^77
. According to doc:
The second call to require ensures that there will not be too many coins, which could cause overflow errors later.
What kind of overflow can be caused when the amount is bigger than 10^60 ~= 2^200
?