Created
June 18, 2022 05:29
-
-
Save mahdiidarabi/9384b752ac66ff5b37ea7605d5f305c7 to your computer and use it in GitHub Desktop.
a very simple code of an ERC20 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
// contracts/SimpleToken.sol | |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
/** | |
* @title SimpleToken | |
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. | |
* Note they can later distribute these tokens as they wish using `transfer` and other | |
* `ERC20` functions. | |
* Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/examples/SimpleToken.sol | |
*/ | |
contract SimpleToken is ERC20 { | |
/** | |
* @dev Constructor that gives msg.sender all of existing tokens. | |
*/ | |
constructor( | |
string memory name, | |
string memory symbol, | |
uint256 initialSupply | |
) public ERC20(name, symbol) { | |
_mint(msg.sender, initialSupply); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment