0

Can't figure out this error. Please help!

"DeclarationError: Undeclared identifier. (bool success, ) = recipient.call; value; amount ;(""); ^---^"





function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call; value; amount ;("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
0

This line makes no sense:

(bool success, ) = recipient.call; value; amount ;("");

Change to:

(bool success, ) = recipient.call{ value: amount }("");

Note that using raw calls - i.e. .call() - isn't recommended. The author of the code seems to know this, as they've explicitly added the avoid-low-level-calls comment to disable the associated compiler warning.

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.