pub struct OwnableClient<'a> {
pub env: Env,
pub address: Address,
/* private fields */
}Expand description
OwnableClient is a client for calling the contract defined in “Ownable”.
Fields§
§env: Env§address: AddressImplementations§
Source§impl<'a> OwnableClient<'a>
impl<'a> OwnableClient<'a>
Sourcepub fn get_owner(&self) -> Option<Address>
pub fn get_owner(&self) -> Option<Address>
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
§Arguments
e- Access to the Soroban environment.
Sourcepub fn try_get_owner(
&self,
) -> Result<Result<Option<Address>, <Option<Address> as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
pub fn try_get_owner( &self, ) -> Result<Result<Option<Address>, <Option<Address> as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
§Arguments
e- Access to the Soroban environment.
Sourcepub fn transfer_ownership(&self, new_owner: &Address, live_until_ledger: &u32)
pub fn transfer_ownership(&self, new_owner: &Address, live_until_ledger: &u32)
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
§Arguments
e- Access to the Soroban environment.new_owner- The proposed new owner.live_until_ledger- Ledger number until which the new owner can accept. A value of0cancels any pending transfer.
§Errors
OwnableError::OwnerNotSet- If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer- If trying to cancel a transfer that doesn’t exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger- If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount- If the specified pending account is not the same as the providednewaddress.
§Notes
- Authorization for the current owner is required.
Sourcepub fn try_transfer_ownership(
&self,
new_owner: &Address,
live_until_ledger: &u32,
) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
pub fn try_transfer_ownership( &self, new_owner: &Address, live_until_ledger: &u32, ) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
§Arguments
e- Access to the Soroban environment.new_owner- The proposed new owner.live_until_ledger- Ledger number until which the new owner can accept. A value of0cancels any pending transfer.
§Errors
OwnableError::OwnerNotSet- If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer- If trying to cancel a transfer that doesn’t exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger- If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount- If the specified pending account is not the same as the providednewaddress.
§Notes
- Authorization for the current owner is required.
Sourcepub fn accept_ownership(&self)
pub fn accept_ownership(&self)
Accepts a pending ownership transfer.
§Arguments
e- Access to the Soroban environment.
§Errors
crate::role_transfer::RoleTransferError::NoPendingTransfer- If there is no pending transfer to accept.
§Events
- topics -
["ownership_transfer_completed"] - data -
[new_owner: Address]
Sourcepub fn try_accept_ownership(
&self,
) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
pub fn try_accept_ownership( &self, ) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
Accepts a pending ownership transfer.
§Arguments
e- Access to the Soroban environment.
§Errors
crate::role_transfer::RoleTransferError::NoPendingTransfer- If there is no pending transfer to accept.
§Events
- topics -
["ownership_transfer_completed"] - data -
[new_owner: Address]
Sourcepub fn renounce_ownership(&self)
pub fn renounce_ownership(&self)
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
§Arguments
e- Access to the Soroban environment.
§Errors
OwnableError::TransferInProgress- If there is a pending ownership transfer.OwnableError::OwnerNotSet- If the owner is not set.
§Notes
- Authorization for the current owner is required.
Sourcepub fn try_renounce_ownership(
&self,
) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
pub fn try_renounce_ownership( &self, ) -> Result<Result<(), <() as TryFromVal<Env, Val>>::Error>, Result<Error, InvokeError>>
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
§Arguments
e- Access to the Soroban environment.
§Errors
OwnableError::TransferInProgress- If there is a pending ownership transfer.OwnableError::OwnerNotSet- If the owner is not set.
§Notes
- Authorization for the current owner is required.
Auto Trait Implementations§
impl<'a> Freeze for OwnableClient<'a>
impl<'a> !RefUnwindSafe for OwnableClient<'a>
impl<'a> !Send for OwnableClient<'a>
impl<'a> !Sync for OwnableClient<'a>
impl<'a> Unpin for OwnableClient<'a>
impl<'a> !UnwindSafe for OwnableClient<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more