Skip to content

Instantly share code, notes, and snippets.

@dumebi
Created August 21, 2020 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dumebi/02a5adf61a1cf88c04fb2afa13ab78be to your computer and use it in GitHub Desktop.
Save dumebi/02a5adf61a1cf88c04fb2afa13ab78be to your computer and use it in GitHub Desktop.
Basic ERC20 solidity token
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