BR Academy
0%
Object-Oriented Solidity·Lesson 7 of 23·15 min

Custom Errors, Require/Assert/Revert, and Gas Savings

This lesson is for enrolled learners

The concept Solidity gives you three ways to abort execution and undo state changes within the current call: require(condition, "message") for input/state validation (the one you'll use most — it refunds any remaining gas to the caller), revert("message") or revert CustomError(args) for explicit, unconditional aborts deeper in a function's logic, and assert(condition) reserved for checking invariants that should be mathematically……

Enroll to continue Already enrolled? Sign in