Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /* Compiler version */
  2. pragma solidity ^0.4.13;
  3.  
  4. contract MyCoin {
  5.  
  6. mapping (address => uint) public balance;
  7. event Transfer(address from, address to, uint value);
  8.  
  9. /* constructor, will be called only once, when the contract is deployed to the network */
  10. function MyCoin(uint initialSupply) {
  11. balance[msg.sender] = initialSupply;
  12. }
  13.  
  14. /* simple function for transfering the coin */
  15. /* Just for testing purpose, will add more error handling check in the future */
  16. function transfer(address _to, uint _value) returns (bool success) {
  17. if (balance[msg.sender] < _value) revert();
  18.  
  19. balance[msg.sender] -= _value;
  20. balance[_to] += _value;
  21. Transfer(msg.sender, _to, _value);
  22. return true;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement