pub struct DecCoin {
pub denom: String,
pub amount: Decimal256,
}
Expand description
A coin type with decimal amount.
Modeled after the Cosmos SDK’s DecCoin type.
However, in contrast to the Cosmos SDK the amount
string MUST always have a dot at JSON level,
see https://github.com/cosmos/cosmos-sdk/issues/10863.
Also if Cosmos SDK chooses to migrate away from fixed point decimals
(as shown [here](https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/x/group/internal/math/dec.go#L13-L21 and discussed here),
wasmd needs to truncate the decimal places to 18.
Fields§
§denom: String
§amount: Decimal256
An amount in the base denom of the distributed token.
Some chains have chosen atto (10^-18) for their token’s base denomination. If we used Decimal
here, we could only store
340282366920938463463.374607431768211455atoken which is 340.28 TOKEN.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DecCoin
impl<'de> Deserialize<'de> for DecCoin
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 DecCoin
impl JsonSchema for DecCoin
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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &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 moreimpl Eq for DecCoin
impl StructuralPartialEq for DecCoin
Auto Trait Implementations§
impl Freeze for DecCoin
impl RefUnwindSafe for DecCoin
impl Send for DecCoin
impl Sync for DecCoin
impl Unpin for DecCoin
impl UnwindSafe for DecCoin
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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