-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
108 lines (88 loc) · 3.54 KB
/
flags.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
package cli
import (
flag "github.com/spf13/pflag"
"github.com/fury-labs/furya/v20/x/poolmanager/types"
)
const (
// Names of fields in pool json file.
PoolFileWeights = "weights"
PoolFileInitialDeposit = "initial-deposit"
PoolFileSwapFee = "swap-fee"
PoolFileExitFee = "exit-fee"
PoolFileFutureGovernor = "future-governor"
PoolFileSmoothWeightChangeParams = "lbp-params"
PoolFileStartTime = "start-time"
PoolFileDuration = "duration"
PoolFileTargetPoolWeights = "target-pool-weights"
// Will be parsed to string.
FlagPoolFile = "pool-file"
// Will be parsed to uint64.
FlagSwapRoutePoolIds = "swap-route-pool-ids"
// Will be parsed to []string.
FlagSwapRouteDenoms = "swap-route-denoms"
// Will be parsed to string.
FlagRoutesFile = "routes-file"
)
type createBalancerPoolInputs struct {
Weights string `json:"weights"`
InitialDeposit string `json:"initial-deposit"`
SwapFee string `json:"swap-fee"`
ExitFee string `json:"exit-fee"`
FutureGovernor string `json:"future-governor"`
SmoothWeightChangeParams smoothWeightChangeParamsInputs `json:"lbp-params"`
}
type createStableswapPoolInputs struct {
InitialDeposit string `json:"initial-deposit"`
SwapFee string `json:"swap-fee"`
ExitFee string `json:"exit-fee"`
FutureGovernor string `json:"future-governor"`
ScalingFactorController string `json:"scaling-factor-controller"`
ScalingFactors string `json:"scaling-factors"`
}
type smoothWeightChangeParamsInputs struct {
StartTime string `json:"start-time"`
Duration string `json:"duration"`
TargetPoolWeights string `json:"target-pool-weights"`
}
type RoutesIn struct {
Route []SwapAmountInSplitRoute `json:"route"`
}
type RoutesOut struct {
Route []SwapAmountOutSplitRoute `json:"route"`
}
type SwapAmountInSplitRoute struct {
Pools []types.SwapAmountInRoute `json:"swap_amount_in_route"`
TokenInAmount int64 `json:"token_in_amount"`
}
type SwapAmountOutSplitRoute struct {
Pools []types.SwapAmountOutRoute `json:"swap_amount_out_route"`
TokenOutAmount int64 `json:"token_out_amount"`
}
func FlagSetMultihopSwapRoutes() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.String(FlagSwapRoutePoolIds, "", "swap route pool id")
fs.String(FlagSwapRouteDenoms, "", "swap route amount")
return fs
}
func FlagSetQuerySwapRoutes() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.StringArray(FlagSwapRoutePoolIds, []string{""}, "swap route pool id")
fs.StringArray(FlagSwapRouteDenoms, []string{""}, "swap route amount")
return fs
}
func FlagSetSwapAmountOutRoutes() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.StringArray(FlagSwapRoutePoolIds, []string{""}, "swap route pool ids")
fs.StringArray(FlagSwapRouteDenoms, []string{""}, "swap route denoms")
return fs
}
func FlagSetCreatePool() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.String(FlagPoolFile, "", "Pool json file path (if this path is given, other create pool flags should not be used)")
return fs
}
func FlagSetCreateRoutes() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.String(FlagRoutesFile, "", "Routes json file path (if this path is given, other routes flags should not be used)")
return fs
}