Created
August 21, 2020 11:40
-
-
Save dumebi/02a5adf61a1cf88c04fb2afa13ab78be to your computer and use it in GitHub Desktop.
Basic ERC20 solidity token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.10; | |
// SPDX-License-Identifier: MIT | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract MyToken is ERC20 { | |
constructor(string memory name, string memory symbol) | |
public | |
ERC20(name, symbol) | |
{ | |
// Mint 100 tokens to msg.sender | |
// Similar to how | |
// 1 dollar = 100 cents | |
// 1 token = 1 * (10 ** decimals) | |
_mint(msg.sender, 100 * 10**uint256(decimals())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment