Token.sol 702 B

1234567891011121314151617181920212223242526272829
  1. contract Token {
  2. function Token() {
  3. owner = msg.sender;
  4. }
  5. modifier isOwner {
  6. if (msg.sender == owner) {
  7. _
  8. }
  9. }
  10. //only owner can currently create new tokens.
  11. //change as needed.
  12. function createToken(address _to, uint _amount) isOwner {
  13. balances[_to] += _amount; //check if can be done from unitialised acc
  14. }
  15. function sendToken(address _to, uint _amount) {
  16. if (balances[msg.sender] >= _amount) {
  17. balances[msg.sender] -= _amount;
  18. balances[_to] += _amount;
  19. }
  20. }
  21. address public owner;
  22. mapping (address => uint) public balances; //how does this work?
  23. }