Categories
Cryptocurrency Ethereum Mastering Development

Require(…) condition location in wrapped functions

If I’m wrapping functions, like below, does it make a difference whether I check the input argument in the private function or the external one? Will it save me gas cost to do it in the external one because it will revert the function the earliest?

contract Example {


    function wrapperForFunction(uint256 exampleArg) external {
        //require(...) check best here ?
        _function(exampleArg);
    }
    
    function _function(uint256 exampleArg) private {
        //require(...) check best here ?
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *