I just facing a little issue here in sending some ether from Sender contract to another contract Escrow by msg.sender value.
Btw, I'm executing code on Remix, and specify the value from the sender after calling sendEth().
pragma solidity ^0.5.11;
contract Sender {
event sent(
address indexed escrowAddress
);
function sendEth() external payable{
Escrow escrow = new Escrow();
address payable _payableEscrow = address(uint160(address(escrow)));
_payableEscrow.transfer(msg.value);
emit sent(_payableEscrow);
}
}
contract Escrow {
function getBalance() external view returns(uint256) {
return address(this).balance;
}
}
And IDK why exactly I received this error:
transact to Sender.sendEth errored: VM error: revert.
The transaction has been reverted to the initial state.
Thank you for your help!