chapter16-code-5
Thu Mar 30 2023 11:23:33 GMT+0000 (Coordinated Universal Time)
Saved by
@RareSkills
contract ERC20 {
string public name;
string public symbol;
mapping(address => uint256) public balanceOf;
address public owner;
uint8 public decimals;
uint256 public totalSupply;
constructor(string memory _name, string memory _symbol, uint8 decimals) {
name = _name;
symbol = _symbol;
decimals = 18;
owner = msg.sender;
}
function mint(address to, uint256 amount) public {
require(msg.sender == owner, "only owner can create tokens");
totalSupply += amount;
balanceOf[owner] += amount;
}
}
content_copyCOPY
Comments