Guest User

Basic Contract Api

a guest
Feb 20th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. contract metaCoin {
  2. mapping (address => uint) public balances;
  3. function metaCoin() {
  4. balances[msg.sender] = 10000;
  5. }
  6. function sendToken(address receiver, uint amount) returns(bool successful){
  7. if (balances[msg.sender] < amount) return false;
  8. balances[msg.sender] -= amount;
  9. balances[receiver] += amount;
  10. return false;
  11. }
  12. }
  13.  
  14. contract coinCaller{
  15. metaCoin m;
  16. function sendCoin(address coinContractAddress, address receiver, uint amount){
  17. m = metaCoin(coinContractAddress);
  18. m.sendToken(receiver, amount);
  19. }
  20. }
Add Comment
Please, Sign In to add comment