Function sway_libs::ownership::transfer_ownership
pub fn transfer_ownership(new_owner: Identity)
Expand description
Transfers ownership to the passed identity.
Arguments
new_owner
: [Identity] - TheIdentity
that will be the next owner.
Reverts
- When the sender is not the owner.
Number of Storage Acesses
- Reads:
1
- Write:
1
Examples
use sway_libs::ownership::{_owner, transfer_ownership};
fn foo(new_owner: Identity) {
assert(_owner() == State::Initialized(Identity::Address(Address::zero()));
transfer_ownership(new_owner);
assert(_owner() == State::Initialized(new_owner));
}