Skip to content

Instantly share code, notes, and snippets.

@mahdiidarabi
Created June 18, 2022 05:29
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 mahdiidarabi/9384b752ac66ff5b37ea7605d5f305c7 to your computer and use it in GitHub Desktop.
Save mahdiidarabi/9384b752ac66ff5b37ea7605d5f305c7 to your computer and use it in GitHub Desktop.
a very simple code of an ERC20 token
// 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