Function sway_libs::ownership::initialize_ownership
pub fn initialize_ownership(new_owner: Identity)
Expand description
Sets the passed identity as the initial owner.
Arguments
new_owner
: [Identity] - TheIdentity
that will be the first owner.
Reverts
- When ownership has been set before.
Number of Storage Acesses
- Reads:
1
- Write:
1
Examples
use sway_libs::ownership::{_owner, initialize_ownership};
fn foo(owner: Identity) {
assert(_owner() == State::Uninitialized);
initialize_ownership(owner);
assert(_owner() == State::Initialized(owner));
}