2

Take the following code:

contract Foo {
    function increment(uint256 x) external returns (uint256 result) {
        result = x + 1;
    }
    
    function increment_twice(uint256 x) external returns (uint256 result) {
        assembly {
            result := add(increment(x), 1)
        }
    }
}

It doesn't compile:

DeclarationError: Function "increment" not found.

Is there any way to call increment from within assembly?

Your Answer

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

Browse other questions tagged or ask your own question.