-
Notifications
You must be signed in to change notification settings - Fork 1
/
querier.go
executable file
·83 lines (72 loc) · 1.93 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// 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"
)
// Params for queries:
// - 'custom/gov/proposal'
// - 'custom/gov/deposits'
// - 'custom/gov/tally'
// - 'custom/gov/votes'
type QueryProposalParams struct {
ProposalID uint64
}
// creates a new instance of QueryProposalParams
func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
return QueryProposalParams{
ProposalID: proposalID,
}
}
// Params for query 'custom/gov/deposit'
type QueryDepositParams struct {
ProposalID uint64
Depositor sdk.AccAddress
}
// creates a new instance of QueryDepositParams
func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams {
return QueryDepositParams{
ProposalID: proposalID,
Depositor: depositor,
}
}
// Params for query 'custom/gov/vote'
type QueryVoteParams struct {
ProposalID uint64
Voter sdk.AccAddress
}
// creates a new instance of QueryVoteParams
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams {
return QueryVoteParams{
ProposalID: proposalID,
Voter: voter,
}
}
// Params for query 'custom/gov/proposals'
type QueryProposalsParams struct {
Voter sdk.AccAddress
Depositor sdk.AccAddress
ProposalStatus ProposalStatus
Limit uint64
}
// creates a new instance of QueryProposalsParams
func NewQueryProposalsParams(status ProposalStatus, limit uint64, voter, depositor sdk.AccAddress) QueryProposalsParams {
return QueryProposalsParams{
Voter: voter,
Depositor: depositor,
ProposalStatus: status,
Limit: limit,
}
}