-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
querier.go
102 lines (88 loc) · 2.56 KB
/
querier.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// DONTCOVER
// query endpoints supported by the governance Querier
const (
QueryParams = "params"
QueryProposals = "proposals"
QueryProposal = "proposal"
QueryDeposits = "deposits"
QueryDeposit = "deposit"
QueryVotes = "votes"
QueryVote = "vote"
QueryTally = "tally"
ParamDeposit = "deposit"
ParamVoting = "voting"
ParamTallying = "tallying"
)
// QueryProposalParams Params for queries:
// - 'custom/gov/proposal'
// - 'custom/gov/deposits'
// - 'custom/gov/tally'
type QueryProposalParams struct {
ProposalID uint64
}
// NewQueryProposalParams creates a new instance of QueryProposalParams
func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
return QueryProposalParams{
ProposalID: proposalID,
}
}
// QueryProposalVotesParams used for queries to 'custom/gov/votes'.
type QueryProposalVotesParams struct {
ProposalID uint64
Page int
Limit int
}
// NewQueryProposalVotesParams creates new instance of the QueryProposalVotesParams.
func NewQueryProposalVotesParams(proposalID uint64, page, limit int) QueryProposalVotesParams {
return QueryProposalVotesParams{
ProposalID: proposalID,
Page: page,
Limit: limit,
}
}
// QueryDepositParams params for query 'custom/gov/deposit'
type QueryDepositParams struct {
ProposalID uint64
Depositor sdk.AccAddress
}
// NewQueryDepositParams creates a new instance of QueryDepositParams
func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams {
return QueryDepositParams{
ProposalID: proposalID,
Depositor: depositor,
}
}
// QueryVoteParams Params for query 'custom/gov/vote'
type QueryVoteParams struct {
ProposalID uint64
Voter sdk.AccAddress
}
// NewQueryVoteParams creates a new instance of QueryVoteParams
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams {
return QueryVoteParams{
ProposalID: proposalID,
Voter: voter,
}
}
// QueryProposalsParams Params for query 'custom/gov/proposals'
type QueryProposalsParams struct {
Page int
Limit int
Voter sdk.AccAddress
Depositor sdk.AccAddress
ProposalStatus ProposalStatus
}
// NewQueryProposalsParams creates a new instance of QueryProposalsParams
func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter, depositor sdk.AccAddress) QueryProposalsParams {
return QueryProposalsParams{
Page: page,
Limit: limit,
Voter: voter,
Depositor: depositor,
ProposalStatus: status,
}
}