Guest User

Untitled

a guest
Mar 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. contract MyToken {
  2. /* This creates an array with all balances */
  3. mapping (address => uint256) public balanceOf;
  4.  
  5. /* Initializes contract with initial supply tokens to the creator of the contract */
  6. function MyToken(
  7. uint256 initialSupply
  8. ) {
  9. balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
  10. }
  11.  
  12. /* Send coins */
  13. function transfer(address _to, uint256 _value) {
  14. require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
  15. require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
  16. balanceOf[msg.sender] -= _value; // Subtract from the sender
  17. balanceOf[_to] += _value; // Add the same to the recipient
  18. }
  19. }
  20.  
  21. pragma solidity ^0.4.21;
  22.  
  23. contract MyToken {function transfer(address _to, uint256 _value) public; }
  24.  
  25. contract ADTest {
  26.  
  27. function CallTransfer(address tokenAddress, address _to, uint256 _value) public {
  28. MyToken(tokenAddress).transfer(_to, _value);
  29. }
  30.  
  31. }
Add Comment
Please, Sign In to add comment