Skip to content

Commit

Permalink
Add suggested DecCoin docs
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Warta <[email protected]>
  • Loading branch information
chipshort and webmaster128 committed Aug 28, 2023
1 parent 1008d4e commit e522f85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/std/src/query/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ impl_response_constructor!(DelegationRewardsResponse, rewards: Vec<DecCoin>);
impl QueryResponseType for DelegationRewardsResponse {}

/// A coin type with decimal amount.
/// Modeled after the Cosmos SDK's [DecCoin](https://github.com/cosmos/cosmos-sdk/blob/c74e2887b0b73e81d48c2f33e6b1020090089ee0/proto/cosmos/base/v1beta1/coin.proto#L32-L41) type
/// 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 choses 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](https://github.com/cosmos/cosmos-sdk/issues/11783)),
/// wasmd needs to truncate the decimal places to 18.
///
/// [DecCoin]: (https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/proto/cosmos/base/v1beta1/coin.proto#L28-L38)
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct DecCoin {
Expand Down

0 comments on commit e522f85

Please sign in to comment.