pub fn _set_proxy_owner(new_proxy_owner: State) 
Expand description

Change proxy ownership to the passed State.

Additional Information

This function can be used to transfer ownership between Identities or to revoke ownership.

Arguments

  • new_proxy_owner: [State] - The new state of the proxy ownership.

Reverts

  • When the sender is not the proxy owner.
  • When the new state of the proxy ownership is Uninitialized.

Number of Storage Accesses

  • Writes: 1

Examples

use sway_libs::upgradability::{_proxy_owner, _set_proxy_owner};

fn foo(new_owner: Identity) {
    assert(_proxy_owner() == State::Initialized(Identity::Address(Address::zero()));

    let new_proxy_owner = State::Initialized(new_owner);
    _set_proxy_owner(new_proxy_owner);

    assert(_proxy_owner() == State::Initialized(new_owner));
}