[][src]Macro elrond_wasm::only_owner

macro_rules! only_owner {
    ($trait_self: expr, $error_msg:expr) => { ... };
}

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(())
}