-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gamm Spec Out V3 - Modulize File Structure #541
Merged
Merged
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
46620fb
Change proto Pool -> BalancerPool
mattverse a720994
Proto changes implementation
mattverse 0a4b0f5
Change proto
mattverse d804fc6
Revert Pool Query from BalancerPool
mattverse ec54a65
Change method names accordingly
mattverse 3e876f1
Adjust marshal.go to struct change
mattverse c7620c0
Fix test
mattverse ce85d2f
Revert Pool Params, remove Exitfee, Swapfee query
mattverse 81f6b74
Merge branch 'mattverse/gamm-spec-out' into mattverse/gamm-spec-out-v2
mattverse 6531615
Remove unused Yaml from gamm query import
mattverse c2759a6
Add Pool Params Query
mattverse 389e8ca
Merge branch 'mattverse/gamm-spec-out' into mattverse/gamm-spec-out-v2
mattverse b188e17
Revert yaml import
mattverse 0c51405
Revert marshal back to poolParams
mattverse 9efed1a
WIP: move balancerPool.proto into pool-models folder
mattverse bfa6735
WIP: moving balancer_pool.go logic from types -> pool-models
mattverse a62b2e3
WIP: Change in file structure
mattverse 58f4870
WIP: Changing packages
mattverse e6bcb00
Use types from balancer package
mattverse 9a29cd6
Revert go mod back to original state
mattverse 229bd59
Register Codec
mattverse 35e5a06
WIP: Fixing CLI test
mattverse 747813a
Fix proto Any field to Balancer specific
mattverse 3d04a93
Remove BalancerPoolParamsI
mattverse 8ec9a8d
Add switch cases to poolParams Query, clean up code
mattverse 8ffe3e8
WIP Merging main
mattverse efdb376
Merge branch 'main' into mattverse/gamm-spec-out-v3
mattverse 26981f9
Merge branch 'main' into mattverse/gamm-spec-out-v3.1
mattverse 209ddd6
Fix type from proto
mattverse 60b84e2
Cleanup code for test codes
mattverse eccdfee
Cleanup code for merge
mattverse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
proto/osmosis/gamm/pool-models/balancer/balancerPool.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
syntax = "proto3"; | ||
package osmosis.gamm.poolmodels; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
import "google/protobuf/duration.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
import "cosmos/auth/v1beta1/auth.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
import "osmosis/gamm/v1beta1/pool.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/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 initialPoolWeights = 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 targetPoolWeights = 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 | ||
// ]; | ||
} | ||
|
||
// BalancerPoolParams defined the parameters that will be managed by the pool | ||
// governance in the future. This params are not managed by the chain | ||
// governanace. Instead they will be managed by the token holders of the pool. | ||
mattverse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// The pool's token holders are specified in future_pool_governor. | ||
message BalancerPoolParams { | ||
string swapFee = 1 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.moretags) = "yaml:\"swap_fee\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
string exitFee = 2 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", | ||
(gogoproto.moretags) = "yaml:\"exit_fee\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
SmoothWeightChangeParams smoothWeightChangeParams = 3 [ | ||
(gogoproto.moretags) = "yaml:\"smooth_weight_change_params\"", | ||
(gogoproto.nullable) = true | ||
]; | ||
} | ||
|
||
message BalancerPool { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
option (cosmos_proto.implements_interface) = "PoolI"; | ||
|
||
string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; | ||
uint64 id = 2; | ||
|
||
BalancerPoolParams poolParams = 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 totalShares = 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 poolAssets = 6 [ | ||
(gogoproto.moretags) = "yaml:\"pool_assets\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
// sum of all non-normalized pool weights | ||
string totalWeight = 7 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.moretags) = "yaml:\"total_weight\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
syntax = "proto3"; | ||
package osmosis.gamm.poolmodels; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "osmosis/gamm/pool-models/balancer/balancerPool.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
import "osmosis/gamm/v1beta1/pool.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/x/gamm/pool-models/balancer"; | ||
|
||
service Msg { | ||
rpc CreateBalancerPool(MsgCreateBalancerPool) | ||
returns (MsgCreateBalancerPoolResponse); | ||
} | ||
|
||
// ===================== MsgCreatePool | ||
message MsgCreateBalancerPool { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
|
||
BalancerPoolParams poolParams = 2 | ||
[ (gogoproto.moretags) = "yaml:\"pool_params\"" ]; | ||
|
||
repeated osmosis.gamm.v1beta1.PoolAsset poolAssets = 3 | ||
[ (gogoproto.nullable) = false ]; | ||
|
||
string future_pool_governor = 4 | ||
[ (gogoproto.moretags) = "yaml:\"future_pool_governor\"" ]; | ||
} | ||
|
||
message MsgCreateBalancerPoolResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this still be behind a v1beta1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to the entire file itself? If my understanding is right upon your question, pool-models is declared as a whole new package in gamm, thats where this is coming from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, tbh I don't really understand the v1beta1 stuff. Lets make an issue for this question, and then ask regen folks post-holidays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha. I'm supposing its just a legacy in structuring the proto files from the cosmos-sdk and that it does not have any additional functionallities. I didn't have any issues when I wasn't using v1beta1 as a package file structure, they should be good to be removed as well