Guest User

Untitled

a guest
Feb 23rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. /* This creates an array with all balances */
  2. mapping (address => uint256) public balanceOf;
  3. mapping (address => mapping (address => uint256)) public allowance;
  4.  
  5.  
  6. /* Initializes contract with initial supply tokens to the creator of the contract */
  7. function practice() {
  8.  
  9. initialSupply = 500000000000;
  10. name ="CryptoDegree";
  11. decimals = 4;
  12. symbol = "CDG";
  13.  
  14. balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
  15. totalSupply = initialSupply; // Update total supply
  16.  
  17. }
  18.  
  19. /* Send coins */
  20. function transfer(address _to, uint256 _value) {
  21. if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough
  22. if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
  23. balanceOf[msg.sender] -= _value; // Subtract from the sender
  24. balanceOf[_to] += _value; // Add the same to the recipient
  25.  
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. /* This unnamed function is called whenever someone tries to send ether to it */
  35. function () {
  36. throw; // Prevents accidental sending of ether
  37. }
Add Comment
Please, Sign In to add comment