diff --git a/types/msg.go b/types/msg.go index 5d236b46..720b1986 100644 --- a/types/msg.go +++ b/types/msg.go @@ -248,6 +248,7 @@ type RedelegateMsg struct { type DistributionMsg struct { SetWithdrawAddress *SetWithdrawAddressMsg `json:"set_withdraw_address,omitempty"` WithdrawDelegatorReward *WithdrawDelegatorRewardMsg `json:"withdraw_delegator_reward,omitempty"` + FundCommunityPool *FundCommunityPoolMsg `json:"fund_community_pool",omitempty"` } // SetWithdrawAddressMsg is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). @@ -264,6 +265,13 @@ type WithdrawDelegatorRewardMsg struct { Validator string `json:"validator"` } +// FundCommunityPoolMsg is translated to a [MsgFundCommunityPool](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#LL69C1-L76C2). +// `depositor` is automatically filled with the current contract's address +type FundCommunityPoolMsg struct { + // Amount is the list of coins to be send to the community pool + Amount Coins `json:"amount"` +} + // StargateMsg is encoded the same way as a protobof [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). // This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md) type StargateMsg struct { diff --git a/types/msg_test.go b/types/msg_test.go index 1dc89abe..ffd6baa4 100644 --- a/types/msg_test.go +++ b/types/msg_test.go @@ -107,3 +107,13 @@ func TestGovMsgVoteWeightedSerialization(t *testing.T) { {Abstain, "0.5"}, }, msg.VoteWeighted.Options) } + +func TestMsgFundCommunityPoolSerialization(t *testing.T) { + document := []byte(`{"fund_community_pool":{"amount":[{"amount":"300","denom":"adenom"},{"amount":"400","denom":"bdenom"}]}}`) + + var msg DistributionMsg + err := json.Unmarshal(document, &msg) + require.NoError(t, err) + + require.Equal(t, Coins{{"adenom", "300"}, {"bdenom", "400"}}, msg.FundCommunityPool.Amount) +}