Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.0;
- contract EtherTransferTo {
- // fallback function no argument no return value
- function() public payable {
- }
- function getBalance() public view returns (uint) {
- return address(this).balance;
- }
- }
- // Sending Ether from one contract to another
- contract EtherTransferFrom {
- EtherTransferTo private _instance;
- constructor() public {
- _instance = new EtherTransferTo();
- }
- function getBalance() public view returns (uint) {
- return address(this).balance;
- }
- function getBalanceOfInstance() public view returns (uint) {
- //return address(_instance).balance;
- return _instance.getBalance();
- }
- // Transfer all money to EtherTransferTo contract
- function() public payable {
- address(_instance).transfer(msg.value);
- }
- }
Add Comment
Please, Sign In to add comment