macro_rules! only_owner {
    ($trait_self: expr, $error_msg:expr) => { ... };
}
👎Deprecated since 0.26.0: Replace with the #[only_owner] attribute that can be placed on an endpoint. That one is more compact and shows up in the ABI.
Expand description

Very compact way of not allowing anyone but the owner to call a function.

It can only be used in a function that returns SCResult<_> where _ can be any type.

fn only_callable_by_owner(&self) -> SCResult<()> {
    only_owner!(self, "Caller must be owner");
    Ok(())
}