Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. pragma solidity ^0.4.0;
  2.  
  3. contract EtherTransferTo {
  4. // fallback function no argument no return value
  5. function() public payable {
  6. }
  7.  
  8. function getBalance() public view returns (uint) {
  9. return address(this).balance;
  10. }
  11. }
  12.  
  13. // Sending Ether from one contract to another
  14. contract EtherTransferFrom {
  15. EtherTransferTo private _instance;
  16.  
  17. constructor() public {
  18. _instance = new EtherTransferTo();
  19. }
  20.  
  21. function getBalance() public view returns (uint) {
  22. return address(this).balance;
  23. }
  24.  
  25. function getBalanceOfInstance() public view returns (uint) {
  26. //return address(_instance).balance;
  27. return _instance.getBalance();
  28. }
  29.  
  30. // Transfer all money to EtherTransferTo contract
  31. function() public payable {
  32. address(_instance).transfer(msg.value);
  33. }
  34. }
Add Comment
Please, Sign In to add comment