Macro elrond_wasm::require [−][src]
macro_rules! require {
($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.
fn only_callable_by_owner(&self) -> SCResult<()> {
require!(self.blockchain().get_caller() == self.blockchain().get_owner_address(), "Caller must be owner");
Ok(())
}