diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e5b80584fe..c2ba7554824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ Types of changes (Stanzas): "Bug Fixes" for any bug fixes. "Client Breaking" for breaking CLI commands and REST routes used by end-users. "API Breaking" for breaking exported APIs used by developers building on SDK. -"State Machine Breaking" for any changes that result in a different AppState +"State Machine Breaking" for any changes that result in a different AppState given same genesisState and txList. Ref: https://keepachangelog.com/en/1.0.0/ --> @@ -61,8 +61,8 @@ ProtoRev Changes (x/protorev): - Modifies the payment schedule for the dev account from weekly to after every trade. - Triggers backruns, joinPool, and exitPool using hooks. -TokenFactory before send hooks (x/tokenfactory): -- This enhancement allows for executing custom logic before sending tokens, providing more flexibility +TokenFactory before send hooks (x/tokenfactory): +- This enhancement allows for executing custom logic before sending tokens, providing more flexibility and control over token transfers. @@ -100,7 +100,7 @@ and control over token transfers. ## State Breaking * [#5380](https://github.com/osmosis-labs/osmosis/pull/5380) feat: add ica authorized messages in upgrade handler * [#5363](https://github.com/osmosis-labs/osmosis/pull/5363) fix: twap record upgrade handler - * [#5265](https://github.com/osmosis-labs/osmosis/pull/5265) fix: expect single synthetic lock per native lock ID + * [#5265](https://github.com/osmosis-labs/osmosis/pull/5265) fix: expect single synthetic lock per native lock ID * [#4983](https://github.com/osmosis-labs/osmosis/pull/4983) implement gas consume on denom creation * [#4830](https://github.com/osmosis-labs/osmosis/pull/4830) Scale gas costs by denoms in gauge (AddToGaugeReward) * [#5511](https://github.com/osmosis-labs/osmosis/pull/5511) Scale gas costs by denoms in gauge (CreateGauge) @@ -111,12 +111,11 @@ and control over token transfers. * [#5468](https://github.com/osmosis-labs/osmosis/pull/5468) fix: Reduce tokenfactory denom creation gas fee to 1_000_000 ## Dependencies - * [#4783](https://github.com/osmosis-labs/osmosis/pull/4783) Update wasmd to 0.31 - * [#5404](https://github.com/osmosis-labs/osmosis/pull/5404) Cosmwasm Cherry security patch + * [#4783](https://github.com/osmosis-labs/osmosis/pull/4783) Update wasmd to 0.31 + * [#5404](https://github.com/osmosis-labs/osmosis/pull/5404) Cosmwasm Cherry security patch * [#5320](https://github.com/osmosis-labs/osmosis/pull/5320) minor: huckleberry ibc patch ### Misc Improvements - * [#5356](https://github.com/osmosis-labs/osmosis/pull/5356) Fix wrong restHandler for ReplaceMigrationRecordsProposal * [#5020](https://github.com/osmosis-labs/osmosis/pull/5020) Add gas config to the client.toml * [#5105](https://github.com/osmosis-labs/osmosis/pull/5105) Lint stableswap in the same manner as all of Osmosis @@ -136,11 +135,12 @@ and control over token transfers. * [#5239](https://github.com/osmosis-labs/osmosis/pull/5239) Implement `GetTotalPoolShares` public keeper function for GAMM. * [#5261](https://github.com/osmosis-labs/osmosis/pull/5261) Allows `UpdateFeeTokenProposal` to take in multiple fee tokens instead of just one. * [#5265](https://github.com/osmosis-labs/osmosis/pull/5265) Ensure a lock cannot point to multiple synthetic locks. Deprecates `SyntheticLockupsByLockupID` in favor of `SyntheticLockupByLockupID`. - * [#4950] (https://github.com/osmosis-labs/osmosis/pull/4950) Add in/out tokens to Concentrated Liquidity's AfterConcentratedPoolSwap hook + * [#4950](https://github.com/osmosis-labs/osmosis/pull/4950) Add in/out tokens to Concentrated Liquidity's AfterConcentratedPoolSwap hook * [#4629](https://github.com/osmosis-labs/osmosis/pull/4629) Add amino proto annotations * [#4830](https://github.com/osmosis-labs/osmosis/pull/4830) Add gas cost when we AddToGaugeRewards, linearly increase with coins to add * [#5000](https://github.com/osmosis-labs/osmosis/pull/5000) osmomath.Power panics for base < 1 to temporarily restrict broken logic for such base. * [#4336](https://github.com/osmosis-labs/osmosis/pull/4336) Move epochs module into its own go.mod + * [#5589](https://github.com/osmosis-labs/osmosis/pull/5589) Include linked balancer pool in incentivized pools query diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index edf88e7cac4..726834e0428 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -410,6 +410,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.DistrKeeper, appKeepers.PoolManagerKeeper, appKeepers.EpochsKeeper, + appKeepers.SuperfluidKeeper, ) appKeepers.PoolIncentivesKeeper = &poolIncentivesKeeper appKeepers.PoolManagerKeeper.SetPoolIncentivesKeeper(appKeepers.PoolIncentivesKeeper) diff --git a/proto/osmosis/gamm/v1beta1/genesis.proto b/proto/osmosis/gamm/v1beta1/genesis.proto index bb49d6af568..39a4f978986 100644 --- a/proto/osmosis/gamm/v1beta1/genesis.proto +++ b/proto/osmosis/gamm/v1beta1/genesis.proto @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "osmosis/gamm/v1beta1/shared.proto"; // Params holds parameters for the incentives module message Params { @@ -26,22 +27,3 @@ message GenesisState { Params params = 3 [ (gogoproto.nullable) = false ]; MigrationRecords migration_records = 4; } - -// MigrationRecords contains all the links between balancer and concentrated -// pools -message MigrationRecords { - repeated BalancerToConcentratedPoolLink balancer_to_concentrated_pool_links = - 1 [ (gogoproto.nullable) = false ]; -} - -// BalancerToConcentratedPoolLink defines a single link between a single -// balancer pool and a single concentrated liquidity pool. This link is used to -// allow a balancer pool to migrate to a single canonical full range -// concentrated liquidity pool position -// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can -// be linked to a maximum of one balancer pool. -message BalancerToConcentratedPoolLink { - option (gogoproto.equal) = true; - uint64 balancer_pool_id = 1; - uint64 cl_pool_id = 2; -} diff --git a/proto/osmosis/gamm/v1beta1/gov.proto b/proto/osmosis/gamm/v1beta1/gov.proto index 72476530ec1..b66d63c1643 100644 --- a/proto/osmosis/gamm/v1beta1/gov.proto +++ b/proto/osmosis/gamm/v1beta1/gov.proto @@ -3,6 +3,7 @@ package osmosis.gamm.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/gamm/v1beta1/genesis.proto"; +import "osmosis/gamm/v1beta1/shared.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; diff --git a/proto/osmosis/gamm/v1beta1/shared.proto b/proto/osmosis/gamm/v1beta1/shared.proto new file mode 100644 index 00000000000..994f392b17a --- /dev/null +++ b/proto/osmosis/gamm/v1beta1/shared.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package osmosis.gamm.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v16/x/gamm/types"; + +// MigrationRecords contains all the links between balancer and concentrated +// pools +message MigrationRecords { + repeated BalancerToConcentratedPoolLink balancer_to_concentrated_pool_links = + 1 [ (gogoproto.nullable) = false ]; +} + +// BalancerToConcentratedPoolLink defines a single link between a single +// balancer pool and a single concentrated liquidity pool. This link is used to +// allow a balancer pool to migrate to a single canonical full range +// concentrated liquidity pool position +// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can +// be linked to a maximum of one balancer pool. +message BalancerToConcentratedPoolLink { + option (gogoproto.equal) = true; + uint64 balancer_pool_id = 1; + uint64 cl_pool_id = 2; +} \ No newline at end of file diff --git a/proto/osmosis/pool-incentives/v1beta1/shared.proto b/proto/osmosis/pool-incentives/v1beta1/shared.proto new file mode 100644 index 00000000000..ecd6d8ea853 --- /dev/null +++ b/proto/osmosis/pool-incentives/v1beta1/shared.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package osmosis.poolincentives.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "osmosis/pool-incentives/v1beta1/incentives.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v16/x/pool-incentives/types"; + +// MigrationRecords contains all the links between balancer and concentrated +// pools. +// +// This is copied over from the gamm proto file in order to circumnavigate +// the circular dependency between the two modules. +message MigrationRecords { + repeated BalancerToConcentratedPoolLink balancer_to_concentrated_pool_links = + 1 [ (gogoproto.nullable) = false ]; +} + +// BalancerToConcentratedPoolLink defines a single link between a single +// balancer pool and a single concentrated liquidity pool. This link is used to +// allow a balancer pool to migrate to a single canonical full range +// concentrated liquidity pool position +// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can +// be linked to a maximum of one balancer pool. +// +// This is copied over from the gamm proto file in order to circumnavigate +// the circular dependency between the two modules. +message BalancerToConcentratedPoolLink { + option (gogoproto.equal) = true; + uint64 balancer_pool_id = 1; + uint64 cl_pool_id = 2; +} \ No newline at end of file diff --git a/x/gamm/types/genesis.pb.go b/x/gamm/types/genesis.pb.go index 629398f37e4..de9b260c84c 100644 --- a/x/gamm/types/genesis.pb.go +++ b/x/gamm/types/genesis.pb.go @@ -142,115 +142,9 @@ func (m *GenesisState) GetMigrationRecords() *MigrationRecords { return nil } -// MigrationRecords contains all the links between balancer and concentrated -// pools -type MigrationRecords struct { - BalancerToConcentratedPoolLinks []BalancerToConcentratedPoolLink `protobuf:"bytes,1,rep,name=balancer_to_concentrated_pool_links,json=balancerToConcentratedPoolLinks,proto3" json:"balancer_to_concentrated_pool_links"` -} - -func (m *MigrationRecords) Reset() { *m = MigrationRecords{} } -func (m *MigrationRecords) String() string { return proto.CompactTextString(m) } -func (*MigrationRecords) ProtoMessage() {} -func (*MigrationRecords) Descriptor() ([]byte, []int) { - return fileDescriptor_5a324eb7f1dd793e, []int{2} -} -func (m *MigrationRecords) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MigrationRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MigrationRecords.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MigrationRecords) XXX_Merge(src proto.Message) { - xxx_messageInfo_MigrationRecords.Merge(m, src) -} -func (m *MigrationRecords) XXX_Size() int { - return m.Size() -} -func (m *MigrationRecords) XXX_DiscardUnknown() { - xxx_messageInfo_MigrationRecords.DiscardUnknown(m) -} - -var xxx_messageInfo_MigrationRecords proto.InternalMessageInfo - -func (m *MigrationRecords) GetBalancerToConcentratedPoolLinks() []BalancerToConcentratedPoolLink { - if m != nil { - return m.BalancerToConcentratedPoolLinks - } - return nil -} - -// BalancerToConcentratedPoolLink defines a single link between a single -// balancer pool and a single concentrated liquidity pool. This link is used to -// allow a balancer pool to migrate to a single canonical full range -// concentrated liquidity pool position -// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can -// be linked to a maximum of one balancer pool. -type BalancerToConcentratedPoolLink struct { - BalancerPoolId uint64 `protobuf:"varint,1,opt,name=balancer_pool_id,json=balancerPoolId,proto3" json:"balancer_pool_id,omitempty"` - ClPoolId uint64 `protobuf:"varint,2,opt,name=cl_pool_id,json=clPoolId,proto3" json:"cl_pool_id,omitempty"` -} - -func (m *BalancerToConcentratedPoolLink) Reset() { *m = BalancerToConcentratedPoolLink{} } -func (m *BalancerToConcentratedPoolLink) String() string { return proto.CompactTextString(m) } -func (*BalancerToConcentratedPoolLink) ProtoMessage() {} -func (*BalancerToConcentratedPoolLink) Descriptor() ([]byte, []int) { - return fileDescriptor_5a324eb7f1dd793e, []int{3} -} -func (m *BalancerToConcentratedPoolLink) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BalancerToConcentratedPoolLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BalancerToConcentratedPoolLink.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BalancerToConcentratedPoolLink) XXX_Merge(src proto.Message) { - xxx_messageInfo_BalancerToConcentratedPoolLink.Merge(m, src) -} -func (m *BalancerToConcentratedPoolLink) XXX_Size() int { - return m.Size() -} -func (m *BalancerToConcentratedPoolLink) XXX_DiscardUnknown() { - xxx_messageInfo_BalancerToConcentratedPoolLink.DiscardUnknown(m) -} - -var xxx_messageInfo_BalancerToConcentratedPoolLink proto.InternalMessageInfo - -func (m *BalancerToConcentratedPoolLink) GetBalancerPoolId() uint64 { - if m != nil { - return m.BalancerPoolId - } - return 0 -} - -func (m *BalancerToConcentratedPoolLink) GetClPoolId() uint64 { - if m != nil { - return m.ClPoolId - } - return 0 -} - func init() { proto.RegisterType((*Params)(nil), "osmosis.gamm.v1beta1.Params") proto.RegisterType((*GenesisState)(nil), "osmosis.gamm.v1beta1.GenesisState") - proto.RegisterType((*MigrationRecords)(nil), "osmosis.gamm.v1beta1.MigrationRecords") - proto.RegisterType((*BalancerToConcentratedPoolLink)(nil), "osmosis.gamm.v1beta1.BalancerToConcentratedPoolLink") } func init() { @@ -258,70 +152,37 @@ func init() { } var fileDescriptor_5a324eb7f1dd793e = []byte{ - // 537 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x3f, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0x73, 0x6d, 0x1a, 0xfd, 0x7e, 0x57, 0x04, 0xa9, 0x95, 0xc1, 0xad, 0x2a, 0x27, 0x32, - 0x12, 0xca, 0x92, 0x33, 0x29, 0x7f, 0x86, 0x6c, 0x24, 0x12, 0x08, 0x54, 0x50, 0xe5, 0x32, 0xb1, - 0x58, 0x67, 0xe7, 0x6a, 0xac, 0xd8, 0xf7, 0x44, 0xbe, 0x4b, 0xd5, 0x6c, 0x8c, 0x8c, 0x48, 0xcc, - 0x20, 0x66, 0x66, 0x5e, 0x44, 0xc5, 0xd4, 0x91, 0xa9, 0xa0, 0x64, 0x61, 0xe6, 0x15, 0xa0, 0xfb, - 0xe3, 0xa8, 0x2a, 0x51, 0x27, 0xfb, 0x79, 0x9e, 0xcf, 0xf3, 0xf5, 0xf3, 0x7c, 0xef, 0x8c, 0x7d, - 0x10, 0x05, 0x88, 0x4c, 0x04, 0x29, 0x2d, 0x8a, 0xe0, 0xb4, 0x1f, 0x33, 0x49, 0xfb, 0x41, 0xca, - 0x38, 0x13, 0x99, 0x20, 0xd3, 0x12, 0x24, 0x38, 0x2d, 0xcb, 0x10, 0xc5, 0x10, 0xcb, 0xec, 0xb5, - 0x52, 0x48, 0x41, 0x03, 0x81, 0x7a, 0x33, 0xec, 0xde, 0x6e, 0x0a, 0x90, 0xe6, 0x2c, 0xd0, 0x51, - 0x3c, 0x3b, 0x09, 0x28, 0x9f, 0x57, 0xa5, 0x44, 0xeb, 0x44, 0xa6, 0xc7, 0x04, 0xb6, 0xe4, 0x99, - 0x28, 0x88, 0xa9, 0x60, 0xab, 0x21, 0x12, 0xc8, 0xb8, 0xa9, 0xfb, 0x9f, 0x11, 0x6e, 0x1c, 0xd1, - 0x92, 0x16, 0xc2, 0xf9, 0x88, 0xf0, 0xce, 0x14, 0x20, 0x8f, 0x92, 0x92, 0x51, 0x99, 0x01, 0x8f, - 0x4e, 0x18, 0x73, 0x51, 0x67, 0xb3, 0xbb, 0x7d, 0xb0, 0x4b, 0xac, 0xaa, 0xd2, 0xa9, 0x06, 0x25, - 0x23, 0xc8, 0xf8, 0xf0, 0xf0, 0xfc, 0xb2, 0x5d, 0xfb, 0x73, 0xd9, 0x76, 0xe7, 0xb4, 0xc8, 0x07, - 0xfe, 0x3f, 0x0a, 0xfe, 0xd7, 0x9f, 0xed, 0x6e, 0x9a, 0xc9, 0xb7, 0xb3, 0x98, 0x24, 0x50, 0xd8, - 0xf1, 0xec, 0xa3, 0x27, 0xc6, 0x93, 0x40, 0xce, 0xa7, 0x4c, 0x68, 0x31, 0x11, 0xde, 0x51, 0xfd, - 0x23, 0xdb, 0xfe, 0x94, 0x31, 0xff, 0xdd, 0x06, 0xbe, 0xf5, 0xcc, 0x98, 0x76, 0x2c, 0xa9, 0x64, - 0xce, 0x23, 0xbc, 0xa5, 0x18, 0x61, 0x27, 0x6b, 0x11, 0xe3, 0x0b, 0xa9, 0x7c, 0x21, 0x4f, 0xf8, - 0x7c, 0xf8, 0xff, 0xf7, 0x6f, 0xbd, 0xad, 0x23, 0x80, 0xfc, 0x79, 0x68, 0x68, 0xa7, 0x8b, 0x9b, - 0x9c, 0x9d, 0xc9, 0x48, 0xcf, 0xc7, 0x67, 0x45, 0xcc, 0x4a, 0x77, 0xa3, 0x83, 0xba, 0xf5, 0xf0, - 0xb6, 0xca, 0x2b, 0xf6, 0x95, 0xce, 0x3a, 0x03, 0xdc, 0x98, 0x6a, 0x47, 0xdc, 0xcd, 0x0e, 0xea, - 0x6e, 0x1f, 0xec, 0x93, 0x75, 0xa7, 0x44, 0x8c, 0x6b, 0xc3, 0xba, 0x5a, 0x3f, 0xb4, 0x1d, 0xce, - 0x31, 0xde, 0x29, 0xb2, 0xb4, 0x34, 0xcb, 0x97, 0x2c, 0x81, 0x72, 0x2c, 0xdc, 0xba, 0x96, 0xb9, - 0xb7, 0x5e, 0xe6, 0x65, 0x85, 0x87, 0x86, 0x0e, 0x9b, 0xc5, 0xb5, 0x8c, 0xff, 0x09, 0xe1, 0xe6, - 0x75, 0xcc, 0x79, 0x8f, 0xf0, 0xdd, 0x98, 0xe6, 0x94, 0x27, 0xac, 0x8c, 0x24, 0x44, 0x09, 0xf0, - 0x84, 0x71, 0x59, 0x52, 0xc9, 0xc6, 0x66, 0xc9, 0x3c, 0xe3, 0x93, 0xca, 0xa5, 0x87, 0xeb, 0x3f, - 0x3e, 0xb4, 0x02, 0xaf, 0x61, 0x74, 0xa5, 0x5d, 0x79, 0x71, 0x98, 0xf1, 0x89, 0xdd, 0xad, 0x1d, - 0xdf, 0x48, 0x09, 0x9f, 0x63, 0xef, 0x66, 0x21, 0x65, 0xfe, 0x6a, 0x56, 0x3d, 0x5b, 0x36, 0x76, - 0x91, 0x31, 0xbf, 0xca, 0xeb, 0xc3, 0x1a, 0x3b, 0xfb, 0x18, 0x27, 0xf9, 0x8a, 0x31, 0x07, 0xf4, - 0x5f, 0x92, 0x9b, 0xea, 0xa0, 0xfe, 0xfb, 0x4b, 0x1b, 0x0d, 0x5f, 0x9c, 0x2f, 0x3c, 0x74, 0xb1, - 0xf0, 0xd0, 0xaf, 0x85, 0x87, 0x3e, 0x2c, 0xbd, 0xda, 0xc5, 0xd2, 0xab, 0xfd, 0x58, 0x7a, 0xb5, - 0x37, 0xf7, 0xaf, 0xdc, 0x33, 0xbb, 0x70, 0x2f, 0xa7, 0xb1, 0xa8, 0x82, 0xe0, 0xb4, 0xff, 0x38, - 0x38, 0x33, 0x7f, 0xa4, 0xbe, 0x75, 0x71, 0x43, 0x5f, 0x9b, 0x07, 0x7f, 0x03, 0x00, 0x00, 0xff, - 0xff, 0xa6, 0x5b, 0xa5, 0xbb, 0xae, 0x03, 0x00, 0x00, + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xe3, 0x36, 0x8d, 0x84, 0x8b, 0xa0, 0xb5, 0x72, 0x70, 0x2b, 0xe4, 0x04, 0x1f, 0x90, + 0x2f, 0xd9, 0x25, 0x45, 0x70, 0xe8, 0x8d, 0x54, 0x02, 0x81, 0x00, 0x55, 0xee, 0x8d, 0x4b, 0xb4, + 0x76, 0xa6, 0xae, 0x85, 0xd7, 0x13, 0xed, 0x6e, 0xaa, 0xfa, 0xc6, 0x23, 0x20, 0x71, 0xe7, 0x01, + 0x38, 0xf3, 0x10, 0x15, 0xa7, 0x1e, 0x39, 0x05, 0x94, 0xbc, 0x01, 0x4f, 0x80, 0xf6, 0x8f, 0x11, + 0xa2, 0x39, 0xd9, 0x33, 0xf3, 0x9b, 0x6f, 0x67, 0xbe, 0xf1, 0x63, 0x94, 0x1c, 0x65, 0x29, 0x69, + 0xc1, 0x38, 0xa7, 0x97, 0xe3, 0x0c, 0x14, 0x1b, 0xd3, 0x02, 0x6a, 0x90, 0xa5, 0x24, 0x73, 0x81, + 0x0a, 0x83, 0xbe, 0x63, 0x88, 0x66, 0x88, 0x63, 0x0e, 0xfb, 0x05, 0x16, 0x68, 0x00, 0xaa, 0xff, + 0x2c, 0x7b, 0x78, 0x50, 0x20, 0x16, 0x15, 0x50, 0x13, 0x65, 0x8b, 0x73, 0xca, 0xea, 0xa6, 0x2d, + 0xe5, 0x46, 0x67, 0x6a, 0x7b, 0x6c, 0xe0, 0x4a, 0x91, 0x8d, 0x68, 0xc6, 0x24, 0xfc, 0x1d, 0x22, + 0xc7, 0xb2, 0x76, 0xf5, 0x87, 0x1b, 0xa7, 0x94, 0x17, 0x4c, 0xc0, 0xcc, 0x22, 0xf1, 0x17, 0xcf, + 0xef, 0x9d, 0x32, 0xc1, 0xb8, 0x0c, 0x3e, 0x7b, 0xfe, 0xfe, 0x1c, 0xb1, 0x9a, 0xe6, 0x02, 0x98, + 0x2a, 0xb1, 0x9e, 0x9e, 0x03, 0x84, 0xde, 0x70, 0x3b, 0xd9, 0x3d, 0x3a, 0x20, 0xee, 0x61, 0xfd, + 0x54, 0xbb, 0x0b, 0x39, 0xc1, 0xb2, 0x9e, 0xbc, 0xb9, 0x5e, 0x0e, 0x3a, 0xbf, 0x97, 0x83, 0xb0, + 0x61, 0xbc, 0x3a, 0x8e, 0x6f, 0x29, 0xc4, 0x5f, 0x7f, 0x0e, 0x92, 0xa2, 0x54, 0x17, 0x8b, 0x8c, + 0xe4, 0xc8, 0xdd, 0x06, 0xee, 0x33, 0x92, 0xb3, 0x0f, 0x54, 0x35, 0x73, 0x90, 0x46, 0x4c, 0xa6, + 0xf7, 0x75, 0xff, 0x89, 0x6b, 0x7f, 0x01, 0x10, 0x7f, 0xdc, 0xf2, 0xef, 0xbe, 0xb4, 0xbe, 0x9e, + 0x29, 0xa6, 0x20, 0x78, 0xea, 0xef, 0x68, 0x46, 0xba, 0xc9, 0xfa, 0xc4, 0x5a, 0x47, 0x5a, 0xeb, + 0xc8, 0xf3, 0xba, 0x99, 0xdc, 0xf9, 0xfe, 0x6d, 0xb4, 0x73, 0x8a, 0x58, 0xbd, 0x4a, 0x2d, 0x1d, + 0x24, 0xfe, 0x5e, 0x0d, 0x57, 0x6a, 0x6a, 0xe6, 0xab, 0x17, 0x3c, 0x03, 0x11, 0x6e, 0x0d, 0xbd, + 0xa4, 0x9b, 0xde, 0xd3, 0x79, 0xcd, 0xbe, 0x33, 0xd9, 0xe0, 0xd8, 0xef, 0xcd, 0x8d, 0x23, 0xe1, + 0xf6, 0xd0, 0x4b, 0x76, 0x8f, 0x1e, 0x90, 0x4d, 0x87, 0x24, 0xd6, 0xb5, 0x49, 0x57, 0xaf, 0x9f, + 0xba, 0x8e, 0xe0, 0xcc, 0xdf, 0xe7, 0x65, 0x21, 0xec, 0xf2, 0x02, 0x72, 0x14, 0x33, 0x19, 0x76, + 0x8d, 0xcc, 0xa3, 0xcd, 0x32, 0x6f, 0x5b, 0x3c, 0xb5, 0x74, 0xba, 0xc7, 0xff, 0xcb, 0x4c, 0x5e, + 0x5f, 0xaf, 0x22, 0xef, 0x66, 0x15, 0x79, 0xbf, 0x56, 0x91, 0xf7, 0x69, 0x1d, 0x75, 0x6e, 0xd6, + 0x51, 0xe7, 0xc7, 0x3a, 0xea, 0xbc, 0x7f, 0xfc, 0x8f, 0xaf, 0x4e, 0x7d, 0x54, 0xb1, 0x4c, 0xb6, + 0x01, 0xbd, 0x1c, 0x3f, 0xa3, 0x57, 0xf6, 0xfc, 0xc6, 0xe5, 0xac, 0x67, 0x6c, 0x7a, 0xf2, 0x27, + 0x00, 0x00, 0xff, 0xff, 0xc2, 0x24, 0x57, 0x27, 0xc1, 0x02, 0x00, 0x00, } -func (this *BalancerToConcentratedPoolLink) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*BalancerToConcentratedPoolLink) - if !ok { - that2, ok := that.(BalancerToConcentratedPoolLink) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.BalancerPoolId != that1.BalancerPoolId { - return false - } - if this.ClPoolId != that1.ClPoolId { - return false - } - return true -} func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -423,76 +284,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MigrationRecords) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MigrationRecords) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MigrationRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BalancerToConcentratedPoolLinks) > 0 { - for iNdEx := len(m.BalancerToConcentratedPoolLinks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BalancerToConcentratedPoolLinks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *BalancerToConcentratedPoolLink) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BalancerToConcentratedPoolLink) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BalancerToConcentratedPoolLink) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClPoolId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.ClPoolId)) - i-- - dAtA[i] = 0x10 - } - if m.BalancerPoolId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.BalancerPoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -543,36 +334,6 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *MigrationRecords) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.BalancerToConcentratedPoolLinks) > 0 { - for _, e := range m.BalancerToConcentratedPoolLinks { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *BalancerToConcentratedPoolLink) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BalancerPoolId != 0 { - n += 1 + sovGenesis(uint64(m.BalancerPoolId)) - } - if m.ClPoolId != 0 { - n += 1 + sovGenesis(uint64(m.ClPoolId)) - } - return n -} - func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -835,178 +596,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *MigrationRecords) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MigrationRecords: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MigrationRecords: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BalancerToConcentratedPoolLinks", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BalancerToConcentratedPoolLinks = append(m.BalancerToConcentratedPoolLinks, BalancerToConcentratedPoolLink{}) - if err := m.BalancerToConcentratedPoolLinks[len(m.BalancerToConcentratedPoolLinks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BalancerToConcentratedPoolLink) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BalancerToConcentratedPoolLink: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BalancerToConcentratedPoolLink: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BalancerPoolId", wireType) - } - m.BalancerPoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BalancerPoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClPoolId", wireType) - } - m.ClPoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClPoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gamm/types/gov.pb.go b/x/gamm/types/gov.pb.go index d8c69ee38d8..f880aff4a28 100644 --- a/x/gamm/types/gov.pb.go +++ b/x/gamm/types/gov.pb.go @@ -122,31 +122,32 @@ func init() { func init() { proto.RegisterFile("osmosis/gamm/v1beta1/gov.proto", fileDescriptor_f31b9a6c0dbbdfa3) } var fileDescriptor_f31b9a6c0dbbdfa3 = []byte{ - // 377 bytes of a gzipped FileDescriptorProto + // 388 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0x2f, 0xce, 0xcd, 0x2f, 0xce, 0x2c, 0xd6, 0x4f, 0x4f, 0xcc, 0xcd, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0xcf, 0x2f, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xca, 0xeb, 0x81, 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x05, 0xfa, 0x20, 0x16, 0x44, - 0xad, 0x94, 0x12, 0x76, 0xb3, 0x52, 0xf3, 0x52, 0x41, 0x06, 0x40, 0xd4, 0x48, 0x26, 0x83, 0x15, - 0xc5, 0x43, 0x34, 0x43, 0x38, 0x50, 0x29, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, 0x7d, 0x30, 0x09, - 0x11, 0x52, 0x6a, 0x67, 0xe2, 0x92, 0x0f, 0x4a, 0x2d, 0xc8, 0x49, 0x4c, 0x4e, 0xf5, 0xcd, 0x4c, - 0x2f, 0x4a, 0x2c, 0xc9, 0xcc, 0xcf, 0x0b, 0x4a, 0x4d, 0xce, 0x2f, 0x4a, 0x29, 0x0e, 0x28, 0xca, - 0x2f, 0xc8, 0x2f, 0x4e, 0xcc, 0x11, 0x12, 0xe1, 0x62, 0x2d, 0xc9, 0x2c, 0xc9, 0x49, 0x95, 0x60, - 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x84, 0x14, 0xb8, 0xb8, 0x53, 0x52, 0x8b, 0x93, 0x8b, - 0x32, 0x0b, 0x40, 0x7a, 0x24, 0x98, 0xc0, 0x72, 0xc8, 0x42, 0x42, 0x21, 0x5c, 0xec, 0x45, 0x10, - 0xa3, 0x24, 0x98, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x4c, 0xf4, 0xb0, 0xf9, 0x55, 0xcf, 0x29, 0x31, - 0x27, 0x31, 0x2f, 0x39, 0xb5, 0x28, 0x24, 0xdf, 0x39, 0x3f, 0x2f, 0x39, 0x35, 0xaf, 0xa4, 0x28, - 0xb1, 0x24, 0x35, 0x25, 0x20, 0x3f, 0x3f, 0xc7, 0x27, 0x33, 0x2f, 0xdb, 0x89, 0xe5, 0xc4, 0x3d, - 0x79, 0x86, 0x20, 0x98, 0x51, 0x56, 0x61, 0x1d, 0x0b, 0xe4, 0x19, 0x66, 0x2c, 0x90, 0x67, 0x78, - 0xb1, 0x40, 0x9e, 0xf1, 0xd4, 0x16, 0x5d, 0x29, 0xa8, 0x17, 0x41, 0x21, 0x0a, 0x33, 0xd1, 0x39, - 0x3f, 0xaf, 0x24, 0x35, 0xaf, 0xa4, 0xeb, 0xf9, 0x06, 0x2d, 0x75, 0x58, 0x90, 0x11, 0xf0, 0xa5, - 0x52, 0x2b, 0x13, 0x97, 0x5c, 0x68, 0x41, 0x4a, 0x62, 0xc9, 0x50, 0x09, 0x88, 0x50, 0xd2, 0x02, - 0x42, 0x0d, 0x16, 0x10, 0xf8, 0x3d, 0xe9, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, - 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, - 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, - 0xc3, 0x74, 0x73, 0x12, 0x93, 0x8a, 0x61, 0x1c, 0xfd, 0x32, 0x43, 0x33, 0xfd, 0x0a, 0x48, 0xda, - 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x27, 0x32, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xc1, 0xe0, 0x3a, 0x06, 0x04, 0x03, 0x00, 0x00, + 0xad, 0x94, 0x12, 0x76, 0xb3, 0x52, 0xf3, 0x52, 0x41, 0x06, 0x40, 0xd4, 0x28, 0x62, 0x55, 0x53, + 0x9c, 0x91, 0x58, 0x94, 0x9a, 0x02, 0x55, 0x22, 0x99, 0x0c, 0x56, 0x13, 0x0f, 0x31, 0x1f, 0xc2, + 0x81, 0x4a, 0x09, 0x26, 0xe6, 0x66, 0xe6, 0xe5, 0xeb, 0x83, 0x49, 0x88, 0x90, 0x52, 0x3b, 0x13, + 0x97, 0x7c, 0x50, 0x6a, 0x41, 0x4e, 0x62, 0x72, 0xaa, 0x6f, 0x66, 0x7a, 0x51, 0x62, 0x49, 0x66, + 0x7e, 0x5e, 0x50, 0x6a, 0x72, 0x7e, 0x51, 0x4a, 0x71, 0x40, 0x51, 0x7e, 0x41, 0x7e, 0x71, 0x62, + 0x8e, 0x90, 0x08, 0x17, 0x6b, 0x49, 0x66, 0x49, 0x4e, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, + 0x10, 0x84, 0x23, 0xa4, 0xc0, 0xc5, 0x9d, 0x92, 0x5a, 0x9c, 0x5c, 0x94, 0x59, 0x00, 0xd2, 0x23, + 0xc1, 0x04, 0x96, 0x43, 0x16, 0x12, 0x0a, 0xe1, 0x62, 0x2f, 0x82, 0x18, 0x25, 0xc1, 0xac, 0xc0, + 0xac, 0xc1, 0x6d, 0x64, 0xa2, 0x87, 0x2d, 0x38, 0xf4, 0x9c, 0x12, 0x73, 0x12, 0xf3, 0x92, 0x53, + 0x8b, 0x42, 0xf2, 0x9d, 0xf3, 0xf3, 0x92, 0x53, 0xf3, 0x4a, 0x8a, 0x12, 0x4b, 0x52, 0x53, 0x02, + 0xf2, 0xf3, 0x73, 0x7c, 0x32, 0xf3, 0xb2, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x19, + 0x65, 0x15, 0xd6, 0xb1, 0x40, 0x9e, 0x61, 0xc6, 0x02, 0x79, 0x86, 0x17, 0x0b, 0xe4, 0x19, 0x4f, + 0x6d, 0xd1, 0x95, 0x82, 0x7a, 0x11, 0x14, 0xe8, 0x30, 0x13, 0x9d, 0xf3, 0xf3, 0x4a, 0x52, 0xf3, + 0x4a, 0xba, 0x9e, 0x6f, 0xd0, 0x52, 0x87, 0x85, 0x18, 0x01, 0x5f, 0x2a, 0xb5, 0x32, 0x71, 0xc9, + 0x85, 0x16, 0xa4, 0x24, 0x96, 0x0c, 0x95, 0x80, 0x08, 0x25, 0x2d, 0x20, 0xd4, 0x60, 0x01, 0x81, + 0xdf, 0x93, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, + 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, + 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x35, 0x4c, 0x37, 0x27, 0x31, + 0xa9, 0x18, 0xc6, 0xd1, 0x2f, 0x33, 0x34, 0xd3, 0xaf, 0x80, 0x24, 0xcd, 0x92, 0xca, 0x82, 0xd4, + 0xe2, 0x24, 0x36, 0x70, 0x22, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x81, 0x15, 0x14, + 0x27, 0x03, 0x00, 0x00, } func (this *ReplaceMigrationRecordsProposal) Equal(that interface{}) bool { diff --git a/x/gamm/types/shared.pb.go b/x/gamm/types/shared.pb.go new file mode 100644 index 00000000000..275ba9cd76e --- /dev/null +++ b/x/gamm/types/shared.pb.go @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/gamm/v1beta1/shared.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MigrationRecords contains all the links between balancer and concentrated +// pools +type MigrationRecords struct { + BalancerToConcentratedPoolLinks []BalancerToConcentratedPoolLink `protobuf:"bytes,1,rep,name=balancer_to_concentrated_pool_links,json=balancerToConcentratedPoolLinks,proto3" json:"balancer_to_concentrated_pool_links"` +} + +func (m *MigrationRecords) Reset() { *m = MigrationRecords{} } +func (m *MigrationRecords) String() string { return proto.CompactTextString(m) } +func (*MigrationRecords) ProtoMessage() {} +func (*MigrationRecords) Descriptor() ([]byte, []int) { + return fileDescriptor_ecfa270aa4b2c075, []int{0} +} +func (m *MigrationRecords) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MigrationRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MigrationRecords.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MigrationRecords) XXX_Merge(src proto.Message) { + xxx_messageInfo_MigrationRecords.Merge(m, src) +} +func (m *MigrationRecords) XXX_Size() int { + return m.Size() +} +func (m *MigrationRecords) XXX_DiscardUnknown() { + xxx_messageInfo_MigrationRecords.DiscardUnknown(m) +} + +var xxx_messageInfo_MigrationRecords proto.InternalMessageInfo + +func (m *MigrationRecords) GetBalancerToConcentratedPoolLinks() []BalancerToConcentratedPoolLink { + if m != nil { + return m.BalancerToConcentratedPoolLinks + } + return nil +} + +// BalancerToConcentratedPoolLink defines a single link between a single +// balancer pool and a single concentrated liquidity pool. This link is used to +// allow a balancer pool to migrate to a single canonical full range +// concentrated liquidity pool position +// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can +// be linked to a maximum of one balancer pool. +type BalancerToConcentratedPoolLink struct { + BalancerPoolId uint64 `protobuf:"varint,1,opt,name=balancer_pool_id,json=balancerPoolId,proto3" json:"balancer_pool_id,omitempty"` + ClPoolId uint64 `protobuf:"varint,2,opt,name=cl_pool_id,json=clPoolId,proto3" json:"cl_pool_id,omitempty"` +} + +func (m *BalancerToConcentratedPoolLink) Reset() { *m = BalancerToConcentratedPoolLink{} } +func (m *BalancerToConcentratedPoolLink) String() string { return proto.CompactTextString(m) } +func (*BalancerToConcentratedPoolLink) ProtoMessage() {} +func (*BalancerToConcentratedPoolLink) Descriptor() ([]byte, []int) { + return fileDescriptor_ecfa270aa4b2c075, []int{1} +} +func (m *BalancerToConcentratedPoolLink) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalancerToConcentratedPoolLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalancerToConcentratedPoolLink.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalancerToConcentratedPoolLink) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalancerToConcentratedPoolLink.Merge(m, src) +} +func (m *BalancerToConcentratedPoolLink) XXX_Size() int { + return m.Size() +} +func (m *BalancerToConcentratedPoolLink) XXX_DiscardUnknown() { + xxx_messageInfo_BalancerToConcentratedPoolLink.DiscardUnknown(m) +} + +var xxx_messageInfo_BalancerToConcentratedPoolLink proto.InternalMessageInfo + +func (m *BalancerToConcentratedPoolLink) GetBalancerPoolId() uint64 { + if m != nil { + return m.BalancerPoolId + } + return 0 +} + +func (m *BalancerToConcentratedPoolLink) GetClPoolId() uint64 { + if m != nil { + return m.ClPoolId + } + return 0 +} + +func init() { + proto.RegisterType((*MigrationRecords)(nil), "osmosis.gamm.v1beta1.MigrationRecords") + proto.RegisterType((*BalancerToConcentratedPoolLink)(nil), "osmosis.gamm.v1beta1.BalancerToConcentratedPoolLink") +} + +func init() { proto.RegisterFile("osmosis/gamm/v1beta1/shared.proto", fileDescriptor_ecfa270aa4b2c075) } + +var fileDescriptor_ecfa270aa4b2c075 = []byte{ + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4a, 0x2b, 0x31, + 0x18, 0x85, 0x27, 0xf7, 0x96, 0xcb, 0x65, 0x04, 0x29, 0x43, 0x17, 0xb5, 0x48, 0x5a, 0xeb, 0xa6, + 0x1b, 0x27, 0x56, 0xc5, 0x85, 0xcb, 0xba, 0x52, 0x14, 0xa4, 0xb8, 0x72, 0x33, 0x24, 0x99, 0x98, + 0x86, 0x66, 0xf2, 0x97, 0x49, 0x5a, 0xec, 0x1b, 0xb8, 0xf4, 0x05, 0x04, 0x1f, 0xa7, 0xcb, 0x2e, + 0x5d, 0x89, 0xb4, 0x1b, 0x1f, 0x43, 0x3a, 0x99, 0x16, 0x17, 0xd2, 0x5d, 0x4e, 0xce, 0xf7, 0x1f, + 0xce, 0x9f, 0x84, 0x07, 0x60, 0x33, 0xb0, 0xca, 0x12, 0x49, 0xb3, 0x8c, 0x4c, 0xba, 0x4c, 0x38, + 0xda, 0x25, 0x76, 0x40, 0x73, 0x91, 0xc6, 0xa3, 0x1c, 0x1c, 0x44, 0xb5, 0x12, 0x89, 0x57, 0x48, + 0x5c, 0x22, 0x8d, 0x9a, 0x04, 0x09, 0x05, 0x40, 0x56, 0x27, 0xcf, 0x36, 0xf6, 0x24, 0x80, 0xd4, + 0x82, 0x14, 0x8a, 0x8d, 0x1f, 0x09, 0x35, 0xd3, 0xb5, 0xc5, 0x8b, 0x9c, 0xc4, 0xcf, 0x78, 0x51, + 0x5a, 0xd8, 0x2b, 0xc2, 0xa8, 0x15, 0x9b, 0x0e, 0x1c, 0x94, 0xf1, 0x7e, 0xfb, 0x15, 0x85, 0xd5, + 0x5b, 0x25, 0x73, 0xea, 0x14, 0x98, 0xbe, 0xe0, 0x90, 0xa7, 0x36, 0x7a, 0x46, 0xe1, 0x21, 0xa3, + 0x9a, 0x1a, 0x2e, 0xf2, 0xc4, 0x41, 0xc2, 0xc1, 0x70, 0x61, 0x5c, 0x4e, 0x9d, 0x48, 0x93, 0x11, + 0x80, 0x4e, 0xb4, 0x32, 0x43, 0x5b, 0x47, 0xad, 0xbf, 0x9d, 0x9d, 0x93, 0xb3, 0xf8, 0xb7, 0x2d, + 0xe2, 0x5e, 0x19, 0x70, 0x0f, 0x97, 0x3f, 0xc6, 0xef, 0x00, 0xf4, 0x8d, 0x32, 0xc3, 0x5e, 0x65, + 0xf6, 0xd1, 0x0c, 0xfa, 0x4d, 0xb6, 0x95, 0xb2, 0x6d, 0x13, 0xe2, 0xed, 0x41, 0x51, 0x27, 0xac, + 0x6e, 0xba, 0x16, 0xdd, 0x54, 0x5a, 0x47, 0x2d, 0xd4, 0xa9, 0xf4, 0x77, 0xd7, 0xf7, 0x2b, 0xf6, + 0x2a, 0x8d, 0xf6, 0xc3, 0x90, 0xeb, 0x0d, 0xf3, 0xa7, 0x60, 0xfe, 0x73, 0xed, 0xdd, 0x8b, 0xca, + 0xd7, 0x5b, 0x13, 0xf5, 0xae, 0x67, 0x0b, 0x8c, 0xe6, 0x0b, 0x8c, 0x3e, 0x17, 0x18, 0xbd, 0x2c, + 0x71, 0x30, 0x5f, 0xe2, 0xe0, 0x7d, 0x89, 0x83, 0x87, 0x63, 0xa9, 0xdc, 0x60, 0xcc, 0x62, 0x0e, + 0x19, 0x29, 0x17, 0x3e, 0xd2, 0x94, 0xd9, 0xb5, 0x20, 0x93, 0xee, 0x39, 0x79, 0xf2, 0x9f, 0xed, + 0xa6, 0x23, 0x61, 0xd9, 0xbf, 0xe2, 0x89, 0x4f, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x97, + 0x50, 0x5c, 0x09, 0x02, 0x00, 0x00, +} + +func (this *BalancerToConcentratedPoolLink) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BalancerToConcentratedPoolLink) + if !ok { + that2, ok := that.(BalancerToConcentratedPoolLink) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BalancerPoolId != that1.BalancerPoolId { + return false + } + if this.ClPoolId != that1.ClPoolId { + return false + } + return true +} +func (m *MigrationRecords) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MigrationRecords) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MigrationRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BalancerToConcentratedPoolLinks) > 0 { + for iNdEx := len(m.BalancerToConcentratedPoolLinks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BalancerToConcentratedPoolLinks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintShared(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BalancerToConcentratedPoolLink) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalancerToConcentratedPoolLink) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalancerToConcentratedPoolLink) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClPoolId != 0 { + i = encodeVarintShared(dAtA, i, uint64(m.ClPoolId)) + i-- + dAtA[i] = 0x10 + } + if m.BalancerPoolId != 0 { + i = encodeVarintShared(dAtA, i, uint64(m.BalancerPoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintShared(dAtA []byte, offset int, v uint64) int { + offset -= sovShared(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MigrationRecords) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BalancerToConcentratedPoolLinks) > 0 { + for _, e := range m.BalancerToConcentratedPoolLinks { + l = e.Size() + n += 1 + l + sovShared(uint64(l)) + } + } + return n +} + +func (m *BalancerToConcentratedPoolLink) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BalancerPoolId != 0 { + n += 1 + sovShared(uint64(m.BalancerPoolId)) + } + if m.ClPoolId != 0 { + n += 1 + sovShared(uint64(m.ClPoolId)) + } + return n +} + +func sovShared(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozShared(x uint64) (n int) { + return sovShared(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MigrationRecords) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MigrationRecords: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MigrationRecords: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BalancerToConcentratedPoolLinks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthShared + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthShared + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BalancerToConcentratedPoolLinks = append(m.BalancerToConcentratedPoolLinks, BalancerToConcentratedPoolLink{}) + if err := m.BalancerToConcentratedPoolLinks[len(m.BalancerToConcentratedPoolLinks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipShared(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShared + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalancerToConcentratedPoolLink) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalancerToConcentratedPoolLink: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalancerToConcentratedPoolLink: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BalancerPoolId", wireType) + } + m.BalancerPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BalancerPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClPoolId", wireType) + } + m.ClPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipShared(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShared + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipShared(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthShared + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupShared + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthShared + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthShared = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowShared = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupShared = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pool-incentives/keeper/grpc_query.go b/x/pool-incentives/keeper/grpc_query.go index 217c842e638..4fac3ff7aa1 100644 --- a/x/pool-incentives/keeper/grpc_query.go +++ b/x/pool-incentives/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -141,7 +142,9 @@ func (q Querier) IncentivizedPools(ctx context.Context, _ *types.QueryIncentiviz // While there are exceptions, typically the number of incentivizedPools // equals to the number of incentivized gauges / number of lockable durations. incentivizedPools := make([]types.IncentivizedPool, 0, len(distrInfo.Records)/len(lockableDurations)) + incentivizedPoolIDs := make(map[uint64]time.Duration) + // Loop over the distribution records and fill in the incentivized pools struct. for _, record := range distrInfo.Records { for _, lockableDuration := range lockableDurations { poolId, err := q.Keeper.GetPoolIdFromGaugeId(sdkCtx, record.GaugeId, lockableDuration) @@ -152,6 +155,39 @@ func (q Querier) IncentivizedPools(ctx context.Context, _ *types.QueryIncentiviz GaugeId: record.GaugeId, } + incentivizedPools = append(incentivizedPools, incentivizedPool) + incentivizedPoolIDs[poolId] = lockableDuration + } + } + } + + // Only run the following if the above loop determined there were incentivized pools. + if len(incentivizedPoolIDs) > 0 { + // Retrieve the migration records between balancer pools and concentrated liquidity pools. + // This comes from the superfluid keeper, since superfluid is the only pool incentives connected + // module that has access to the gamm modules store. + migrationRecords, err := q.superfluidKeeper.GetAllMigrationInfo(sdkCtx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + // Iterate over all migration records. + for _, record := range migrationRecords.BalancerToConcentratedPoolLinks { + // If the cl pool is not in the list of incentivized pools, skip it. + lockableDuration, incentivized := incentivizedPoolIDs[record.ClPoolId] + if !incentivized { + continue + } + + // Add the indirectly incentivized balancer pools to the list of incentivized pools. + gaugeId, err := q.Keeper.GetPoolGaugeId(sdkCtx, record.BalancerPoolId, lockableDuration) + if err == nil { + incentivizedPool := types.IncentivizedPool{ + PoolId: record.BalancerPoolId, + LockableDuration: lockableDuration, + GaugeId: gaugeId, + } + incentivizedPools = append(incentivizedPools, incentivizedPool) } } diff --git a/x/pool-incentives/keeper/grpc_query_test.go b/x/pool-incentives/keeper/grpc_query_test.go index 414443124e5..78ab6d32508 100644 --- a/x/pool-incentives/keeper/grpc_query_test.go +++ b/x/pool-incentives/keeper/grpc_query_test.go @@ -7,6 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + cltypes "github.com/osmosis-labs/osmosis/v16/x/concentrated-liquidity/types" + gammtypes "github.com/osmosis-labs/osmosis/v16/x/gamm/types" lockuptypes "github.com/osmosis-labs/osmosis/v16/x/lockup/types" "github.com/osmosis-labs/osmosis/v16/x/pool-incentives/types" ) @@ -156,14 +158,15 @@ func (s *KeeperTestSuite) TestLockableDurations() { func (s *KeeperTestSuite) TestIncentivizedPools() { for _, tc := range []struct { - desc string - poolCreated bool - weights []sdk.Int - clPoolWithGauge bool - clGaugeWeight sdk.Int - perpetual bool - nonPerpetual bool - expectedRecordLength int + desc string + poolCreated bool + weights []sdk.Int + clPoolWithGauge bool + clGaugeWeight sdk.Int + perpetual bool + nonPerpetual bool + setupPoolMigrationLink bool + expectedRecordLength int }{ { desc: "No pool exist", @@ -192,12 +195,21 @@ func (s *KeeperTestSuite) TestIncentivizedPools() { expectedRecordLength: 0, }, { - desc: "Concentrated case", + desc: "Concentrated case, no pool migration link", poolCreated: true, clPoolWithGauge: true, clGaugeWeight: sdk.NewInt(400), weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, - expectedRecordLength: 4, + expectedRecordLength: 3, // Note we expect 3 instead of 4 here, since the pool migration link is not setup. + }, + { + desc: "Concentrated case, setup pool migration link", + poolCreated: true, + clPoolWithGauge: true, + clGaugeWeight: sdk.NewInt(400), + weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, + setupPoolMigrationLink: true, + expectedRecordLength: 4, }, } { tc := tc @@ -205,34 +217,27 @@ func (s *KeeperTestSuite) TestIncentivizedPools() { s.SetupTest() keeper := s.App.PoolIncentivesKeeper queryClient := s.queryClient - var poolId uint64 + var balancerPoolId uint64 + + // Replace the longest lockable durations with the epoch duration to match the record that gets auto created when making a cl pool. + epochDuration := s.App.IncentivesKeeper.GetEpochInfo(s.Ctx).Duration + lockableDurations := keeper.GetLockableDurations(s.Ctx) + lockableDurations[len(lockableDurations)-1] = epochDuration + keeper.SetLockableDurations(s.Ctx, lockableDurations) + lockableDurations = keeper.GetLockableDurations(s.Ctx) + s.Require().Equal(3, len(lockableDurations)) + s.App.IncentivesKeeper.SetLockableDurations(s.Ctx, lockableDurations) + lockableDurations = s.App.IncentivesKeeper.GetLockableDurations(s.Ctx) + s.Require().Equal(3, len(lockableDurations)) - var lockableDurations []time.Duration if tc.poolCreated { - // prepare a balancer pool - poolId = s.PrepareBalancerPool() - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations = keeper.GetLockableDurations(s.Ctx) - s.Require().Equal(3, len(lockableDurations)) + balancerPoolId = s.PrepareBalancerPoolWithCoins(sdk.NewCoin("eth", sdk.NewInt(100000000000)), sdk.NewCoin("usdc", sdk.NewInt(100000000000))) var distRecords []types.DistrRecord - // If appropriate, create a concentrated pool with a gauge. - // Recall that concentrated pool gauges are created on epoch duration, which - // is set in default genesis to be 168 hours (1 week). Since this is not included - // in the set of lockable durations, creating this gauge serves as a way to ensure - // CL gauges are captured by the IncentivizedPools query. - if tc.clPoolWithGauge { - clPool := s.PrepareConcentratedPool() - epochDuration := s.App.IncentivesKeeper.GetEpochInfo(s.Ctx).Duration - - clGaugeId, err := keeper.GetPoolGaugeId(s.Ctx, clPool.GetId(), epochDuration) - s.Require().NoError(err) - distRecords = append(distRecords, types.DistrRecord{GaugeId: clGaugeId, Weight: tc.clGaugeWeight}) - } - + // Note we set up gauges prior to creating the cl pool, otherwise the cl pool will have no gauge to overwrite, and we cannot verify that it works as expected. for i := 0; i < len(lockableDurations); i++ { - gaugeId, err := keeper.GetPoolGaugeId(s.Ctx, poolId, lockableDurations[i]) + gaugeId, err := keeper.GetPoolGaugeId(s.Ctx, balancerPoolId, lockableDurations[i]) s.Require().NoError(err) distRecords = append(distRecords, types.DistrRecord{GaugeId: gaugeId, Weight: tc.weights[i]}) @@ -262,13 +267,27 @@ func (s *KeeperTestSuite) TestIncentivizedPools() { return distRecords[i].GaugeId < distRecords[j].GaugeId }) - // update records and ensure that non-perpetuals pot cannot get rewards. + // Update records and ensure that non-perpetuals pot cannot get rewards. _ = keeper.UpdateDistrRecords(s.Ctx, distRecords...) } - res, err := queryClient.IncentivizedPools(context.Background(), &types.QueryIncentivizedPoolsRequest{}) - s.Require().NoError(err) - s.Require().Equal(tc.expectedRecordLength, len(res.IncentivizedPools)) + + // Create a concentrated pool with a gauge if required. + var clPool cltypes.ConcentratedPoolExtension + if tc.clPoolWithGauge { + clPool = s.PrepareConcentratedPool() + } + + // Create a link between the balancer pool and the cl pool if required. + if tc.setupPoolMigrationLink { + record := gammtypes.BalancerToConcentratedPoolLink{BalancerPoolId: balancerPoolId, ClPoolId: clPool.GetId()} + err := s.App.GAMMKeeper.ReplaceMigrationRecords(s.Ctx, []gammtypes.BalancerToConcentratedPoolLink{record}) + s.Require().NoError(err) + } } + // System under test. + res, err := queryClient.IncentivizedPools(context.Background(), &types.QueryIncentivizedPoolsRequest{}) + s.Require().NoError(err) + s.Require().Equal(tc.expectedRecordLength, len(res.IncentivizedPools)) }) } } diff --git a/x/pool-incentives/keeper/keeper.go b/x/pool-incentives/keeper/keeper.go index 36a8e1910ce..c1366581990 100644 --- a/x/pool-incentives/keeper/keeper.go +++ b/x/pool-incentives/keeper/keeper.go @@ -29,9 +29,10 @@ type Keeper struct { bankKeeper types.BankKeeper distrKeeper types.DistrKeeper poolmanagerKeeper types.PoolManagerKeeper + superfluidKeeper types.SuperfluidKeeper } -func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, incentivesKeeper types.IncentivesKeeper, distrKeeper types.DistrKeeper, poolmanagerKeeper types.PoolManagerKeeper, epochKeeper types.EpochKeeper) Keeper { +func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, incentivesKeeper types.IncentivesKeeper, distrKeeper types.DistrKeeper, poolmanagerKeeper types.PoolManagerKeeper, epochKeeper types.EpochKeeper, superfluidKeeper types.SuperfluidKeeper) Keeper { // ensure pool-incentives module account is set if addr := accountKeeper.GetModuleAddress(types.ModuleName); addr == nil { panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) @@ -53,6 +54,7 @@ func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKee distrKeeper: distrKeeper, poolmanagerKeeper: poolmanagerKeeper, epochKeeper: epochKeeper, + superfluidKeeper: superfluidKeeper, } } diff --git a/x/pool-incentives/types/expected_keepers.go b/x/pool-incentives/types/expected_keepers.go index b6db0fb4878..a7c1540f1c9 100644 --- a/x/pool-incentives/types/expected_keepers.go +++ b/x/pool-incentives/types/expected_keepers.go @@ -50,3 +50,7 @@ type DistrKeeper interface { type EpochKeeper interface { GetEpochInfo(ctx sdk.Context, identifier string) epochstypes.EpochInfo } + +type SuperfluidKeeper interface { + GetAllMigrationInfo(ctx sdk.Context) (MigrationRecords, error) +} diff --git a/x/pool-incentives/types/shared.pb.go b/x/pool-incentives/types/shared.pb.go new file mode 100644 index 00000000000..e8fe5ebc756 --- /dev/null +++ b/x/pool-incentives/types/shared.pb.go @@ -0,0 +1,571 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/pool-incentives/v1beta1/shared.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MigrationRecords contains all the links between balancer and concentrated +// pools. +// +// This is copied over from the gamm proto file in order to circumnavigate +// the circular dependency between the two modules. +type MigrationRecords struct { + BalancerToConcentratedPoolLinks []BalancerToConcentratedPoolLink `protobuf:"bytes,1,rep,name=balancer_to_concentrated_pool_links,json=balancerToConcentratedPoolLinks,proto3" json:"balancer_to_concentrated_pool_links"` +} + +func (m *MigrationRecords) Reset() { *m = MigrationRecords{} } +func (m *MigrationRecords) String() string { return proto.CompactTextString(m) } +func (*MigrationRecords) ProtoMessage() {} +func (*MigrationRecords) Descriptor() ([]byte, []int) { + return fileDescriptor_f1449a8a614d7aea, []int{0} +} +func (m *MigrationRecords) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MigrationRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MigrationRecords.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MigrationRecords) XXX_Merge(src proto.Message) { + xxx_messageInfo_MigrationRecords.Merge(m, src) +} +func (m *MigrationRecords) XXX_Size() int { + return m.Size() +} +func (m *MigrationRecords) XXX_DiscardUnknown() { + xxx_messageInfo_MigrationRecords.DiscardUnknown(m) +} + +var xxx_messageInfo_MigrationRecords proto.InternalMessageInfo + +func (m *MigrationRecords) GetBalancerToConcentratedPoolLinks() []BalancerToConcentratedPoolLink { + if m != nil { + return m.BalancerToConcentratedPoolLinks + } + return nil +} + +// BalancerToConcentratedPoolLink defines a single link between a single +// balancer pool and a single concentrated liquidity pool. This link is used to +// allow a balancer pool to migrate to a single canonical full range +// concentrated liquidity pool position +// A balancer pool can be linked to a maximum of one cl pool, and a cl pool can +// be linked to a maximum of one balancer pool. +// +// This is copied over from the gamm proto file in order to circumnavigate +// the circular dependency between the two modules. +type BalancerToConcentratedPoolLink struct { + BalancerPoolId uint64 `protobuf:"varint,1,opt,name=balancer_pool_id,json=balancerPoolId,proto3" json:"balancer_pool_id,omitempty"` + ClPoolId uint64 `protobuf:"varint,2,opt,name=cl_pool_id,json=clPoolId,proto3" json:"cl_pool_id,omitempty"` +} + +func (m *BalancerToConcentratedPoolLink) Reset() { *m = BalancerToConcentratedPoolLink{} } +func (m *BalancerToConcentratedPoolLink) String() string { return proto.CompactTextString(m) } +func (*BalancerToConcentratedPoolLink) ProtoMessage() {} +func (*BalancerToConcentratedPoolLink) Descriptor() ([]byte, []int) { + return fileDescriptor_f1449a8a614d7aea, []int{1} +} +func (m *BalancerToConcentratedPoolLink) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalancerToConcentratedPoolLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalancerToConcentratedPoolLink.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BalancerToConcentratedPoolLink) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalancerToConcentratedPoolLink.Merge(m, src) +} +func (m *BalancerToConcentratedPoolLink) XXX_Size() int { + return m.Size() +} +func (m *BalancerToConcentratedPoolLink) XXX_DiscardUnknown() { + xxx_messageInfo_BalancerToConcentratedPoolLink.DiscardUnknown(m) +} + +var xxx_messageInfo_BalancerToConcentratedPoolLink proto.InternalMessageInfo + +func (m *BalancerToConcentratedPoolLink) GetBalancerPoolId() uint64 { + if m != nil { + return m.BalancerPoolId + } + return 0 +} + +func (m *BalancerToConcentratedPoolLink) GetClPoolId() uint64 { + if m != nil { + return m.ClPoolId + } + return 0 +} + +func init() { + proto.RegisterType((*MigrationRecords)(nil), "osmosis.poolincentives.v1beta1.MigrationRecords") + proto.RegisterType((*BalancerToConcentratedPoolLink)(nil), "osmosis.poolincentives.v1beta1.BalancerToConcentratedPoolLink") +} + +func init() { + proto.RegisterFile("osmosis/pool-incentives/v1beta1/shared.proto", fileDescriptor_f1449a8a614d7aea) +} + +var fileDescriptor_f1449a8a614d7aea = []byte{ + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x4a, 0x2b, 0x31, + 0x14, 0x86, 0x27, 0xf7, 0x96, 0xcb, 0x25, 0x82, 0x94, 0xc1, 0x45, 0x29, 0x92, 0x96, 0xba, 0xe9, + 0xc2, 0x4e, 0xac, 0x82, 0x0b, 0x05, 0x17, 0x75, 0x25, 0x28, 0x48, 0xd1, 0x8d, 0x9b, 0x21, 0xc9, + 0xc4, 0x69, 0x68, 0x9a, 0x53, 0x26, 0x69, 0xd1, 0xb7, 0x10, 0x9f, 0xc0, 0x9d, 0xaf, 0xd2, 0x65, + 0x97, 0xae, 0x44, 0xda, 0x8d, 0x8f, 0x21, 0x93, 0x4e, 0x6b, 0x41, 0xa8, 0xbb, 0x9c, 0x9c, 0xef, + 0xff, 0xf3, 0x9f, 0x1c, 0xbc, 0x0f, 0x76, 0x00, 0x56, 0x59, 0x3a, 0x04, 0xd0, 0x2d, 0x65, 0x84, + 0x34, 0x4e, 0x8d, 0xa5, 0xa5, 0xe3, 0x36, 0x97, 0x8e, 0xb5, 0xa9, 0xed, 0xb1, 0x4c, 0x26, 0xd1, + 0x30, 0x03, 0x07, 0x21, 0x29, 0xe8, 0x28, 0xa7, 0xbf, 0xe1, 0xa8, 0x80, 0xab, 0x3b, 0x29, 0xa4, + 0xe0, 0x51, 0x9a, 0x9f, 0x16, 0xaa, 0x2a, 0x49, 0x01, 0x52, 0x2d, 0xa9, 0xaf, 0xf8, 0xe8, 0x9e, + 0x26, 0xa3, 0x8c, 0x39, 0x05, 0xa6, 0xe8, 0x1f, 0xfc, 0x96, 0x61, 0xed, 0x25, 0xaf, 0x68, 0xbc, + 0x22, 0x5c, 0xbe, 0x52, 0xe9, 0xc2, 0xa5, 0x2b, 0x05, 0x64, 0x89, 0x0d, 0x9f, 0x11, 0xde, 0xe3, + 0x4c, 0x33, 0x23, 0x64, 0x16, 0x3b, 0x88, 0x05, 0x78, 0x59, 0xc6, 0x9c, 0x4c, 0xe2, 0xdc, 0x3a, + 0xd6, 0xca, 0xf4, 0x6d, 0x05, 0xd5, 0xff, 0x36, 0xb7, 0x0e, 0xcf, 0xa2, 0xcd, 0xb3, 0x44, 0x9d, + 0xc2, 0xea, 0x06, 0xce, 0xd7, 0x8c, 0xae, 0x01, 0xf4, 0xa5, 0x32, 0xfd, 0x4e, 0x69, 0xf2, 0x5e, + 0x0b, 0xba, 0x35, 0xbe, 0x91, 0xb2, 0x0d, 0x83, 0xc9, 0x66, 0xa3, 0xb0, 0x89, 0xcb, 0xab, 0xd4, + 0x3e, 0xa5, 0x4a, 0x2a, 0xa8, 0x8e, 0x9a, 0xa5, 0xee, 0xf6, 0xf2, 0x3e, 0x67, 0x2f, 0x92, 0x70, + 0x17, 0x63, 0xa1, 0x57, 0xcc, 0x1f, 0xcf, 0xfc, 0x17, 0x7a, 0xd1, 0x3d, 0x29, 0x7d, 0xbe, 0xd4, + 0x50, 0xe7, 0x76, 0x32, 0x23, 0x68, 0x3a, 0x23, 0xe8, 0x63, 0x46, 0xd0, 0xd3, 0x9c, 0x04, 0xd3, + 0x39, 0x09, 0xde, 0xe6, 0x24, 0xb8, 0x3b, 0x4d, 0x95, 0xeb, 0x8d, 0x78, 0x24, 0x60, 0x40, 0x8b, + 0xd1, 0x5b, 0x9a, 0x71, 0xbb, 0x2c, 0xe8, 0xb8, 0x7d, 0x4c, 0x1f, 0x7e, 0xec, 0xc0, 0x3d, 0x0e, + 0xa5, 0xe5, 0xff, 0xfc, 0xbf, 0x1f, 0x7d, 0x05, 0x00, 0x00, 0xff, 0xff, 0x35, 0xf1, 0xa4, 0x78, + 0x2f, 0x02, 0x00, 0x00, +} + +func (this *BalancerToConcentratedPoolLink) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BalancerToConcentratedPoolLink) + if !ok { + that2, ok := that.(BalancerToConcentratedPoolLink) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BalancerPoolId != that1.BalancerPoolId { + return false + } + if this.ClPoolId != that1.ClPoolId { + return false + } + return true +} +func (m *MigrationRecords) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MigrationRecords) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MigrationRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BalancerToConcentratedPoolLinks) > 0 { + for iNdEx := len(m.BalancerToConcentratedPoolLinks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BalancerToConcentratedPoolLinks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintShared(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BalancerToConcentratedPoolLink) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BalancerToConcentratedPoolLink) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalancerToConcentratedPoolLink) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClPoolId != 0 { + i = encodeVarintShared(dAtA, i, uint64(m.ClPoolId)) + i-- + dAtA[i] = 0x10 + } + if m.BalancerPoolId != 0 { + i = encodeVarintShared(dAtA, i, uint64(m.BalancerPoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintShared(dAtA []byte, offset int, v uint64) int { + offset -= sovShared(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MigrationRecords) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BalancerToConcentratedPoolLinks) > 0 { + for _, e := range m.BalancerToConcentratedPoolLinks { + l = e.Size() + n += 1 + l + sovShared(uint64(l)) + } + } + return n +} + +func (m *BalancerToConcentratedPoolLink) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BalancerPoolId != 0 { + n += 1 + sovShared(uint64(m.BalancerPoolId)) + } + if m.ClPoolId != 0 { + n += 1 + sovShared(uint64(m.ClPoolId)) + } + return n +} + +func sovShared(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozShared(x uint64) (n int) { + return sovShared(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MigrationRecords) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MigrationRecords: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MigrationRecords: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BalancerToConcentratedPoolLinks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthShared + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthShared + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BalancerToConcentratedPoolLinks = append(m.BalancerToConcentratedPoolLinks, BalancerToConcentratedPoolLink{}) + if err := m.BalancerToConcentratedPoolLinks[len(m.BalancerToConcentratedPoolLinks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipShared(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShared + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalancerToConcentratedPoolLink) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BalancerToConcentratedPoolLink: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalancerToConcentratedPoolLink: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BalancerPoolId", wireType) + } + m.BalancerPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BalancerPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClPoolId", wireType) + } + m.ClPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShared + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipShared(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShared + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipShared(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShared + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthShared + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupShared + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthShared + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthShared = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowShared = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupShared = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/superfluid/keeper/migrate.go b/x/superfluid/keeper/migrate.go index f7c58721403..b37fada5dea 100644 --- a/x/superfluid/keeper/migrate.go +++ b/x/superfluid/keeper/migrate.go @@ -10,6 +10,7 @@ import ( cltypes "github.com/osmosis-labs/osmosis/v16/x/concentrated-liquidity/types" gammtypes "github.com/osmosis-labs/osmosis/v16/x/gamm/types" lockuptypes "github.com/osmosis-labs/osmosis/v16/x/lockup/types" + poolincentivestypes "github.com/osmosis-labs/osmosis/v16/x/pool-incentives/types" "github.com/osmosis-labs/osmosis/v16/x/superfluid/types" ) @@ -333,3 +334,34 @@ func (k Keeper) validateSharesToMigrateUnlockAndExitBalancerPool(ctx sdk.Context return exitCoins, nil } + +// GetAllMigrationInfo helps to give pool-incentives access to the migration info located in the gamm store. +// This is required to circumnavigate import cycle errors without having to do a complete refactor. +func (k Keeper) GetAllMigrationInfo(ctx sdk.Context) (poolincentivestypes.MigrationRecords, error) { + gammMigrationRecords, err := k.gk.GetAllMigrationInfo(ctx) + if err != nil { + return poolincentivestypes.MigrationRecords{}, err + } + + // Perform conversion from gamm types.MigrationRecords to pool-incentives types.MigrationRecords + poolIncentivesMigrationRecords := convertMigrationRecords(gammMigrationRecords) + + return poolIncentivesMigrationRecords, nil +} + +// convertMigrationRecords performs the conversion from gamm types.MigrationRecords to pool-incentives types.MigrationRecords +func convertMigrationRecords(gammMigrationRecords gammtypes.MigrationRecords) poolincentivestypes.MigrationRecords { + poolIncentivesMigrationRecords := poolincentivestypes.MigrationRecords{} + + poolIncentivesMigrationRecords.BalancerToConcentratedPoolLinks = make([]poolincentivestypes.BalancerToConcentratedPoolLink, len(gammMigrationRecords.BalancerToConcentratedPoolLinks)) + for i := range gammMigrationRecords.BalancerToConcentratedPoolLinks { + // Perform the mapping for each BalancerToConcentratedPoolLink + poolIncentivesLink := poolincentivestypes.BalancerToConcentratedPoolLink{ + BalancerPoolId: gammMigrationRecords.BalancerToConcentratedPoolLinks[i].BalancerPoolId, + ClPoolId: gammMigrationRecords.BalancerToConcentratedPoolLinks[i].ClPoolId, + } + poolIncentivesMigrationRecords.BalancerToConcentratedPoolLinks[i] = poolIncentivesLink + } + + return poolIncentivesMigrationRecords +}