From dd1705ac7dedc773a3725ecbf62176e2bb26cc67 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 15 Sep 2023 13:05:42 -0600 Subject: [PATCH 1/8] add num initialized ticks query --- go.mod | 2 +- .../concentrated-liquidity/query.proto | 28 + .../client/grpc/grpc_query.go | 10 + .../client/query_proto_wrap.go | 25 + .../client/queryproto/query.pb.go | 823 +++++++++++++++--- .../client/queryproto/query.pb.gw.go | 83 ++ x/concentrated-liquidity/query.go | 92 ++ 7 files changed, 926 insertions(+), 137 deletions(-) diff --git a/go.mod b/go.mod index bd591210a79..625b62cf99e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/math v1.1.2 github.com/CosmWasm/wasmd v0.31.0 github.com/cosmos/cosmos-proto v1.0.0-beta.3 - github.com/cosmos/cosmos-sdk v0.47.4 + github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.0 github.com/cosmos/ibc-apps/modules/async-icq/v4 v4.1.0 diff --git a/proto/osmosis/concentrated-liquidity/query.proto b/proto/osmosis/concentrated-liquidity/query.proto index 024cfe0cf0d..9d499e3be48 100644 --- a/proto/osmosis/concentrated-liquidity/query.proto +++ b/proto/osmosis/concentrated-liquidity/query.proto @@ -124,6 +124,14 @@ service Query { option (google.api.http).get = "/osmosis/concentratedliquidity/v1beta1/get_total_liquidity"; } + + // NumNextInitializedTicks returns the provided number of next initialized + // ticks in the direction of swapping the token in denom. + rpc NumNextInitializedTicks(NumNextInitializedTicksRequest) + returns (NumNextInitializedTicksResponse) { + option (google.api.http).get = "/osmosis/concentratedliquidity/v1beta1/" + "num_next_initialized_ticks"; + } } //=============================== UserPositions @@ -318,3 +326,23 @@ message GetTotalLiquidityResponse { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } + +//=============================== NumNextInitializedTicks +message NumNextInitializedTicksRequest { + uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_in_denom = 2 + [ (gogoproto.moretags) = "yaml:\"token_in_denom\"" ]; + uint64 num_next_initialized_ticks = 3 + [ (gogoproto.moretags) = "yaml:\"num_next_initialized_ticks\"" ]; +} +message NumNextInitializedTicksResponse { + repeated TickLiquidityNet liquidity_depths = 1 + [ (gogoproto.nullable) = false ]; + int64 current_tick = 2; + string current_liquidity = 3 [ + + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.moretags) = "yaml:\"current_liquidity\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/x/concentrated-liquidity/client/grpc/grpc_query.go b/x/concentrated-liquidity/client/grpc/grpc_query.go index 251c67b2522..35a5fb9e23f 100644 --- a/x/concentrated-liquidity/client/grpc/grpc_query.go +++ b/x/concentrated-liquidity/client/grpc/grpc_query.go @@ -160,3 +160,13 @@ func (q Querier) CFMMPoolIdLinkFromConcentratedPoolId(grpcCtx context.Context, return q.Q.CFMMPoolIdLinkFromConcentratedPoolId(ctx, *req) } +func (q Querier) NumNextInitializedTicks(grpcCtx context.Context, + req *queryproto.NumNextInitializedTicksRequest, +) (*queryproto.NumNextInitializedTicksResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.NumNextInitializedTicks(ctx, *req) +} + diff --git a/x/concentrated-liquidity/client/query_proto_wrap.go b/x/concentrated-liquidity/client/query_proto_wrap.go index 3a8fe8601c1..cf62b33d2d3 100644 --- a/x/concentrated-liquidity/client/query_proto_wrap.go +++ b/x/concentrated-liquidity/client/query_proto_wrap.go @@ -293,3 +293,28 @@ func (q Querier) GetTotalLiquidity(ctx sdk.Context, req clquery.GetTotalLiquidit TotalLiquidity: totalLiquidity, }, nil } + +// NumNextInitializedTicks returns an array of LiquidityDepthWithRange, which contains the user defined number of next initialized ticks in the direction +// of swapping in the given tokenInDenom. +func (q Querier) NumNextInitializedTicks(ctx sdk.Context, req clquery.NumNextInitializedTicksRequest) (*clquery.NumNextInitializedTicksResponse, error) { + if req.TokenInDenom == "" { + return nil, status.Error(codes.InvalidArgument, "tokenIn is empty") + } + + liquidityDepths, err := q.Keeper.GetNumNextInitializedTicks( + ctx, + req.PoolId, + req.NumNextInitializedTicks, + req.TokenInDenom, + ) + if err != nil { + return nil, err + } + + pool, err := q.Keeper.GetConcentratedPoolById(ctx, req.PoolId) + if err != nil { + return nil, err + } + + return &clquery.NumNextInitializedTicksResponse{LiquidityDepths: liquidityDepths, CurrentLiquidity: pool.GetLiquidity(), CurrentTick: pool.GetCurrentTick()}, nil +} diff --git a/x/concentrated-liquidity/client/queryproto/query.pb.go b/x/concentrated-liquidity/client/queryproto/query.pb.go index c742b1acab5..2490b681750 100644 --- a/x/concentrated-liquidity/client/queryproto/query.pb.go +++ b/x/concentrated-liquidity/client/queryproto/query.pb.go @@ -1506,6 +1506,120 @@ func (m *GetTotalLiquidityResponse) GetTotalLiquidity() github_com_cosmos_cosmos return nil } +// =============================== NumNextInitializedTicks +type NumNextInitializedTicksRequest struct { + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` + TokenInDenom string `protobuf:"bytes,2,opt,name=token_in_denom,json=tokenInDenom,proto3" json:"token_in_denom,omitempty" yaml:"token_in_denom"` + NumNextInitializedTicks uint64 `protobuf:"varint,3,opt,name=num_next_initialized_ticks,json=numNextInitializedTicks,proto3" json:"num_next_initialized_ticks,omitempty" yaml:"num_next_initialized_ticks"` +} + +func (m *NumNextInitializedTicksRequest) Reset() { *m = NumNextInitializedTicksRequest{} } +func (m *NumNextInitializedTicksRequest) String() string { return proto.CompactTextString(m) } +func (*NumNextInitializedTicksRequest) ProtoMessage() {} +func (*NumNextInitializedTicksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5c83e18b11fd607d, []int{30} +} +func (m *NumNextInitializedTicksRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NumNextInitializedTicksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NumNextInitializedTicksRequest.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 *NumNextInitializedTicksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NumNextInitializedTicksRequest.Merge(m, src) +} +func (m *NumNextInitializedTicksRequest) XXX_Size() int { + return m.Size() +} +func (m *NumNextInitializedTicksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NumNextInitializedTicksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NumNextInitializedTicksRequest proto.InternalMessageInfo + +func (m *NumNextInitializedTicksRequest) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *NumNextInitializedTicksRequest) GetTokenInDenom() string { + if m != nil { + return m.TokenInDenom + } + return "" +} + +func (m *NumNextInitializedTicksRequest) GetNumNextInitializedTicks() uint64 { + if m != nil { + return m.NumNextInitializedTicks + } + return 0 +} + +type NumNextInitializedTicksResponse struct { + LiquidityDepths []TickLiquidityNet `protobuf:"bytes,1,rep,name=liquidity_depths,json=liquidityDepths,proto3" json:"liquidity_depths"` + CurrentTick int64 `protobuf:"varint,2,opt,name=current_tick,json=currentTick,proto3" json:"current_tick,omitempty"` + CurrentLiquidity cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=current_liquidity,json=currentLiquidity,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"current_liquidity" yaml:"current_liquidity"` +} + +func (m *NumNextInitializedTicksResponse) Reset() { *m = NumNextInitializedTicksResponse{} } +func (m *NumNextInitializedTicksResponse) String() string { return proto.CompactTextString(m) } +func (*NumNextInitializedTicksResponse) ProtoMessage() {} +func (*NumNextInitializedTicksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5c83e18b11fd607d, []int{31} +} +func (m *NumNextInitializedTicksResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NumNextInitializedTicksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NumNextInitializedTicksResponse.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 *NumNextInitializedTicksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NumNextInitializedTicksResponse.Merge(m, src) +} +func (m *NumNextInitializedTicksResponse) XXX_Size() int { + return m.Size() +} +func (m *NumNextInitializedTicksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NumNextInitializedTicksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NumNextInitializedTicksResponse proto.InternalMessageInfo + +func (m *NumNextInitializedTicksResponse) GetLiquidityDepths() []TickLiquidityNet { + if m != nil { + return m.LiquidityDepths + } + return nil +} + +func (m *NumNextInitializedTicksResponse) GetCurrentTick() int64 { + if m != nil { + return m.CurrentTick + } + return 0 +} + func init() { proto.RegisterType((*UserPositionsRequest)(nil), "osmosis.concentratedliquidity.v1beta1.UserPositionsRequest") proto.RegisterType((*UserPositionsResponse)(nil), "osmosis.concentratedliquidity.v1beta1.UserPositionsResponse") @@ -1537,6 +1651,8 @@ func init() { proto.RegisterType((*UserUnbondingPositionsResponse)(nil), "osmosis.concentratedliquidity.v1beta1.UserUnbondingPositionsResponse") proto.RegisterType((*GetTotalLiquidityRequest)(nil), "osmosis.concentratedliquidity.v1beta1.GetTotalLiquidityRequest") proto.RegisterType((*GetTotalLiquidityResponse)(nil), "osmosis.concentratedliquidity.v1beta1.GetTotalLiquidityResponse") + proto.RegisterType((*NumNextInitializedTicksRequest)(nil), "osmosis.concentratedliquidity.v1beta1.NumNextInitializedTicksRequest") + proto.RegisterType((*NumNextInitializedTicksResponse)(nil), "osmosis.concentratedliquidity.v1beta1.NumNextInitializedTicksResponse") } func init() { @@ -1544,142 +1660,149 @@ func init() { } var fileDescriptor_5c83e18b11fd607d = []byte{ - // 2145 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, - 0x15, 0x4e, 0x4d, 0x12, 0x27, 0xf3, 0xe2, 0xc4, 0x4e, 0xd9, 0xb1, 0x27, 0x93, 0x64, 0x26, 0x14, - 0x2c, 0x6b, 0x6d, 0xe2, 0x19, 0xf2, 0x63, 0x82, 0xe3, 0x64, 0xb3, 0x1e, 0x7b, 0x6d, 0x8d, 0xd6, - 0xc9, 0x3a, 0xbd, 0x31, 0x20, 0x0e, 0xf4, 0xf6, 0x74, 0x97, 0xc7, 0xad, 0xe9, 0xe9, 0x9a, 0x74, - 0x57, 0xdb, 0x6b, 0x2d, 0x91, 0x56, 0xec, 0x11, 0x09, 0x16, 0x71, 0x45, 0x5c, 0xb8, 0xa0, 0x15, - 0x47, 0x2e, 0x70, 0x83, 0x03, 0x8a, 0x38, 0xac, 0x56, 0x42, 0x48, 0x68, 0x0f, 0x5e, 0x48, 0x38, - 0x20, 0x2d, 0x70, 0x30, 0x17, 0x24, 0x2e, 0xa8, 0xab, 0xab, 0x7b, 0x7a, 0xc6, 0x3d, 0x76, 0xcf, - 0xd8, 0x9c, 0x32, 0xd5, 0xef, 0xf7, 0x7b, 0xef, 0xd5, 0xab, 0x7a, 0xe5, 0xc0, 0x6b, 0xcc, 0x6d, - 0x32, 0xd7, 0x74, 0xcb, 0x3a, 0xb3, 0x75, 0x6a, 0x73, 0x47, 0xe3, 0xd4, 0x98, 0xb6, 0xcc, 0xa7, - 0x9e, 0x69, 0x98, 0x7c, 0xbb, 0xfc, 0xd4, 0xa3, 0xce, 0x76, 0xa9, 0xe5, 0x30, 0xce, 0xf0, 0x2b, - 0x92, 0xb7, 0x14, 0xe7, 0x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, 0x96, 0x69, 0x37, 0xd4, 0x75, 0x87, 0x35, 0xd5, 0xb8, 0x50, 0xf9, - 0xfd, 0xa4, 0x49, 0xe6, 0x19, 0xfe, 0x0f, 0x82, 0x89, 0xe4, 0xbb, 0x7f, 0xea, 0xed, 0xbe, 0xef, - 0x28, 0x92, 0x7a, 0xbb, 0xef, 0x3f, 0x80, 0x90, 0xc7, 0x22, 0x24, 0x6f, 0xe1, 0x6a, 0xca, 0x90, - 0x78, 0x2e, 0x75, 0x54, 0x2f, 0xd4, 0xa7, 0x26, 0xdd, 0xb5, 0x3e, 0x43, 0x70, 0x7e, 0xcf, 0xd0, - 0x80, 0xd3, 0xee, 0xdf, 0x5e, 0xb3, 0x48, 0xfe, 0x8d, 0xc1, 0x15, 0x0c, 0xb8, 0x29, 0xea, 0x94, - 0xab, 0x5d, 0x03, 0x4e, 0x65, 0xe3, 0xf9, 0x8b, 0x02, 0xfa, 0xf4, 0x45, 0x01, 0xfd, 0xe5, 0x45, - 0x01, 0x7d, 0xf4, 0xb2, 0x70, 0xec, 0xd3, 0x97, 0x85, 0x63, 0x7f, 0x7e, 0x59, 0x38, 0xf6, 0x9d, - 0x47, 0xb1, 0x89, 0x46, 0xea, 0x9f, 0xb6, 0xb4, 0x9a, 0x1b, 0x19, 0xdb, 0xbc, 0x31, 0x5b, 0x7e, - 0xaf, 0xd7, 0xdf, 0xd2, 0x75, 0xcb, 0xa4, 0x36, 0x0f, 0xfe, 0x57, 0x41, 0xf0, 0x57, 0xc7, 0x21, - 0xf1, 0xcf, 0xad, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xaa, 0x47, 0x4c, 0x5b, 0x21, 0x00, - 0x00, + // 2264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, + 0x15, 0x4e, 0x4f, 0x7e, 0xe7, 0xc5, 0x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6f, 0x08, 0xfe, 0x52, + 0x55, 0x77, 0x49, 0x49, 0xba, 0x51, 0x32, 0x18, 0xb5, 0x25, 0xfd, 0xb5, 0x38, 0x5d, 0x20, 0x8a, + 0xb8, 0x9a, 0x7a, 0x8d, 0xda, 0x3a, 0xa7, 0x2c, 0xe4, 0xbd, 0x50, 0x63, 0xac, 0x66, 0x91, 0x92, + 0xde, 0xa4, 0x25, 0xdd, 0xb6, 0x19, 0x17, 0xc4, 0xd0, 0xb1, 0x73, 0x92, 0x2a, 0x56, 0x55, 0x6f, + 0xad, 0xa4, 0xdb, 0x5b, 0x21, 0x29, 0x30, 0xa2, 0x05, 0xc8, 0x83, 0x85, 0x24, 0x15, 0x7a, 0xa5, + 0x38, 0x6d, 0x10, 0x97, 0xeb, 0x8d, 0x66, 0x08, 0xa0, 0x97, 0xc1, 0xf4, 0x9c, 0xb8, 0x53, 0xbb, + 0xc5, 0xa3, 0xc9, 0x5c, 0x1a, 0x63, 0xbf, 0xb5, 0x0b, 0x3b, 0x15, 0x5f, 0xe9, 0x06, 0xd1, 0x1c, + 0x62, 0x30, 0xc7, 0x0c, 0xc4, 0xf0, 0xaf, 0x15, 0x18, 0x5b, 0x75, 0x89, 0xb3, 0x22, 0xb5, 0xb9, + 0x2a, 0x79, 0xe2, 0x11, 0x97, 0xa3, 0xab, 0x70, 0x54, 0x37, 0x4d, 0x87, 0xb8, 0xee, 0xa4, 0x72, + 0x49, 0x99, 0xca, 0x96, 0x51, 0xbb, 0x55, 0x38, 0xb9, 0xa5, 0x37, 0xac, 0xbb, 0x58, 0x12, 0xb0, + 0x1a, 0xb2, 0xa0, 0x2b, 0x70, 0xb4, 0xc9, 0x98, 0xa5, 0x51, 0x73, 0x32, 0x73, 0x49, 0x99, 0x3a, + 0x14, 0xe7, 0x96, 0x04, 0xac, 0x1e, 0xf1, 0x7f, 0x55, 0x4c, 0xb4, 0x00, 0xd0, 0x49, 0xc1, 0xe4, + 0xc1, 0x4b, 0xca, 0xd4, 0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0xbe, 0xc9, + 0x35, 0xe6, 0xac, 0x11, 0xca, 0x89, 0x19, 0x37, 0x99, 0x19, 0xd0, 0x64, 0x92, 0x12, 0xac, 0x8e, + 0x46, 0x9f, 0x3b, 0x26, 0xf1, 0x12, 0x5c, 0xf4, 0x6f, 0x02, 0xb3, 0x86, 0xe1, 0x35, 0x3c, 0x4b, + 0xe7, 0xcc, 0xe9, 0xa9, 0xab, 0x81, 0xf6, 0xca, 0x6f, 0x33, 0x90, 0xef, 0xa7, 0x4e, 0x86, 0xf5, + 0x43, 0x05, 0xce, 0x77, 0x65, 0x5e, 0xab, 0x39, 0x6c, 0x93, 0xaf, 0x6b, 0x35, 0x8b, 0x55, 0x75, + 0x4b, 0x86, 0xf7, 0x42, 0x22, 0xd6, 0x79, 0x62, 0x08, 0xb8, 0x37, 0x7c, 0xb8, 0x1f, 0x7d, 0x56, + 0xb8, 0x52, 0xa3, 0x7c, 0xdd, 0xab, 0x16, 0x0d, 0xd6, 0x90, 0x03, 0x86, 0xfc, 0x67, 0xda, 0x35, + 0xeb, 0x25, 0xbe, 0xd5, 0x24, 0x6e, 0x28, 0xe3, 0xaa, 0x93, 0x6e, 0xac, 0xaa, 0x16, 0x85, 0xcd, + 0x45, 0x61, 0x12, 0xfd, 0x40, 0x81, 0x31, 0xaf, 0xe9, 0xcf, 0x20, 0x3d, 0xbe, 0x04, 0x71, 0xbf, + 0x99, 0x72, 0x2f, 0xaf, 0x0a, 0x15, 0x8f, 0x1d, 0xdd, 0xa8, 0x13, 0xa7, 0x37, 0x25, 0x49, 0xfa, + 0xb1, 0x8a, 0x82, 0xcf, 0x71, 0x6f, 0xfc, 0x7e, 0x93, 0xf7, 0x7b, 0x4c, 0x2c, 0x86, 0x52, 0xe7, + 0x50, 0x39, 0x19, 0xf2, 0xce, 0xf2, 0x79, 0x06, 0x0a, 0x7d, 0xbd, 0x90, 0xa9, 0x7c, 0xae, 0xc0, + 0x9d, 0xc4, 0x54, 0xb2, 0xa6, 0xd8,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 0x32, 0x7f, 0xe0, 0xdb, 0xcb, 0xb1, 0xd9, 0x5e, 0x9a, 0x99, 0xb6, 0xf4, 0xaa, + 0x1b, 0xd9, 0xdc, 0xb8, 0x76, 0xa7, 0xf4, 0xb4, 0xdf, 0xff, 0x2a, 0x31, 0x2c, 0x4a, 0x6c, 0x1e, + 0xfc, 0xff, 0x9a, 0xe0, 0xef, 0xef, 0x47, 0xc4, 0x3f, 0x37, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, + 0x34, 0x43, 0x3b, 0x42, 0x65, 0x24, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1731,6 +1854,9 @@ type QueryClient interface { UserUnbondingPositions(ctx context.Context, in *UserUnbondingPositionsRequest, opts ...grpc.CallOption) (*UserUnbondingPositionsResponse, error) // GetTotalLiquidity returns total liquidity across all cl pools. GetTotalLiquidity(ctx context.Context, in *GetTotalLiquidityRequest, opts ...grpc.CallOption) (*GetTotalLiquidityResponse, error) + // NumNextInitializedTicks returns the provided number of next initialized + // ticks in the direction of swapping the token in denom. + NumNextInitializedTicks(ctx context.Context, in *NumNextInitializedTicksRequest, opts ...grpc.CallOption) (*NumNextInitializedTicksResponse, error) } type queryClient struct { @@ -1867,6 +1993,15 @@ func (c *queryClient) GetTotalLiquidity(ctx context.Context, in *GetTotalLiquidi return out, nil } +func (c *queryClient) NumNextInitializedTicks(ctx context.Context, in *NumNextInitializedTicksRequest, opts ...grpc.CallOption) (*NumNextInitializedTicksResponse, error) { + out := new(NumNextInitializedTicksResponse) + err := c.cc.Invoke(ctx, "/osmosis.concentratedliquidity.v1beta1.Query/NumNextInitializedTicks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Pools returns all concentrated liquidity pools @@ -1906,6 +2041,9 @@ type QueryServer interface { UserUnbondingPositions(context.Context, *UserUnbondingPositionsRequest) (*UserUnbondingPositionsResponse, error) // GetTotalLiquidity returns total liquidity across all cl pools. GetTotalLiquidity(context.Context, *GetTotalLiquidityRequest) (*GetTotalLiquidityResponse, error) + // NumNextInitializedTicks returns the provided number of next initialized + // ticks in the direction of swapping the token in denom. + NumNextInitializedTicks(context.Context, *NumNextInitializedTicksRequest) (*NumNextInitializedTicksResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1954,6 +2092,9 @@ func (*UnimplementedQueryServer) UserUnbondingPositions(ctx context.Context, req func (*UnimplementedQueryServer) GetTotalLiquidity(ctx context.Context, req *GetTotalLiquidityRequest) (*GetTotalLiquidityResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetTotalLiquidity not implemented") } +func (*UnimplementedQueryServer) NumNextInitializedTicks(ctx context.Context, req *NumNextInitializedTicksRequest) (*NumNextInitializedTicksResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NumNextInitializedTicks not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2211,6 +2352,24 @@ func _Query_GetTotalLiquidity_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_NumNextInitializedTicks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NumNextInitializedTicksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NumNextInitializedTicks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.concentratedliquidity.v1beta1.Query/NumNextInitializedTicks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NumNextInitializedTicks(ctx, req.(*NumNextInitializedTicksRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.concentratedliquidity.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -2271,6 +2430,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetTotalLiquidity", Handler: _Query_GetTotalLiquidity_Handler, }, + { + MethodName: "NumNextInitializedTicks", + Handler: _Query_NumNextInitializedTicks_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/concentrated-liquidity/query.proto", @@ -3415,6 +3578,98 @@ func (m *GetTotalLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *NumNextInitializedTicksRequest) 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 *NumNextInitializedTicksRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NumNextInitializedTicksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumNextInitializedTicks != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.NumNextInitializedTicks)) + i-- + dAtA[i] = 0x18 + } + if len(m.TokenInDenom) > 0 { + i -= len(m.TokenInDenom) + copy(dAtA[i:], m.TokenInDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TokenInDenom))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *NumNextInitializedTicksResponse) 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 *NumNextInitializedTicksResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NumNextInitializedTicksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.CurrentLiquidity.Size() + i -= size + if _, err := m.CurrentLiquidity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.CurrentTick != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CurrentTick)) + i-- + dAtA[i] = 0x10 + } + if len(m.LiquidityDepths) > 0 { + for iNdEx := len(m.LiquidityDepths) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LiquidityDepths[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -3886,6 +4141,45 @@ func (m *GetTotalLiquidityResponse) Size() (n int) { return n } +func (m *NumNextInitializedTicksRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + l = len(m.TokenInDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.NumNextInitializedTicks != 0 { + n += 1 + sovQuery(uint64(m.NumNextInitializedTicks)) + } + return n +} + +func (m *NumNextInitializedTicksResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LiquidityDepths) > 0 { + for _, e := range m.LiquidityDepths { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.CurrentTick != 0 { + n += 1 + sovQuery(uint64(m.CurrentTick)) + } + l = m.CurrentLiquidity.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -6730,6 +7024,263 @@ func (m *GetTotalLiquidityResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *NumNextInitializedTicksRequest) 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 ErrIntOverflowQuery + } + 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: NumNextInitializedTicksRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NumNextInitializedTicksRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenInDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenInDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumNextInitializedTicks", wireType) + } + m.NumNextInitializedTicks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumNextInitializedTicks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NumNextInitializedTicksResponse) 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 ErrIntOverflowQuery + } + 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: NumNextInitializedTicksResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NumNextInitializedTicksResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityDepths", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LiquidityDepths = append(m.LiquidityDepths, TickLiquidityNet{}) + if err := m.LiquidityDepths[len(m.LiquidityDepths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTick", wireType) + } + m.CurrentTick = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentTick |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentLiquidity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/concentrated-liquidity/client/queryproto/query.pb.gw.go b/x/concentrated-liquidity/client/queryproto/query.pb.gw.go index 7cc5d994ad9..312473b1cd0 100644 --- a/x/concentrated-liquidity/client/queryproto/query.pb.gw.go +++ b/x/concentrated-liquidity/client/queryproto/query.pb.gw.go @@ -573,6 +573,42 @@ func local_request_Query_GetTotalLiquidity_0(ctx context.Context, marshaler runt } +var ( + filter_Query_NumNextInitializedTicks_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_NumNextInitializedTicks_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NumNextInitializedTicksRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NumNextInitializedTicks_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.NumNextInitializedTicks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NumNextInitializedTicks_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NumNextInitializedTicksRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NumNextInitializedTicks_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.NumNextInitializedTicks(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -901,6 +937,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_NumNextInitializedTicks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NumNextInitializedTicks_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NumNextInitializedTicks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1222,6 +1281,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NumNextInitializedTicks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NumNextInitializedTicks_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NumNextInitializedTicks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1253,6 +1332,8 @@ var ( pattern_Query_UserUnbondingPositions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "concentratedliquidity", "v1beta1", "user_unbonding_positions", "address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetTotalLiquidity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "concentratedliquidity", "v1beta1", "get_total_liquidity"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NumNextInitializedTicks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "concentratedliquidity", "v1beta1", "num_next_initialized_ticks"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1283,4 +1364,6 @@ var ( forward_Query_UserUnbondingPositions_0 = runtime.ForwardResponseMessage forward_Query_GetTotalLiquidity_0 = runtime.ForwardResponseMessage + + forward_Query_NumNextInitializedTicks_0 = runtime.ForwardResponseMessage ) diff --git a/x/concentrated-liquidity/query.go b/x/concentrated-liquidity/query.go index 611a686e6b4..9291c350430 100644 --- a/x/concentrated-liquidity/query.go +++ b/x/concentrated-liquidity/query.go @@ -244,3 +244,95 @@ func (k Keeper) getTickByTickIndex(ctx sdk.Context, poolId uint64, tickIndex int } return tickStruct, nil } + +// GetNumNextInitializedTicks is a method that returns an array of TickLiquidityNet objects representing the net liquidity in the direction of swapping the given token in +// for a given pool. The number of ticks returned is determined by the numberOfNextInitializedTicks parameter. +func (k Keeper) GetNumNextInitializedTicks(ctx sdk.Context, poolId, numberOfNextInitializedTicks uint64, tokenInDenom string) ([]queryproto.TickLiquidityNet, error) { + p, err := k.getPoolById(ctx, poolId) + if err != nil { + return []queryproto.TickLiquidityNet{}, err + } + + startTick := p.GetCurrentTick() + + // sanity check that given tokenIn is an asset in pool. + if tokenInDenom != p.GetToken0() && tokenInDenom != p.GetToken1() { + return []queryproto.TickLiquidityNet{}, types.TokenInDenomNotInPoolError{TokenInDenom: tokenInDenom} + } + + // figure out zero for one depending on the token in. + zeroForOne := p.GetToken0() == tokenInDenom + + ctx.Logger().Debug(fmt.Sprintf("is_zero_for_one %t\n", zeroForOne)) + + // the boundTick will always be the min and max tick depending on the swap direction. + // we can narrow this down later to some max number of ticks to iterate through. + ctx.Logger().Debug(fmt.Sprintf("min_tick %d\n", types.MinInitializedTick)) + ctx.Logger().Debug(fmt.Sprintf("max_tick %d\n", types.MaxTick)) + + var boundTick osmomath.Int + if boundTick.IsNil() { + if zeroForOne { + boundTick = osmomath.NewInt(types.MinInitializedTick) + } else { + boundTick = osmomath.NewInt(types.MaxTick) + } + } + + currentTickSqrtPrice, err := math.TickToSqrtPrice(startTick) + if err != nil { + return []queryproto.TickLiquidityNet{}, err + } + + ctx.Logger().Debug(fmt.Sprintf("currentTick %d; current tick's sqrt price%s\n", startTick, currentTickSqrtPrice)) + + // iterator assignments + store := ctx.KVStore(k.storeKey) + prefixBz := types.KeyTickPrefixByPoolId(poolId) + prefixStore := prefix.NewStore(store, prefixBz) + + // If zero for one, we use reverse iterator. As a result, we need to increment the start tick by 1 + // so that we include the start tick in the search. + // + // If one for zero, we use forward iterator. However, our definition of the active range is inclusive + // of the lower bound. As a result, current liquidity must already include the lower bound tick + // so we skip it. + startTick = startTick + 1 + + startTickKey := types.TickIndexToBytes(startTick) + boundTickKey := types.TickIndexToBytes(boundTick.Int64()) + + // define iterator depending on swap strategy + var iterator db.Iterator + if zeroForOne { + iterator = prefixStore.ReverseIterator(boundTickKey, startTickKey) + } else { + iterator = prefixStore.Iterator(startTickKey, storetypes.InclusiveEndBytes(boundTickKey)) + } + + liquidityDepths := []queryproto.TickLiquidityNet{} + + iterationCount := uint64(0) + + defer iterator.Close() + for ; iterator.Valid() && iterationCount < numberOfNextInitializedTicks; iterator.Next() { + tickIndex, err := types.TickIndexFromBytes(iterator.Key()) + if err != nil { + return []queryproto.TickLiquidityNet{}, err + } + + tickStruct, err := ParseTickFromBz(iterator.Value()) + if err != nil { + return []queryproto.TickLiquidityNet{}, err + } + + liquidityDepth := queryproto.TickLiquidityNet{ + LiquidityNet: tickStruct.LiquidityNet, + TickIndex: tickIndex, + } + liquidityDepths = append(liquidityDepths, liquidityDepth) + iterationCount++ + } + + return liquidityDepths, nil +} From 0a90ff03e5fbcba1763a3c8cc50f9f528153da74 Mon Sep 17 00:00:00 2001 From: devbot-wizard <141283918+devbot-wizard@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:08:00 +0000 Subject: [PATCH 2/8] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b54a6fc6ad..708b285e2df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Features + +* [#6416](https://github.com/osmosis-labs/osmosis/pull/6416) feat[CL]: add num initialized ticks query + ### State Breaking * [#6344](https://github.com/osmosis-labs/osmosis/pull/6344) fix: set name, display and symbol of denom metadata in tokenfactory's CreateDenom From 21243e56cc264037d8e42fd7f187572415326ac3 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 15 Sep 2023 19:13:17 +0000 Subject: [PATCH 3/8] Generated protofile changes --- x/concentrated-liquidity/client/grpc/grpc_query.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/x/concentrated-liquidity/client/grpc/grpc_query.go b/x/concentrated-liquidity/client/grpc/grpc_query.go index 35a5fb9e23f..251c67b2522 100644 --- a/x/concentrated-liquidity/client/grpc/grpc_query.go +++ b/x/concentrated-liquidity/client/grpc/grpc_query.go @@ -160,13 +160,3 @@ func (q Querier) CFMMPoolIdLinkFromConcentratedPoolId(grpcCtx context.Context, return q.Q.CFMMPoolIdLinkFromConcentratedPoolId(ctx, *req) } -func (q Querier) NumNextInitializedTicks(grpcCtx context.Context, - req *queryproto.NumNextInitializedTicksRequest, -) (*queryproto.NumNextInitializedTicksResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - ctx := sdk.UnwrapSDKContext(grpcCtx) - return q.Q.NumNextInitializedTicks(ctx, *req) -} - From 35025491806d868177d0faf2a47e77d26002c6e4 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 15 Sep 2023 13:18:04 -0600 Subject: [PATCH 4/8] add max number of initialized ticks to return --- x/concentrated-liquidity/client/grpc/grpc_query.go | 9 +++++++++ x/concentrated-liquidity/query.go | 6 ++++++ x/concentrated-liquidity/types/errors.go | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/x/concentrated-liquidity/client/grpc/grpc_query.go b/x/concentrated-liquidity/client/grpc/grpc_query.go index 251c67b2522..afc66797d31 100644 --- a/x/concentrated-liquidity/client/grpc/grpc_query.go +++ b/x/concentrated-liquidity/client/grpc/grpc_query.go @@ -160,3 +160,12 @@ func (q Querier) CFMMPoolIdLinkFromConcentratedPoolId(grpcCtx context.Context, return q.Q.CFMMPoolIdLinkFromConcentratedPoolId(ctx, *req) } +func (q Querier) NumNextInitializedTicks(grpcCtx context.Context, + req *queryproto.NumNextInitializedTicksRequest, +) (*queryproto.NumNextInitializedTicksResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.NumNextInitializedTicks(ctx, *req) +} \ No newline at end of file diff --git a/x/concentrated-liquidity/query.go b/x/concentrated-liquidity/query.go index 9291c350430..02614e14d61 100644 --- a/x/concentrated-liquidity/query.go +++ b/x/concentrated-liquidity/query.go @@ -247,7 +247,13 @@ func (k Keeper) getTickByTickIndex(ctx sdk.Context, poolId uint64, tickIndex int // GetNumNextInitializedTicks is a method that returns an array of TickLiquidityNet objects representing the net liquidity in the direction of swapping the given token in // for a given pool. The number of ticks returned is determined by the numberOfNextInitializedTicks parameter. +// The max number of initialized ticks that can be returned is 100. func (k Keeper) GetNumNextInitializedTicks(ctx sdk.Context, poolId, numberOfNextInitializedTicks uint64, tokenInDenom string) ([]queryproto.TickLiquidityNet, error) { + maxNumberOfTicks := uint64(100) + if numberOfNextInitializedTicks > maxNumberOfTicks { + return []queryproto.TickLiquidityNet{}, types.NumberOfTicksExceedsMaxError{NumberOfTicks: numberOfNextInitializedTicks, MaxNumberOfTicks: maxNumberOfTicks} + } + p, err := k.getPoolById(ctx, poolId) if err != nil { return []queryproto.TickLiquidityNet{}, err diff --git a/x/concentrated-liquidity/types/errors.go b/x/concentrated-liquidity/types/errors.go index b782f8692c3..fcff58c65d6 100644 --- a/x/concentrated-liquidity/types/errors.go +++ b/x/concentrated-liquidity/types/errors.go @@ -887,3 +887,12 @@ type ComputedSqrtPriceInequalityError struct { func (e ComputedSqrtPriceInequalityError) Error() string { return fmt.Sprintf("edge case has occurred when swapping at tick boundaries, with izZeroForOne (%t), NextInitializedTickSqrtPrice (%s), computedSqrtPrice (%s). Please try again with a different swap amount", e.IsZeroForOne, e.NextInitializedTickSqrtPrice, e.ComputedSqrtPrice) } + +type NumberOfTicksExceedsMaxError struct { + NumberOfTicks uint64 + MaxNumberOfTicks uint64 +} + +func (e NumberOfTicksExceedsMaxError) Error() string { + return fmt.Sprintf("number of ticks exceeds max ticks. Provided number of ticks (%d), max ticks (%d)", e.NumberOfTicks, e.MaxNumberOfTicks) +} From c216921577452173e191add49a709d542e13a585 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 15 Sep 2023 19:20:41 +0000 Subject: [PATCH 5/8] Generated protofile changes --- x/concentrated-liquidity/client/grpc/grpc_query.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/x/concentrated-liquidity/client/grpc/grpc_query.go b/x/concentrated-liquidity/client/grpc/grpc_query.go index afc66797d31..251c67b2522 100644 --- a/x/concentrated-liquidity/client/grpc/grpc_query.go +++ b/x/concentrated-liquidity/client/grpc/grpc_query.go @@ -160,12 +160,3 @@ func (q Querier) CFMMPoolIdLinkFromConcentratedPoolId(grpcCtx context.Context, return q.Q.CFMMPoolIdLinkFromConcentratedPoolId(ctx, *req) } -func (q Querier) NumNextInitializedTicks(grpcCtx context.Context, - req *queryproto.NumNextInitializedTicksRequest, -) (*queryproto.NumNextInitializedTicksResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - ctx := sdk.UnwrapSDKContext(grpcCtx) - return q.Q.NumNextInitializedTicks(ctx, *req) -} \ No newline at end of file From e98e72f3d9c62808e9c1387e5750a5cef32a57ae Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 15 Sep 2023 13:35:04 -0600 Subject: [PATCH 6/8] remove limit --- x/concentrated-liquidity/query.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/x/concentrated-liquidity/query.go b/x/concentrated-liquidity/query.go index 02614e14d61..9291c350430 100644 --- a/x/concentrated-liquidity/query.go +++ b/x/concentrated-liquidity/query.go @@ -247,13 +247,7 @@ func (k Keeper) getTickByTickIndex(ctx sdk.Context, poolId uint64, tickIndex int // GetNumNextInitializedTicks is a method that returns an array of TickLiquidityNet objects representing the net liquidity in the direction of swapping the given token in // for a given pool. The number of ticks returned is determined by the numberOfNextInitializedTicks parameter. -// The max number of initialized ticks that can be returned is 100. func (k Keeper) GetNumNextInitializedTicks(ctx sdk.Context, poolId, numberOfNextInitializedTicks uint64, tokenInDenom string) ([]queryproto.TickLiquidityNet, error) { - maxNumberOfTicks := uint64(100) - if numberOfNextInitializedTicks > maxNumberOfTicks { - return []queryproto.TickLiquidityNet{}, types.NumberOfTicksExceedsMaxError{NumberOfTicks: numberOfNextInitializedTicks, MaxNumberOfTicks: maxNumberOfTicks} - } - p, err := k.getPoolById(ctx, poolId) if err != nil { return []queryproto.TickLiquidityNet{}, err From 23eb9c6b48cdf4dad18909035a7a822011990567 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 15 Sep 2023 13:44:17 -0600 Subject: [PATCH 7/8] update query.yml --- .../osmosis/concentrated-liquidity/query.yml | 5 + .../client/grpc/grpc_query.go | 10 + x/concentrated-liquidity/query_test.go | 361 ++++++++++++++++++ 3 files changed, 376 insertions(+) diff --git a/proto/osmosis/concentrated-liquidity/query.yml b/proto/osmosis/concentrated-liquidity/query.yml index 2df4cd3178e..6dd7e708fe9 100644 --- a/proto/osmosis/concentrated-liquidity/query.yml +++ b/proto/osmosis/concentrated-liquidity/query.yml @@ -69,3 +69,8 @@ queries: query_func: "k.GetTotalLiquidity" cli: cmd: "GetTotalLiquidity" + NumNextInitializedTicks: + proto_wrapper: + query_func: "k.NumNextInitializedTicks" + cli: + cmd: "NumNextInitializedTicks" diff --git a/x/concentrated-liquidity/client/grpc/grpc_query.go b/x/concentrated-liquidity/client/grpc/grpc_query.go index 251c67b2522..0b3fd0fc4b5 100644 --- a/x/concentrated-liquidity/client/grpc/grpc_query.go +++ b/x/concentrated-liquidity/client/grpc/grpc_query.go @@ -90,6 +90,16 @@ func (q Querier) Params(grpcCtx context.Context, return q.Q.Params(ctx, *req) } +func (q Querier) NumNextInitializedTicks(grpcCtx context.Context, + req *queryproto.NumNextInitializedTicksRequest, +) (*queryproto.NumNextInitializedTicksResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.NumNextInitializedTicks(ctx, *req) +} + func (q Querier) LiquidityPerTickRange(grpcCtx context.Context, req *queryproto.LiquidityPerTickRangeRequest, ) (*queryproto.LiquidityPerTickRangeResponse, error) { diff --git a/x/concentrated-liquidity/query_test.go b/x/concentrated-liquidity/query_test.go index 1ad980e9a4c..a03c70167be 100644 --- a/x/concentrated-liquidity/query_test.go +++ b/x/concentrated-liquidity/query_test.go @@ -590,3 +590,364 @@ func (s *KeeperTestSuite) TestGetTickLiquidityNetInDirection() { }) } } + +func (s *KeeperTestSuite) TestGetNumNextInitializedTicks() { + defaultTick := withPoolId(defaultTick, defaultPoolId) + + tests := []struct { + name string + presetTicks []genesis.FullTick + + // testing params + poolId uint64 + tokenInDenom string + currentPoolTick int64 + numberOfNextInitializedTicks uint64 + + // expected values + expectedLiquidityDepths []queryproto.TickLiquidityNet + expectedError bool + }{ + { + name: "one full range position, zero for one true", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + }, + + poolId: defaultPoolId, + tokenInDenom: ETH, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(10), + TickIndex: DefaultMinTick, + }, + }, + }, + { + name: "one full range position, zero for one false", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + }, + + poolId: defaultPoolId, + tokenInDenom: USDC, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(-10), + TickIndex: DefaultMaxTick, + }, + }, + }, + { + name: "one full range position, one range position above current tick, zero for one true", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, 5, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + poolId: defaultPoolId, + tokenInDenom: ETH, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(10), + TickIndex: DefaultMinTick, + }, + }, + }, + { + name: "one full range position, one range position above current tick, zero for one false", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, 5, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + poolId: defaultPoolId, + tokenInDenom: USDC, + numberOfNextInitializedTicks: 3, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(20), + TickIndex: 5, + }, + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + { + LiquidityNet: osmomath.NewDec(-10), + TickIndex: DefaultMaxTick, + }, + }, + }, + { + name: "one full range position, one range position above current tick, zero for one false, bound tick below with non-empty ticks", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + poolId: defaultPoolId, + tokenInDenom: ETH, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(20), + TickIndex: -10, + }, + }, + }, + { + name: "one ranged position, returned empty array", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + poolId: defaultPoolId, + tokenInDenom: ETH, + numberOfNextInitializedTicks: 4, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{}, + }, + { + name: "one full range position, one range position above current tick, zero for one false, bound tick below with non-empty ticks", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + poolId: defaultPoolId, + tokenInDenom: USDC, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + }, + }, + { + name: "one full range position, two ranged positions, zero for one true", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, -5, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 5, osmomath.NewDec(-20)), + withLiquidityNetandTickIndex(defaultTick, 2, osmomath.NewDec(40)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-40)), + }, + + poolId: defaultPoolId, + tokenInDenom: ETH, + numberOfNextInitializedTicks: 2, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(20), + TickIndex: -5, + }, + { + LiquidityNet: osmomath.NewDec(10), + TickIndex: DefaultMinTick, + }, + }, + }, + { + name: "one full range position, two ranged positions, zero for one false", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + withLiquidityNetandTickIndex(defaultTick, -5, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 5, osmomath.NewDec(-20)), + withLiquidityNetandTickIndex(defaultTick, 2, osmomath.NewDec(40)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-40)), + }, + + poolId: defaultPoolId, + tokenInDenom: USDC, + numberOfNextInitializedTicks: 4, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(40), + TickIndex: 2, + }, + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 5, + }, + { + LiquidityNet: osmomath.NewDec(-40), + TickIndex: 10, + }, + { + LiquidityNet: osmomath.NewDec(-10), + TickIndex: DefaultMaxTick, + }, + }, + }, + { + name: "current pool tick == start tick, zero for one", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + tokenInDenom: ETH, + currentPoolTick: 10, + numberOfNextInitializedTicks: 2, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + { + LiquidityNet: osmomath.NewDec(20), + TickIndex: -10, + }, + }, + }, + { + name: "current pool tick != start tick, zero for one", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + tokenInDenom: ETH, + currentPoolTick: 21, + numberOfNextInitializedTicks: 2, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + { + + LiquidityNet: osmomath.NewDec(20), + TickIndex: -10, + }, + }, + }, + { + name: "current pool tick == start tick, one for zero", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + tokenInDenom: USDC, + currentPoolTick: 5, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + }, + }, + { + name: "current pool tick != start tick, one for zero", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), + withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), + }, + + tokenInDenom: USDC, + currentPoolTick: -50, + numberOfNextInitializedTicks: 1, + expectedLiquidityDepths: []queryproto.TickLiquidityNet{ + { + LiquidityNet: osmomath.NewDec(-20), + TickIndex: 10, + }, + }, + }, + + // error cases + { + name: "error: invalid pool id", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + }, + + poolId: 5, + tokenInDenom: "invalid_token", + numberOfNextInitializedTicks: 1, + expectedError: true, + }, + { + name: "error: invalid token in", + presetTicks: []genesis.FullTick{ + withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), + withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), + }, + + poolId: defaultPoolId, + tokenInDenom: "invalid_token", + numberOfNextInitializedTicks: 1, + expectedError: true, + }, + } + + for _, test := range tests { + test := test + if test.poolId == 0 { + test.poolId = defaultPoolId + } + s.Run(test.name, func() { + // Init suite for each test. + s.SetupTest() + + // Create a default CL pool + pool := s.PrepareConcentratedPool() + for _, tick := range test.presetTicks { + s.App.ConcentratedLiquidityKeeper.SetTickInfo(s.Ctx, tick.PoolId, tick.TickIndex, &tick.Info) + } + + // Force initialize current sqrt price to 1. + // Normally, initialized during position creation. + // We only initialize ticks in this test for simplicity. + curPrice := osmomath.OneDec() + // TODO: consider adding tests for GetTickLiquidityNetInDirection + // with tick spacing > 1, requiring price to tick conversion with rounding. + curTick, err := math.CalculateSqrtPriceToTick(osmomath.BigDecFromDec(osmomath.MustMonotonicSqrt(curPrice))) + s.Require().NoError(err) + var curSqrtPrice osmomath.BigDec = osmomath.OneBigDec() + if test.currentPoolTick > 0 { + sqrtPrice, err := math.TickToSqrtPrice(test.currentPoolTick) + s.Require().NoError(err) + + curTick = test.currentPoolTick + curSqrtPrice = sqrtPrice + } + pool.SetCurrentSqrtPrice(curSqrtPrice) + pool.SetCurrentTick(curTick) + + err = s.App.ConcentratedLiquidityKeeper.SetPool(s.Ctx, pool) + s.Require().NoError(err) + + // system under test + liquidityForRange, err := s.App.ConcentratedLiquidityKeeper.GetNumNextInitializedTicks(s.Ctx, test.poolId, test.numberOfNextInitializedTicks, test.tokenInDenom) + if test.expectedError { + s.Require().Error(err) + return + } + + s.Require().NoError(err) + s.Require().Equal(test.expectedLiquidityDepths, liquidityForRange) + }) + } +} From 6269204c392e688b43cfdb2895d54813d6d3b0b1 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 15 Sep 2023 13:51:30 -0600 Subject: [PATCH 8/8] add go test --- x/concentrated-liquidity/query_test.go | 86 +------------------------- 1 file changed, 3 insertions(+), 83 deletions(-) diff --git a/x/concentrated-liquidity/query_test.go b/x/concentrated-liquidity/query_test.go index a03c70167be..f07e1d70df1 100644 --- a/x/concentrated-liquidity/query_test.go +++ b/x/concentrated-liquidity/query_test.go @@ -689,7 +689,7 @@ func (s *KeeperTestSuite) TestGetNumNextInitializedTicks() { }, }, { - name: "one full range position, one range position above current tick, zero for one false, bound tick below with non-empty ticks", + name: "one full range position, one range position above current tick, zero for one false, bound num ticks below with non-empty ticks", presetTicks: []genesis.FullTick{ withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), @@ -716,11 +716,11 @@ func (s *KeeperTestSuite) TestGetNumNextInitializedTicks() { poolId: defaultPoolId, tokenInDenom: ETH, - numberOfNextInitializedTicks: 4, + numberOfNextInitializedTicks: 0, expectedLiquidityDepths: []queryproto.TickLiquidityNet{}, }, { - name: "one full range position, one range position above current tick, zero for one false, bound tick below with non-empty ticks", + name: "one full range position, one range position above current tick, zero for one false, bound num ticks below with non-empty ticks", presetTicks: []genesis.FullTick{ withLiquidityNetandTickIndex(defaultTick, DefaultMinTick, osmomath.NewDec(10)), withLiquidityNetandTickIndex(defaultTick, DefaultMaxTick, osmomath.NewDec(-10)), @@ -796,84 +796,6 @@ func (s *KeeperTestSuite) TestGetNumNextInitializedTicks() { }, }, }, - { - name: "current pool tick == start tick, zero for one", - presetTicks: []genesis.FullTick{ - withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), - withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), - }, - - tokenInDenom: ETH, - currentPoolTick: 10, - numberOfNextInitializedTicks: 2, - expectedLiquidityDepths: []queryproto.TickLiquidityNet{ - { - LiquidityNet: osmomath.NewDec(-20), - TickIndex: 10, - }, - { - LiquidityNet: osmomath.NewDec(20), - TickIndex: -10, - }, - }, - }, - { - name: "current pool tick != start tick, zero for one", - presetTicks: []genesis.FullTick{ - withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), - withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), - }, - - tokenInDenom: ETH, - currentPoolTick: 21, - numberOfNextInitializedTicks: 2, - expectedLiquidityDepths: []queryproto.TickLiquidityNet{ - { - - LiquidityNet: osmomath.NewDec(-20), - TickIndex: 10, - }, - { - - LiquidityNet: osmomath.NewDec(20), - TickIndex: -10, - }, - }, - }, - { - name: "current pool tick == start tick, one for zero", - presetTicks: []genesis.FullTick{ - withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), - withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), - }, - - tokenInDenom: USDC, - currentPoolTick: 5, - numberOfNextInitializedTicks: 1, - expectedLiquidityDepths: []queryproto.TickLiquidityNet{ - { - LiquidityNet: osmomath.NewDec(-20), - TickIndex: 10, - }, - }, - }, - { - name: "current pool tick != start tick, one for zero", - presetTicks: []genesis.FullTick{ - withLiquidityNetandTickIndex(defaultTick, -10, osmomath.NewDec(20)), - withLiquidityNetandTickIndex(defaultTick, 10, osmomath.NewDec(-20)), - }, - - tokenInDenom: USDC, - currentPoolTick: -50, - numberOfNextInitializedTicks: 1, - expectedLiquidityDepths: []queryproto.TickLiquidityNet{ - { - LiquidityNet: osmomath.NewDec(-20), - TickIndex: 10, - }, - }, - }, // error cases { @@ -921,8 +843,6 @@ func (s *KeeperTestSuite) TestGetNumNextInitializedTicks() { // Normally, initialized during position creation. // We only initialize ticks in this test for simplicity. curPrice := osmomath.OneDec() - // TODO: consider adding tests for GetTickLiquidityNetInDirection - // with tick spacing > 1, requiring price to tick conversion with rounding. curTick, err := math.CalculateSqrtPriceToTick(osmomath.BigDecFromDec(osmomath.MustMonotonicSqrt(curPrice))) s.Require().NoError(err) var curSqrtPrice osmomath.BigDec = osmomath.OneBigDec()