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)));
        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!


You need to add in the Escrow contract a payable fallback function to accept or reject the funds:

function() external payable {
    // you can reject the funds (assert/require/revert) under certain conditions...
  • Thanks for your Help!
    – penguin
    Feb 10 '20 at 15:22
  • @EskandrSamir: You're welcome. Feb 10 '20 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.