Loading...
In this smartbook, we'll discuss how to send ether from one contract to another.
We create two contracts sendEth and receiveEth. And create one fallback function. We simply send the ether with transfer method.
pragma solidity >=0.4.5 <0.9.0;
contract receiveEth {
receive() external payable {
}
function getBalance() public view returns(uint){
return address(this).balance;
}
}
contract sendEth{
function sendAmount( address payable _to) public payable {
_to.transfer(msg.value);
}
}