Closed aionick closed 5 years ago
Solidity also provides a similar function, assert(boolean)
. It behaves the same as require()
except that require()
will refund the caller any unused energy whereas assert()
will use up all of the caller's energy.
I'm not sure if this distinction is worth carrying over into our world, assert()
just feels like a cruder version of require()
.
(see this discussion on the matter).
Confirmed that a RevertException
cannot be caught. This is desirable. If someone wants to evaluate a boolean and do some conditional logic then they can use a regular if block to do so.
Solidity provides this idiom:
require(boolean)
that, if false, triggers a REVERT. This idiom proves very useful for a lot of contracts. We should provide the same support (ie.BlockchainRuntime.require(boolean)
)