0

If i call a function from another contract(using interface), and that function has require statement that reverts... will my function break, or will it continue to execute?

So the question is... will we get to //dosomething or will the transaction revert?

contract1 {

    function random1() {
    contract2.random2();
    
    //do something. does this execute or does it revert?

    }
    }
    
    contract2{
    function random2() {
    require(1 > 2);
    }

}

1 Answer 1

1

It won't reach do something. The transaction will revert on :

require(1 > 2);

And execution will stop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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