Struct cw20::Cw20Contract
source · pub struct Cw20Contract(pub Addr);
Expand description
Cw20Contract is a wrapper around Addr that provides a lot of helpers for working with this.
If you wish to persist this, convert to Cw20CanonicalContract via .canonical()
Tuple Fields§
§0: Addr
Implementations§
source§impl Cw20Contract
impl Cw20Contract
pub fn addr(&self) -> Addr
pub fn call<T: Into<Cw20ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg>
sourcepub fn balance<T, CQ>(
&self,
querier: &QuerierWrapper<'_, CQ>,
address: T
) -> StdResult<Uint128>
pub fn balance<T, CQ>( &self, querier: &QuerierWrapper<'_, CQ>, address: T ) -> StdResult<Uint128>
Get token balance for the given address
sourcepub fn meta<CQ: CustomQuery>(
&self,
querier: &QuerierWrapper<'_, CQ>
) -> StdResult<TokenInfoResponse>
pub fn meta<CQ: CustomQuery>( &self, querier: &QuerierWrapper<'_, CQ> ) -> StdResult<TokenInfoResponse>
Get metadata from the contract. This is a good check that the address is a valid Cw20 contract.
sourcepub fn allowance<T, U, CQ>(
&self,
querier: &QuerierWrapper<'_, CQ>,
owner: T,
spender: U
) -> StdResult<AllowanceResponse>
pub fn allowance<T, U, CQ>( &self, querier: &QuerierWrapper<'_, CQ>, owner: T, spender: U ) -> StdResult<AllowanceResponse>
Get allowance of spender to use owner’s account
sourcepub fn minter<CQ: CustomQuery>(
&self,
querier: &QuerierWrapper<'_, CQ>
) -> StdResult<Option<MinterResponse>>
pub fn minter<CQ: CustomQuery>( &self, querier: &QuerierWrapper<'_, CQ> ) -> StdResult<Option<MinterResponse>>
Find info on who can mint, and how much
sourcepub fn has_allowance<CQ: CustomQuery>(
&self,
querier: &QuerierWrapper<'_, CQ>
) -> bool
pub fn has_allowance<CQ: CustomQuery>( &self, querier: &QuerierWrapper<'_, CQ> ) -> bool
returns true if the contract supports the allowance extension
sourcepub fn is_mintable<CQ: CustomQuery>(
&self,
querier: &QuerierWrapper<'_, CQ>
) -> bool
pub fn is_mintable<CQ: CustomQuery>( &self, querier: &QuerierWrapper<'_, CQ> ) -> bool
returns true if the contract supports the mintable extension
Trait Implementations§
source§impl Clone for Cw20Contract
impl Clone for Cw20Contract
source§fn clone(&self) -> Cw20Contract
fn clone(&self) -> Cw20Contract
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Cw20Contract
impl Debug for Cw20Contract
source§impl<'de> Deserialize<'de> for Cw20Contract
impl<'de> Deserialize<'de> for Cw20Contract
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl JsonSchema for Cw20Contract
impl JsonSchema for Cw20Contract
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq for Cw20Contract
impl PartialEq for Cw20Contract
source§fn eq(&self, other: &Cw20Contract) -> bool
fn eq(&self, other: &Cw20Contract) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Cw20Contract
impl Serialize for Cw20Contract
impl StructuralPartialEq for Cw20Contract
Auto Trait Implementations§
impl RefUnwindSafe for Cw20Contract
impl Send for Cw20Contract
impl Sync for Cw20Contract
impl Unpin for Cw20Contract
impl UnwindSafe for Cw20Contract
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
Mutably borrows from an owned value. Read more