Struct odra_modules::access::Ownable
source · pub struct Ownable { /* 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() function.
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 Ownable
impl Ownable
sourcepub fn transfer_ownership(&mut self, new_owner: &Address)
pub fn transfer_ownership(&mut self, new_owner: &Address)
Transfers ownership of the module to new_owner. 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.
source§impl Ownable
impl Ownable
sourcepub fn assert_owner(&self, address: &Address)
pub fn assert_owner(&self, address: &Address)
Reverts with Error::CallerNotTheOwner if the function called by
any account other than the owner.