Struct odra_modules::access::Ownable2Step
source · pub struct Ownable2Step { /* private fields */ }Expand description
This module provides a straightforward access control feature that enables
exclusive access to particular functions by an account, known as the owner.
The account that initiates contract deployment is automatically assigned as
the owner. However, ownership can be transferred later by using the
transfer_ownership() and accept_ownership() functions.
You can use this module as a standalone contract or integrate it into a custom module by adding it as a field.
When used in a custom module, the only_owner() function is available,
allowing you to restrict function usage to the owner.
Implementations§
source§impl Ownable2Step
impl Ownable2Step
sourcepub fn get_pending_owner(&self) -> Option<Address>
pub fn get_pending_owner(&self) -> Option<Address>
Returns the address of the pending owner.
sourcepub fn transfer_ownership(&mut self, new_owner: &Address)
pub fn transfer_ownership(&mut self, new_owner: &Address)
Starts the ownership transfer of the module to a new_owner.
Replaces the pending_ownerif there is one.
This function can only be accessed by the current owner of the module.
sourcepub fn renounce_ownership(&mut self)
pub fn renounce_ownership(&mut self)
If the contract’s owner chooses to renounce their ownership, the contract will no longer have an owner. This means that any functions that can only be accessed by the owner will no longer be available.
The function can only be called by the current owner, and it will permanently remove the owner’s privileges.
sourcepub fn accept_ownership(&mut self)
pub fn accept_ownership(&mut self)
The new owner accepts the ownership transfer. Replaces the current owner and clears the pending owner.
Trait Implementations§
source§impl Clone for Ownable2Step
impl Clone for Ownable2Step
source§fn clone(&self) -> Ownable2Step
fn clone(&self) -> Ownable2Step
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more