Skip to content

Instantly share code, notes, and snippets.

@czepluch
Created April 14, 2016 18:01
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 czepluch/8d1afe9e81bfe2d431c460c094316a63 to your computer and use it in GitHub Desktop.
Save czepluch/8d1afe9e81bfe2d431c460c094316a63 to your computer and use it in GitHub Desktop.
contract MyToken{
string public name;
string public symbol;
uint8 public decimals;
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint256 value);
function MyToken(uint256 _supply, string _name, string _symbol, uint8 _decimals) {
if (_supply == 0) _supply = 1000;
balanceOf[msg.sender] = _supply;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function transfer(address _to, uint256 _amount) {
if (balanceOf[msg.sender] < _amount) throw;
balanceOf[msg.sender] -= _amount;
balanceOf[_to] += _amount;
Transfer(msg.sender, _to, _amount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment