-
Notifications
You must be signed in to change notification settings - Fork 607
/
balancerPool.proto
162 lines (146 loc) · 6.48 KB
/
balancerPool.proto
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
syntax = "proto3";
// this is a legacy package that requires additional migration logic
// in order to use the correct package. Decision made to use legacy package path
// until clear steps for migration logic and the unknowns for state breaking are
// investigated for changing proto package.
package osmosis.gamm.v1beta1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "cosmos/base/v1beta1/coin.proto";
option go_package = "github.com/osmosis-labs/osmosis/v28/x/gamm/pool-models/balancer";
// Parameters for changing the weights in a balancer pool smoothly from
// a start weight and end weight over a period of time.
// Currently, the only smooth change supported is linear changing between
// the two weights, but more types may be added in the future.
// When these parameters are set, the weight w(t) for pool time `t` is the
// following:
// t <= start_time: w(t) = initial_pool_weights
// start_time < t <= start_time + duration:
// w(t) = initial_pool_weights + (t - start_time) *
// (target_pool_weights - initial_pool_weights) / (duration)
// t > start_time + duration: w(t) = target_pool_weights
message SmoothWeightChangeParams {
// The start time for beginning the weight change.
// If a parameter change / pool instantiation leaves this blank,
// it should be generated by the state_machine as the current time.
google.protobuf.Timestamp start_time = 1 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"start_time\""
];
// Duration for the weights to change over
google.protobuf.Duration duration = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "duration,omitempty",
(gogoproto.moretags) = "yaml:\"duration\""
];
// The initial pool weights. These are copied from the pool's settings
// at the time of weight change instantiation.
// The amount PoolAsset.token.amount field is ignored if present,
// future type refactorings should just have a type with the denom & weight
// here.
repeated osmosis.gamm.v1beta1.PoolAsset initial_pool_weights = 3 [
(gogoproto.moretags) = "yaml:\"initial_pool_weights\"",
(gogoproto.nullable) = false
];
// The target pool weights. The pool weights will change linearly with respect
// to time between start_time, and start_time + duration. The amount
// PoolAsset.token.amount field is ignored if present, future type
// refactorings should just have a type with the denom & weight here.
repeated osmosis.gamm.v1beta1.PoolAsset target_pool_weights = 4 [
(gogoproto.moretags) = "yaml:\"target_pool_weights\"",
(gogoproto.nullable) = false
];
// Intermediate variable for the 'slope' of pool weights. This is equal to
// (target_pool_weights - initial_pool_weights) / (duration)
// TODO: Work out precision, and decide if this is good to add
// repeated PoolAsset poolWeightSlope = 5 [
// (gogoproto.moretags) = "yaml:\"pool_weight_slope\"",
// (gogoproto.nullable) = false
// ];
}
// PoolParams defined the parameters that will be managed by the pool
// governance in the future. This params are not managed by the chain
// governance. Instead they will be managed by the token holders of the pool.
// The pool's token holders are specified in future_pool_governor.
message PoolParams {
option (amino.name) = "osmosis/gamm/BalancerPoolParams";
string swap_fee = 1 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.moretags) = "yaml:\"swap_fee\"",
(gogoproto.nullable) = false
];
// N.B.: exit fee is disabled during pool creation in x/poolmanager. While old
// pools can maintain a non-zero fee. No new pool can be created with non-zero
// fee anymore
string exit_fee = 2 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.moretags) = "yaml:\"exit_fee\"",
(gogoproto.nullable) = false
];
SmoothWeightChangeParams smooth_weight_change_params = 3 [
(gogoproto.moretags) = "yaml:\"smooth_weight_change_params\"",
(gogoproto.nullable) = true
];
}
// Pool asset is an internal struct that combines the amount of the
// token in the pool, and its balancer weight.
// This is an awkward packaging of data,
// and should be revisited in a future state migration.
message PoolAsset {
// Coins we are talking about,
// the denomination must be unique amongst all PoolAssets for this pool.
cosmos.base.v1beta1.Coin token = 1
[ (gogoproto.moretags) = "yaml:\"token\"", (gogoproto.nullable) = false ];
// Weight that is not normalized. This weight must be less than 2^50
string weight = 2 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"weight\"",
(gogoproto.nullable) = false
];
}
message Pool {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "PoolI";
option (amino.name) = "osmosis/gamm/BalancerPool";
string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];
uint64 id = 2;
PoolParams pool_params = 3 [
(gogoproto.moretags) = "yaml:\"balancer_pool_params\"",
(gogoproto.nullable) = false
];
// This string specifies who will govern the pool in the future.
// Valid forms of this are:
// {token name},{duration}
// {duration}
// where {token name} if specified is the token which determines the
// governor, and if not specified is the LP token for this pool.duration is
// a time specified as 0w,1w,2w, etc. which specifies how long the token
// would need to be locked up to count in governance. 0w means no lockup.
// TODO: Further improve these docs
string future_pool_governor = 4
[ (gogoproto.moretags) = "yaml:\"future_pool_governor\"" ];
// sum of all LP tokens sent out
cosmos.base.v1beta1.Coin total_shares = 5 [
(gogoproto.moretags) = "yaml:\"total_shares\"",
(gogoproto.nullable) = false
];
// These are assumed to be sorted by denomiation.
// They contain the pool asset and the information about the weight
repeated osmosis.gamm.v1beta1.PoolAsset pool_assets = 6 [
(gogoproto.moretags) = "yaml:\"pool_assets\"",
(gogoproto.nullable) = false
];
// sum of all non-normalized pool weights
string total_weight = 7 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"total_weight\"",
(gogoproto.nullable) = false
];
}