mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
add struct tags everywhere
This commit is contained in:
parent
66d368c722
commit
0275b21173
@ -37,4 +37,7 @@ func RegisterCodec(cdc *codec.Codec) {
|
||||
|
||||
cdc.RegisterInterface((*Permission)(nil), nil)
|
||||
cdc.RegisterConcrete(GodPermission{}, "kava/GodPermission", nil)
|
||||
|
||||
cdc.RegisterConcrete(MsgSubmitProposal{}, "kava/MsgSubmitProposal", nil)
|
||||
cdc.RegisterConcrete(MsgVote{}, "kava/MsgVote", nil)
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ const DefaultNextProposalID uint64 = 1
|
||||
|
||||
// GenesisState is state that must be provided at chain genesis.
|
||||
type GenesisState struct {
|
||||
NextProposalID uint64
|
||||
Committees []Committee
|
||||
Proposals []Proposal
|
||||
Votes []Vote
|
||||
NextProposalID uint64 `json:"next_proposal_id" yaml:"next_proposal_id"`
|
||||
Committees []Committee `json:"committees" yaml:"committees"`
|
||||
Proposals []Proposal `json:"proposals" yaml:"proposals"`
|
||||
Votes []Vote `json:"votes" yaml:"votes"`
|
||||
}
|
||||
|
||||
// NewGenesisState returns a new genesis state object for the module.
|
||||
|
@ -14,9 +14,9 @@ const (
|
||||
|
||||
// CommitteeChangeProposal is a gov proposal for creating a new committee or modifying an existing one.
|
||||
type CommitteeChangeProposal struct {
|
||||
Title string
|
||||
Description string
|
||||
NewCommittee Committee
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
NewCommittee Committee `json:"new_committee" yaml:"new_committee"`
|
||||
}
|
||||
|
||||
var _ govtypes.Content = CommitteeChangeProposal{}
|
||||
@ -69,9 +69,9 @@ func (ccp CommitteeChangeProposal) String() string {
|
||||
|
||||
// CommitteeDeleteProposal is a gov proposal for removing a committee.
|
||||
type CommitteeDeleteProposal struct {
|
||||
Title string
|
||||
Description string
|
||||
CommitteeID uint64
|
||||
Title string `json:"title" yaml:"title"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
|
||||
}
|
||||
|
||||
var _ govtypes.Content = CommitteeDeleteProposal{}
|
||||
|
@ -15,7 +15,7 @@ var _, _ sdk.Msg = MsgSubmitProposal{}, MsgVote{}
|
||||
type MsgSubmitProposal struct {
|
||||
PubProposal PubProposal `json:"pub_proposal" yaml:"pub_proposal"`
|
||||
Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"`
|
||||
CommitteeID uint64
|
||||
CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
|
||||
}
|
||||
|
||||
// NewMsgSubmitProposal creates a new MsgSubmitProposal instance
|
||||
|
@ -50,7 +50,7 @@ func (ShutdownCDPDepsitPermission) Allows(p gov.Content) bool {
|
||||
|
||||
// Same as above but the route isn't static
|
||||
type GeneralShutdownPermission struct {
|
||||
MsgRoute sdtypes.MsgRoute
|
||||
MsgRoute sdtypes.MsgRoute `json:"msg_route" yaml:"msg_route"`
|
||||
}
|
||||
|
||||
var _ Permission = GeneralShutdownPermission{}
|
||||
|
@ -17,7 +17,7 @@ const (
|
||||
)
|
||||
|
||||
type QueryCommitteeParams struct {
|
||||
CommitteeID uint64
|
||||
CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
|
||||
}
|
||||
|
||||
func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams {
|
||||
@ -27,7 +27,7 @@ func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams {
|
||||
}
|
||||
|
||||
type QueryProposalParams struct {
|
||||
ProposalID uint64
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
|
||||
}
|
||||
|
||||
func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
|
||||
@ -37,8 +37,8 @@ func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
|
||||
}
|
||||
|
||||
type QueryVoteParams struct {
|
||||
ProposalID uint64
|
||||
Voter sdk.AccAddress
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
|
||||
Voter sdk.AccAddress `json:"voter" yaml:"voter"`
|
||||
}
|
||||
|
||||
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams {
|
||||
|
@ -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.
|
||||
type Committee struct {
|
||||
ID uint64 // TODO or a name?
|
||||
Members []sdk.AccAddress
|
||||
Permissions []Permission
|
||||
ID uint64 `json:"id" yaml:"id"` // TODO or a name?
|
||||
Members []sdk.AccAddress `json:"members" yaml:"members"`
|
||||
Permissions []Permission `json:"permissions" yaml:"permissions"`
|
||||
}
|
||||
|
||||
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 Proposal struct {
|
||||
PubProposal
|
||||
ID uint64
|
||||
CommitteeID uint64
|
||||
Deadline time.Time
|
||||
PubProposal `json:"pub_proposal" yaml:"pub_proposal"`
|
||||
ID uint64 `json:"id" yaml:"id"`
|
||||
CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
|
||||
Deadline time.Time `json:"deadline" yaml:"deadline"`
|
||||
}
|
||||
|
||||
// HasExpiredBy calculates if the proposal will have expired by a certain time.
|
||||
@ -105,7 +105,7 @@ func (p Proposal) String() string {
|
||||
}
|
||||
|
||||
type Vote struct {
|
||||
ProposalID uint64
|
||||
Voter sdk.AccAddress
|
||||
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
|
||||
Voter sdk.AccAddress `json:"voter" yaml:"voter"`
|
||||
// Option byte // TODO for now don't need more than just a yes as options
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user