Struct cw_ownable::Ownership
source · pub struct Ownership<T: AddressLike> {
pub owner: Option<T>,
pub pending_owner: Option<T>,
pub pending_expiry: Option<Expiration>,
}
Expand description
The contract’s ownership info
Fields§
§owner: Option<T>
The contract’s current owner.
None
if the ownership has been renounced.
pending_owner: Option<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 cw_utils::Expiration;
assert_eq!(
Ownership {
owner: Some("blue"),
pending_owner: None,
pending_expiry: Some(Expiration::Never {})
}
.into_attributes(),
vec![
Attribute::new("owner", "blue"),
Attribute::new("pending_owner", "none"),
Attribute::new("pending_expiry", "expiration: never")
],
)
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 json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more