Skip to content

Instantly share code, notes, and snippets.

@defiboy
Created November 15, 2019 14:54
Show Gist options
  • Save defiboy/606370d9765809d45c73eeb756bccc93 to your computer and use it in GitHub Desktop.
Save defiboy/606370d9765809d45c73eeb756bccc93 to your computer and use it in GitHub Desktop.
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);
}
}
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