0g-chain/x/kavadist/client/cli/utils.go
Kevin Davis fc85052522
add community multi-spend proposal (#915)
* feat: add community multi-spend proposal type

* feat: add handler for community multi-spend proposals

* chore: register new community multi-spend proposal

* feat: define client for community multi-spend proposal

* fix typos in example cli json

* fix: register now proposal type with module codec

* fix: register community multi-spend proposal with gov router, not committee

* fix: define kavadist keeper before referencing it

* nit: include deposit in example proposal

* nit: update comment

* nit: fix error codes

* nit: update comments
2021-06-02 11:03:25 -06:00

37 lines
1.1 KiB
Go

package cli
import (
"io/ioutil"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/kavadist/types"
)
type (
// CommunityPoolMultiSpendProposalJSON defines a CommunityPoolMultiSpendProposal with a deposit
CommunityPoolMultiSpendProposalJSON struct {
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
RecipientList types.MultiSpendRecipients `json:"recipient_list" yaml:"recipient_list"`
Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
}
)
// ParseCommunityPoolMultiSpendProposalJSON reads and parses a CommunityPoolMultiSpendProposalJSON from a file.
func ParseCommunityPoolMultiSpendProposalJSON(cdc *codec.Codec, proposalFile string) (CommunityPoolMultiSpendProposalJSON, error) {
proposal := CommunityPoolMultiSpendProposalJSON{}
contents, err := ioutil.ReadFile(proposalFile)
if err != nil {
return proposal, err
}
if err := cdc.UnmarshalJSON(contents, &proposal); err != nil {
return proposal, err
}
return proposal, nil
}