Last active
January 20, 2022 20:59
-
-
Save anonymous-research-group/0702ec58a8cf50ae3b7eca762e3ba2cb to your computer and use it in GitHub Desktop.
Revisions
-
anonymous-research-group renamed this gist
Dec 7, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
anonymous-research-group created this gist
Dec 7, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ pragma solidity ^0.5.16; import "../openzeppelin-contracts/GSN/Context.sol"; import "../openzeppelin-contracts/token/ERC20/ERC20.sol"; import "../openzeppelin-contracts/token/ERC20/ERC20Detailed.sol"; import "../openzeppelin-contracts/math/SafeMath.sol"; contract BaseToken is Context, ERC20, ERC20Detailed { uint256 tokenPrice = 100 wei; using SafeMath for uint256; using SafeMath for uint; constructor () public payable ERC20Detailed("BaseToken", "BT", 18) { _mint(_msgSender(), SafeMath.div(msg.value, tokenPrice)); } function buyTokens() public payable { _mint(_msgSender(), SafeMath.div(msg.value, tokenPrice)); } function sellTokens(uint256 amount) public { _burn(_msgSender(), amount); address(msg.sender).transfer( SafeMath.mul(amount, tokenPrice)); } }