Macro multiversx_sc::require_old
source · macro_rules! require_old { ($expression:expr, $error_msg:expr) => { ... }; }
Expand description
Allows us to write Solidity style require!(<condition>, <error_msg>)
and avoid if statements.
It can only be used in a function that returns SCResult<_>
where _ can be any type.
Example:
fn only_accept_positive_old(&self, x: i32) -> SCResult<()> {
require_old!(x > 0, "only positive values accepted");
Ok(())
}