Struct odra_modules::access::OwnableHostRef
source · pub struct OwnableHostRef { /* private fields */ }Expand description
Ownable Host Ref.
Implementations§
source§impl OwnableHostRef
impl OwnableHostRef
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.
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.
sourcepub fn get_optional_owner(&self) -> Option<Address>
pub fn get_optional_owner(&self) -> Option<Address>
Returns the optional address of the current owner.
sourcepub fn unchecked_transfer_ownership(&mut self, new_owner: Option<Address>)
pub fn unchecked_transfer_ownership(&mut self, new_owner: Option<Address>)
Unchecked version of the ownership transfer. It emits an event and sets the new owner.
source§impl OwnableHostRef
impl OwnableHostRef
sourcepub fn try_init(&mut self) -> OdraResult<()>
pub fn try_init(&mut self) -> OdraResult<()>
Initializes the module setting the caller as the initial owner.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_transfer_ownership(&mut self, new_owner: &Address) -> OdraResult<()>
pub fn try_transfer_ownership(&mut self, new_owner: &Address) -> OdraResult<()>
Transfers ownership of the module to new_owner. This function can only
be accessed by the current owner of the module.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_renounce_ownership(&mut self) -> OdraResult<()>
pub fn try_renounce_ownership(&mut self) -> OdraResult<()>
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.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_get_owner(&self) -> OdraResult<Address>
pub fn try_get_owner(&self) -> OdraResult<Address>
Returns the address of the current owner.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_assert_owner(&self, address: &Address) -> OdraResult<()>
pub fn try_assert_owner(&self, address: &Address) -> OdraResult<()>
Reverts with Error::CallerNotTheOwner if the function called by
any account other than the owner.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_get_optional_owner(&self) -> OdraResult<Option<Address>>
pub fn try_get_optional_owner(&self) -> OdraResult<Option<Address>>
Returns the optional address of the current owner.
Does not fail in case of error, returns odra::OdraResult instead.
sourcepub fn try_unchecked_transfer_ownership(
&mut self,
new_owner: Option<Address>,
) -> OdraResult<()>
pub fn try_unchecked_transfer_ownership( &mut self, new_owner: Option<Address>, ) -> OdraResult<()>
Unchecked version of the ownership transfer. It emits an event and sets
the new owner.
Does not fail in case of error, returns odra::OdraResult instead.