pub struct Ownership<T: AddressLike> {
pub owner: GovernanceDetails<T>,
pub pending_owner: Option<GovernanceDetails<T>>,
pub pending_expiry: Option<Expiration>,
}
Expand description
The contract’s ownership info
Fields§
§owner: GovernanceDetails<T>
The contract’s current owner.
pending_owner: Option<GovernanceDetails<T>>
The account who has been proposed to take over the ownership.
None
if there isn’t a pending ownership transfer.
pending_expiry: Option<Expiration>
The deadline for the pending owner to accept the ownership.
None
if there isn’t a pending ownership transfer, or if a transfer
exists and it doesn’t have a deadline.
Implementations§
Source§impl<T: AddressLike> Ownership<T>
impl<T: AddressLike> Ownership<T>
Sourcepub fn into_attributes(self) -> Vec<Attribute>
pub fn into_attributes(self) -> Vec<Attribute>
Serializes the current ownership state as attributes which may
be used in a message response. Serialization is done according
to the std::fmt::Display implementation for T
and
cosmwasm_std::Expiration
(for pending_expiry
). If an
ownership field has no value, "none"
will be serialized.
Attribute keys used:
- owner
- pending_owner
- pending_expiry
Callers should take care not to use these keys elsewhere in their response as CosmWasm will override reused attribute keys.
§Example
use abstract_std::objects::{ownership::Ownership, gov_type::GovernanceDetails};
use cw_utils::Expiration;
use cosmwasm_std::Attribute;
let ownership = Ownership {
owner: GovernanceDetails::Monarchy{ monarch: "blue".to_owned() },
pending_owner: None,
pending_expiry: Some(Expiration::Never {})
};
assert_eq!(
ownership.into_attributes(),
vec![
Attribute::new("owner", "monarch"),
Attribute::new("pending_owner", "none"),
Attribute::new("pending_expiry", "expiration: never")
],
)
Sourcepub fn assert_owner_can_change(&self) -> Result<(), GovOwnershipError>
pub fn assert_owner_can_change(&self) -> Result<(), GovOwnershipError>
Assert current owner supports governance change
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Ownership<T>where
T: Deserialize<'de> + AddressLike,
impl<'de, T> Deserialize<'de> for Ownership<T>where
T: Deserialize<'de> + AddressLike,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T: AddressLike + JsonSchema> JsonSchema for Ownership<T>
impl<T: AddressLike + JsonSchema> JsonSchema for Ownership<T>
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreimpl<T: AddressLike> StructuralPartialEq for Ownership<T>
Auto Trait Implementations§
impl<T> Freeze for Ownership<T>where
T: Freeze,
impl<T> RefUnwindSafe for Ownership<T>where
T: RefUnwindSafe,
impl<T> Send for Ownership<T>where
T: Send,
impl<T> Sync for Ownership<T>where
T: Sync,
impl<T> Unpin for Ownership<T>where
T: Unpin,
impl<T> UnwindSafe for Ownership<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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