Complete the code to declare the total supply variable in an ERC-20 contract.
uint256 public [1];The totalSupply variable holds the total number of tokens in circulation in an ERC-20 contract.
Complete the code to define the balance mapping for token holders.
mapping(address => [1]) private balances;bool or address instead of uint256.The balances mapping stores the token balance (as uint256) for each address.
Fix the error in the transfer function signature to match ERC-20 standard.
function transfer(address [1], uint256 amount) public returns (bool) {from or spender instead of to.The ERC-20 transfer function uses to as the parameter name for the recipient address.
Fill both blanks to complete the allowance mapping declaration.
mapping([1] => mapping([2] => uint256)) private allowances;
uint256 or bool as keys instead of address.The allowances mapping maps an owner address to a spender address to the allowed token amount (uint256).
Fill all three blanks to complete the transfer function body that updates balances and emits Transfer event.
require(balances[msg.sender] >= [1], "Insufficient balance"); balances[msg.sender] -= [2]; balances[[3]] += amount; emit Transfer(msg.sender, [3], amount); return true;
from or mixing up amount and to.The function checks if the sender has enough amount, subtracts it, adds it to the recipient to, emits the Transfer event, and returns true.