Skip to content
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

CL: Re-design Concentrated Liquidity Module #3296

Merged
merged 16 commits into from
Nov 22, 2022
1 change: 1 addition & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.GAMMKeeper)

appKeepers.ConcentratedLiquidityKeeper = concentratedliquidity.NewKeeper(
appCodec,
appKeepers.keys[concentratedliquiditytypes.StoreKey])

appKeepers.SwapRouterKeeper = swaprouter.NewKeeper(
Expand Down
2 changes: 1 addition & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func appModules(
app.TransferModule,
gamm.NewAppModule(appCodec, *app.GAMMKeeper, app.AccountKeeper, app.BankKeeper),
twapmodule.NewAppModule(*app.TwapKeeper),
concentratedliquidity.NewAppModule(*app.ConcentratedLiquidityKeeper),
concentratedliquidity.NewAppModule(appCodec, *app.ConcentratedLiquidityKeeper),
txfees.NewAppModule(*app.TxFeesKeeper),
incentives.NewAppModule(*app.IncentivesKeeper, app.AccountKeeper, app.BankKeeper, app.EpochsKeeper),
lockup.NewAppModule(*app.LockupKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down
23 changes: 1 addition & 22 deletions proto/osmosis/concentrated-liquidity/concentratedPool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package osmosis.concentratedliquidity.v1beta1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/concentrated-liquidity";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/concentrated-liquidity/concentrated-pool";

message Pool {
option (gogoproto.goproto_getters) = false;
Expand Down Expand Up @@ -39,24 +39,3 @@ message Pool {
(gogoproto.nullable) = false
];
}

message TickInfo {
string liquidity_gross = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity_gross\"",
(gogoproto.nullable) = false
];
string liquidity_net = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity_net\"",
(gogoproto.nullable) = false
];
}

message Position {
string liquidity = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity\"",
(gogoproto.nullable) = false
];
}
32 changes: 32 additions & 0 deletions proto/osmosis/concentrated-liquidity/position.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";
// this is a legacy package that requires additional migration logic
// in order to use the correct packge. 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.concentratedliquidity.v1beta1;

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/concentrated-liquidity/types";

message TickInfo {
mattverse marked this conversation as resolved.
Show resolved Hide resolved
string liquidity_gross = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity_gross\"",
(gogoproto.nullable) = false
];
string liquidity_net = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity_net\"",
(gogoproto.nullable) = false
];
}

message Position {
string liquidity = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity\"",
(gogoproto.nullable) = false
];
}
32 changes: 32 additions & 0 deletions x/concentrated-liquidity/concentrated-pool/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package concentrated_pool

import (
types "github.com/osmosis-labs/osmosis/v12/x/concentrated-liquidity/types"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
)

// RegisterLegacyAminoCodec registers the necessary x/concentrated-liquidity interfaces and concrete types
// on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&Pool{}, "osmosis/concentratedliquidity/ConcentratedPool", nil)
}

func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterInterface(
"osmosis.concentratedliquidity.v1beta1.PoolI",
(*types.PoolI)(nil),
&Pool{},
)
}

var (
amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewAminoCodec(amino)
)
p0mvn marked this conversation as resolved.
Show resolved Hide resolved

func init() {
RegisterLegacyAminoCodec(amino)
amino.Seal()
}
Loading