add struct tags everywhere

This commit is contained in:
rhuairahrighairigh 2020-03-21 20:21:43 +00:00
parent 66d368c722
commit 0275b21173
7 changed files with 28 additions and 25 deletions

View File

@ -37,4 +37,7 @@ func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*Permission)(nil), nil) cdc.RegisterInterface((*Permission)(nil), nil)
cdc.RegisterConcrete(GodPermission{}, "kava/GodPermission", nil) cdc.RegisterConcrete(GodPermission{}, "kava/GodPermission", nil)
cdc.RegisterConcrete(MsgSubmitProposal{}, "kava/MsgSubmitProposal", nil)
cdc.RegisterConcrete(MsgVote{}, "kava/MsgVote", nil)
} }

View File

@ -10,10 +10,10 @@ const DefaultNextProposalID uint64 = 1
// GenesisState is state that must be provided at chain genesis. // GenesisState is state that must be provided at chain genesis.
type GenesisState struct { type GenesisState struct {
NextProposalID uint64 NextProposalID uint64 `json:"next_proposal_id" yaml:"next_proposal_id"`
Committees []Committee Committees []Committee `json:"committees" yaml:"committees"`
Proposals []Proposal Proposals []Proposal `json:"proposals" yaml:"proposals"`
Votes []Vote Votes []Vote `json:"votes" yaml:"votes"`
} }
// NewGenesisState returns a new genesis state object for the module. // NewGenesisState returns a new genesis state object for the module.

View File

@ -14,9 +14,9 @@ const (
// CommitteeChangeProposal is a gov proposal for creating a new committee or modifying an existing one. // CommitteeChangeProposal is a gov proposal for creating a new committee or modifying an existing one.
type CommitteeChangeProposal struct { type CommitteeChangeProposal struct {
Title string Title string `json:"title" yaml:"title"`
Description string Description string `json:"description" yaml:"description"`
NewCommittee Committee NewCommittee Committee `json:"new_committee" yaml:"new_committee"`
} }
var _ govtypes.Content = CommitteeChangeProposal{} var _ govtypes.Content = CommitteeChangeProposal{}
@ -69,9 +69,9 @@ func (ccp CommitteeChangeProposal) String() string {
// CommitteeDeleteProposal is a gov proposal for removing a committee. // CommitteeDeleteProposal is a gov proposal for removing a committee.
type CommitteeDeleteProposal struct { type CommitteeDeleteProposal struct {
Title string Title string `json:"title" yaml:"title"`
Description string Description string `json:"description" yaml:"description"`
CommitteeID uint64 CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
} }
var _ govtypes.Content = CommitteeDeleteProposal{} var _ govtypes.Content = CommitteeDeleteProposal{}

View File

@ -15,7 +15,7 @@ var _, _ sdk.Msg = MsgSubmitProposal{}, MsgVote{}
type MsgSubmitProposal struct { type MsgSubmitProposal struct {
PubProposal PubProposal `json:"pub_proposal" yaml:"pub_proposal"` PubProposal PubProposal `json:"pub_proposal" yaml:"pub_proposal"`
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
CommitteeID uint64 CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
} }
// NewMsgSubmitProposal creates a new MsgSubmitProposal instance // NewMsgSubmitProposal creates a new MsgSubmitProposal instance

View File

@ -50,7 +50,7 @@ func (ShutdownCDPDepsitPermission) Allows(p gov.Content) bool {
// Same as above but the route isn't static // Same as above but the route isn't static
type GeneralShutdownPermission struct { type GeneralShutdownPermission struct {
MsgRoute sdtypes.MsgRoute MsgRoute sdtypes.MsgRoute `json:"msg_route" yaml:"msg_route"`
} }
var _ Permission = GeneralShutdownPermission{} var _ Permission = GeneralShutdownPermission{}

View File

@ -17,7 +17,7 @@ const (
) )
type QueryCommitteeParams struct { type QueryCommitteeParams struct {
CommitteeID uint64 CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
} }
func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams { func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams {
@ -27,7 +27,7 @@ func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams {
} }
type QueryProposalParams struct { type QueryProposalParams struct {
ProposalID uint64 ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
} }
func NewQueryProposalParams(proposalID uint64) QueryProposalParams { func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
@ -37,8 +37,8 @@ func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
} }
type QueryVoteParams struct { type QueryVoteParams struct {
ProposalID uint64 ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
Voter sdk.AccAddress Voter sdk.AccAddress `json:"voter" yaml:"voter"`
} }
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams { func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams {

View File

@ -19,9 +19,9 @@ var (
// A Committee is a collection of addresses that are allowed to vote and enact any governance proposal that passes their permissions. // A Committee is a collection of addresses that are allowed to vote and enact any governance proposal that passes their permissions.
type Committee struct { type Committee struct {
ID uint64 // TODO or a name? ID uint64 `json:"id" yaml:"id"` // TODO or a name?
Members []sdk.AccAddress Members []sdk.AccAddress `json:"members" yaml:"members"`
Permissions []Permission Permissions []Permission `json:"permissions" yaml:"permissions"`
} }
func (c Committee) HasMember(addr sdk.AccAddress) bool { func (c Committee) HasMember(addr sdk.AccAddress) bool {
@ -77,10 +77,10 @@ type Permission interface {
type PubProposal = gov.Content // TODO find a better name type PubProposal = gov.Content // TODO find a better name
type Proposal struct { type Proposal struct {
PubProposal PubProposal `json:"pub_proposal" yaml:"pub_proposal"`
ID uint64 ID uint64 `json:"id" yaml:"id"`
CommitteeID uint64 CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
Deadline time.Time Deadline time.Time `json:"deadline" yaml:"deadline"`
} }
// HasExpiredBy calculates if the proposal will have expired by a certain time. // HasExpiredBy calculates if the proposal will have expired by a certain time.
@ -105,7 +105,7 @@ func (p Proposal) String() string {
} }
type Vote struct { type Vote struct {
ProposalID uint64 ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
Voter sdk.AccAddress Voter sdk.AccAddress `json:"voter" yaml:"voter"`
// Option byte // TODO for now don't need more than just a yes as options // Option byte // TODO for now don't need more than just a yes as options
} }