Created
July 21, 2018 18:24
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.4.18; | |
contract Token { | |
mapping(address => uint) balances; | |
uint public totalSupply; | |
function Token(uint _initialSupply) { | |
balances[msg.sender] = totalSupply = _initialSupply; | |
} | |
function transfer(address _to, uint _value) public returns (bool) { | |
require(balances[msg.sender] - _value >= 0); | |
balances[msg.sender] -= _value; | |
balances[_to] += _value; | |
return true; | |
} | |
function balanceOf(address _owner) public constant returns (uint balance) { | |
return balances[_owner]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment