Created
November 15, 2019 14:54
-
-
Save defiboy/606370d9765809d45c73eeb756bccc93 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); | |
} | |
} |
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