-
Notifications
You must be signed in to change notification settings - Fork 608
/
query.go
148 lines (131 loc) · 5.68 KB
/
query.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package cli
import (
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/osmosis-labs/osmosis/osmoutils/osmocli"
"github.com/osmosis-labs/osmosis/v28/x/concentrated-liquidity/client/queryproto"
"github.com/osmosis-labs/osmosis/v28/x/concentrated-liquidity/types"
)
// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd() *cobra.Command {
cmd := osmocli.QueryIndexCmd(types.ModuleName)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetCmdPools)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetUserPositions)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetPositionById)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetClaimableSpreadRewards)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetClaimableIncentives)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetIncentiveRecords)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetCFMMPoolIdLinkFromConcentratedPoolId)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetTickLiquidityNetInDirection)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetPoolAccumulatorRewards)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetTickAccumulatorTrackers)
osmocli.AddQueryCmd(cmd, queryproto.NewQueryClient, GetLiquidityPerTickRange)
cmd.AddCommand(
osmocli.GetParams[*queryproto.ParamsRequest](
types.ModuleName, queryproto.NewQueryClient),
)
return cmd
}
func GetUserPositions() (*osmocli.QueryDescriptor, *queryproto.UserPositionsRequest) {
return &osmocli.QueryDescriptor{
Use: "user-positions",
Short: "Query user's positions",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} user-positions osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj`,
Flags: osmocli.FlagDesc{OptionalFlags: []*flag.FlagSet{FlagSetJustPoolId()}},
CustomFlagOverrides: poolIdFlagOverride,
},
&queryproto.UserPositionsRequest{}
}
func GetPositionById() (*osmocli.QueryDescriptor, *queryproto.PositionByIdRequest) {
return &osmocli.QueryDescriptor{
Use: "position-by-id",
Short: "Query position by ID",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} position-by-id 53`,
},
&queryproto.PositionByIdRequest{}
}
func GetCmdPools() (*osmocli.QueryDescriptor, *queryproto.PoolsRequest) {
return &osmocli.QueryDescriptor{
Use: "pools",
Short: "Query pools",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} pools`,
}, &queryproto.PoolsRequest{}
}
func GetClaimableSpreadRewards() (*osmocli.QueryDescriptor, *queryproto.ClaimableSpreadRewardsRequest) {
return &osmocli.QueryDescriptor{
Use: "claimable-spread-rewards",
Short: "Query claimable spread rewards",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} claimable-spread-rewards 53`,
}, &queryproto.ClaimableSpreadRewardsRequest{}
}
func GetClaimableIncentives() (*osmocli.QueryDescriptor, *queryproto.ClaimableIncentivesRequest) {
return &osmocli.QueryDescriptor{
Use: "claimable-incentives",
Short: "Query claimable incentives",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} claimable-incentives 53`,
}, &queryproto.ClaimableIncentivesRequest{}
}
func GetIncentiveRecords() (*osmocli.QueryDescriptor, *queryproto.IncentiveRecordsRequest) {
return &osmocli.QueryDescriptor{
Use: "incentive-records",
Short: "Query incentive records for a given pool",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} incentive-records 1`,
}, &queryproto.IncentiveRecordsRequest{}
}
func GetCFMMPoolIdLinkFromConcentratedPoolId() (*osmocli.QueryDescriptor, *queryproto.CFMMPoolIdLinkFromConcentratedPoolIdRequest) {
return &osmocli.QueryDescriptor{
Use: "cfmm-pool-link-from-cl",
Short: "Query cfmm pool id link from concentrated pool id",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} cfmm-pool-link-from-cl 1`,
}, &queryproto.CFMMPoolIdLinkFromConcentratedPoolIdRequest{}
}
func GetTotalLiquidity() (*osmocli.QueryDescriptor, *queryproto.GetTotalLiquidityRequest) {
return &osmocli.QueryDescriptor{
Use: "total-liquidity",
Short: "Query total liquidity across all concentrated pool",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} total-liquidity 1`,
}, &queryproto.GetTotalLiquidityRequest{}
}
func GetTickLiquidityNetInDirection() (*osmocli.QueryDescriptor, *queryproto.LiquidityNetInDirectionRequest) {
return &osmocli.QueryDescriptor{
Use: "liquidity-net-in-direction",
Short: "Query liquidity net in direction",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} 4 uosmo "[-18000000]" true "[-9000000]" true
[poolid] [inputDenom] [start tick] [use cur tick] [bound tick] [use_no_bound]
TODO: What does any of that mean...?`,
}, &queryproto.LiquidityNetInDirectionRequest{}
}
func GetLiquidityPerTickRange() (*osmocli.QueryDescriptor, *queryproto.LiquidityPerTickRangeRequest) {
return &osmocli.QueryDescriptor{
Use: "liquidity-per-tick-range",
Short: "Query liquidity per tick range",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} 1
[poolid]`,
}, &queryproto.LiquidityPerTickRangeRequest{}
}
func GetPoolAccumulatorRewards() (*osmocli.QueryDescriptor, *queryproto.PoolAccumulatorRewardsRequest) {
return &osmocli.QueryDescriptor{
Use: "pool-accumulator-rewards",
Short: "Query pool accumulator rewards",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} pool-accumulator-rewards 1`,
}, &queryproto.PoolAccumulatorRewardsRequest{}
}
func GetTickAccumulatorTrackers() (*osmocli.QueryDescriptor, *queryproto.TickAccumulatorTrackersRequest) {
return &osmocli.QueryDescriptor{
Use: "tick-accumulator-trackers",
Short: "Query tick accumulator trackers",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} tick-accumulator-trackers 1 "[-18000000]"`,
}, &queryproto.TickAccumulatorTrackersRequest{}
}