Skip to main content

What Is a Common Pattern for Handling the Success of an External Call ?

A common secure pattern is to immediately check the boolean return value of the low-level call function using a require statement. The pattern is (bool success, ) = recipient.call{value: amount}(""); require(success, "External call failed");.

This ensures that if the external call fails for any reason, the entire transaction is reverted, preventing any subsequent logic from executing and maintaining the contract's state integrity.

How Does Gas Limit Prevent Infinite Loops during a State Change?
How Do Smart Contracts Manage Slippage on a Decentralized Exchange?
What Is the Difference between Require() and Checking the Call Return Value?
How Does the Blockchain Ensure the Atomicity of a Complex Transaction?