/
querier.go
executable file
·87 lines (73 loc) · 2.77 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// Defines the prefix of each query path
const (
QueryParameters = "parameters"
QueryExchangeRate = "exchangeRate"
QueryExchangeRates = "exchangeRates"
QueryPriceSnapshotHistory = "priceSnapshotHistory"
QueryTwaps = "twaps"
QueryActives = "actives"
QueryFeederDelegation = "feederDelegation"
QueryVotePenaltyCounter = "votePenaltyCounter"
QueryAggregateVote = "aggregateVote"
QueryAggregateVotes = "aggregateVotes"
QueryVoteTargets = "voteTargets"
)
// QueryExchangeRateParams defines the params for the following queries:
// - 'custom/oracle/exchange_rate'
type QueryExchangeRateParams struct {
Denom string
}
// NewQueryExchangeRateParams returns params for exchange_rate query
func NewQueryExchangeRateParams(denom string) QueryExchangeRateParams {
return QueryExchangeRateParams{denom}
}
// QueryTwapParams defines the params for the following queries:
// - 'custom/oracle/twap'
type QueryTwapsParams struct {
LookbackSeconds int64
}
// NewQueryExchangeRateParams returns params for exchange_rate query
func NewQueryTwapsParams(lookbackSeconds int64) QueryTwapsParams {
return QueryTwapsParams{lookbackSeconds}
}
// QueryVotesParams defines the params for the following queries:
// - 'custom/oracle/votes'
type QueryVotesParams struct {
Voter sdk.ValAddress
Denom string
}
// NewQueryVotesParams returns params for exchange_rate votes query
func NewQueryVotesParams(voter sdk.ValAddress, denom string) QueryVotesParams {
return QueryVotesParams{voter, denom}
}
// QueryFeederDelegationParams defeins the params for the following queries:
// - 'custom/oracle/feederDelegation'
type QueryFeederDelegationParams struct {
Validator sdk.ValAddress
}
// NewQueryFeederDelegationParams returns params for feeder delegation query
func NewQueryFeederDelegationParams(validator sdk.ValAddress) QueryFeederDelegationParams {
return QueryFeederDelegationParams{validator}
}
// QueryMissCounterParams defines the params for the following queries:
// - 'custom/oracle/missCounter'
type QueryVotePenaltyCounterParams struct {
Validator sdk.ValAddress
}
// NewQueryVotePenaltyCounterParams returns params for feeder delegation query
func NewQueryVotePenaltyCounterParams(validator sdk.ValAddress) QueryVotePenaltyCounterParams {
return QueryVotePenaltyCounterParams{validator}
}
// QueryAggregateVoteParams defines the params for the following queries:
// - 'custom/oracle/aggregateVote'
type QueryAggregateVoteParams struct {
Validator sdk.ValAddress
}
// NewQueryAggregateVoteParams returns params for feeder delegation query
func NewQueryAggregateVoteParams(validator sdk.ValAddress) QueryAggregateVoteParams {
return QueryAggregateVoteParams{validator}
}