macro_rules! require_old {
($expression:expr, $error_msg:expr) => { ... };
}
👎Deprecated since 0.48.0: Use
require!
instead, which terminates immediately.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(())
}