Skip to content

Instantly share code, notes, and snippets.

@chiro-hiro
Last active October 18, 2017 05:24
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 chiro-hiro/7fba44192c217fd544824ed930167dbe to your computer and use it in GitHub Desktop.
Save chiro-hiro/7fba44192c217fd544824ed930167dbe to your computer and use it in GitHub Desktop.
Basic ERC20 Token
pragma solidity ^0.4.11;

contract BasicToken {

  mapping(address => uint256) balances;

  function BasicToken(){
    balances[address(0x005239d2bec5c8ee929ec27944cffc7b2667710b51)] = 1000;
  }

  function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    return true;
  }

  function balanceOf(address _owner) public constant returns (uint256 balance) {
    return balances[_owner];
  }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment