Last active
November 15, 2019 13:15
-
-
Save defiboy/698b63568e26167d4cb980d66ebdb2b3 to your computer and use it in GitHub Desktop.
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.5.0; | |
import "./SafeMath.sol"; | |
contract BasicToken { | |
using SafeMath for uint256; | |
string private _name; | |
string private _symbol; | |
// Standard | |
uint256 private _totalSupply; // 1010 | |
mapping (address => uint256) private _balances; | |
constructor() public { | |
_name = "MyEdsonToken"; | |
_symbol = "EDS"; | |
_totalSupply = 1000; | |
_balances[msg.sender] = _totalSupply; | |
} | |
function totalSupply() external view returns (uint256) { | |
return _totalSupply; | |
} | |
function balanceOf(address account) public view returns (uint256){ | |
uint256 balanceOfAccount = _balances[account]; | |
return balanceOfAccount; | |
} | |
function transfer(address recipient, uint256 amount) external returns (bool) { | |
_balances[msg.sender] = _balances[msg.sender].sub(amount, "ERC20: transfer amount exceeds balance"); | |
_balances[recipient] = _balances[recipient].add(amount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment