From 1e65fc08c50e77665dd3044e5c7e600d7956bbfd Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Fri, 15 Sep 2023 11:41:17 +0200 Subject: [PATCH] add query versioned markets --- proto/nibiru/perp/v2/query.proto | 4 +- x/perp/v2/client/cli/query.go | 13 ++- x/perp/v2/integration/action/market.go | 31 +++-- x/perp/v2/integration/action/query.go | 25 +++- x/perp/v2/keeper/grpc_query.go | 4 +- x/perp/v2/keeper/grpc_query_test.go | 16 ++- x/perp/v2/keeper/twap.go | 2 +- x/perp/v2/types/query.pb.go | 154 ++++++++++++++++--------- x/perp/v2/types/query.pb.gw.go | 18 +++ 9 files changed, 193 insertions(+), 74 deletions(-) diff --git a/proto/nibiru/perp/v2/query.proto b/proto/nibiru/perp/v2/query.proto index c2182bbda..e15cb30df 100644 --- a/proto/nibiru/perp/v2/query.proto +++ b/proto/nibiru/perp/v2/query.proto @@ -119,7 +119,9 @@ message AmmMarket { AMM amm = 2 [ (gogoproto.nullable) = false ]; } -message QueryMarketsRequest {} +message QueryMarketsRequest { + bool versioned = 1; +} message QueryMarketsResponse { repeated AmmMarket amm_markets = 1 [ (gogoproto.nullable) = false ]; diff --git a/x/perp/v2/client/cli/query.go b/x/perp/v2/client/cli/query.go index fa9601263..e72d3ee2f 100644 --- a/x/perp/v2/client/cli/query.go +++ b/x/perp/v2/client/cli/query.go @@ -12,6 +12,8 @@ import ( types "github.com/NibiruChain/nibiru/x/perp/v2/types" ) +const FlagVersioned = "versioned" + // GetQueryCmd returns the cli query commands for this module func GetQueryCmd() *cobra.Command { // Group stablecoin queries under a subcommand @@ -156,7 +158,14 @@ func CmdQueryMarkets() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.QueryMarkets(cmd.Context(), &types.QueryMarketsRequest{}) + versioned, err := cmd.Flags().GetBool(FlagVersioned) + if err != nil { + return err + } + + res, err := queryClient.QueryMarkets(cmd.Context(), &types.QueryMarketsRequest{ + Versioned: versioned, + }) if err != nil { return err } @@ -165,6 +174,8 @@ func CmdQueryMarkets() *cobra.Command { }, } + cmd.Flags().Bool(FlagVersioned, false, "show all markets with version, enabled and disabled") + flags.AddQueryFlagsToCmd(cmd) return cmd diff --git a/x/perp/v2/integration/action/market.go b/x/perp/v2/integration/action/market.go index fa5635504..e61e41cf9 100644 --- a/x/perp/v2/integration/action/market.go +++ b/x/perp/v2/integration/action/market.go @@ -52,7 +52,7 @@ func (c createMarketAction) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context } // CreateCustomMarket creates a market with custom parameters -func CreateCustomMarket(pair asset.Pair, marketModifiers ...marketModifier) action.Action { +func CreateCustomMarket(pair asset.Pair, marketModifiers ...MarketModifier) action.Action { market := types.DefaultMarket(pair) amm := types.AMM{ Pair: pair, @@ -75,33 +75,33 @@ func CreateCustomMarket(pair asset.Pair, marketModifiers ...marketModifier) acti } } -type marketModifier func(market *types.Market, amm *types.AMM) +type MarketModifier func(market *types.Market, amm *types.AMM) -func WithPrepaidBadDebt(amount sdkmath.Int) marketModifier { +func WithPrepaidBadDebt(amount sdkmath.Int) MarketModifier { return func(market *types.Market, amm *types.AMM) { market.PrepaidBadDebt = sdk.NewCoin(market.Pair.QuoteDenom(), amount) } } -func WithPricePeg(newValue sdk.Dec) marketModifier { +func WithPricePeg(newValue sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { amm.PriceMultiplier = newValue } } -func WithTotalLong(amount sdk.Dec) marketModifier { +func WithTotalLong(amount sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { amm.TotalLong = amount } } -func WithTotalShort(amount sdk.Dec) marketModifier { +func WithTotalShort(amount sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { amm.TotalShort = amount } } -func WithSqrtDepth(amount sdk.Dec) marketModifier { +func WithSqrtDepth(amount sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { amm.SqrtDepth = amount amm.BaseReserve = amount @@ -109,18 +109,31 @@ func WithSqrtDepth(amount sdk.Dec) marketModifier { } } -func WithLatestMarketCPF(amount sdk.Dec) marketModifier { +func WithLatestMarketCPF(amount sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { market.LatestCumulativePremiumFraction = amount } } -func WithMaxFundingRate(amount sdk.Dec) marketModifier { +func WithMaxFundingRate(amount sdk.Dec) MarketModifier { return func(market *types.Market, amm *types.AMM) { market.MaxFundingRate = amount } } +func WithVersion(version uint64) MarketModifier { + return func(market *types.Market, amm *types.AMM) { + market.Version = version + amm.Version = version + } +} + +func WithEnabled(enabled bool) MarketModifier { + return func(market *types.Market, amm *types.AMM) { + market.Enabled = enabled + } +} + type editPriceMultiplier struct { pair asset.Pair newValue sdk.Dec diff --git a/x/perp/v2/integration/action/query.go b/x/perp/v2/integration/action/query.go index 06aa705e6..0928cfae7 100644 --- a/x/perp/v2/integration/action/query.go +++ b/x/perp/v2/integration/action/query.go @@ -131,7 +131,11 @@ func (q queryPositionNotFound) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Cont Trader: q.traderAddress.String(), }) if !errors.Is(err, collections.ErrNotFound) { - return ctx, fmt.Errorf("expected position not found, but found a position for pair %s, trader %s", q.pair, q.traderAddress), false + return ctx, fmt.Errorf( + "expected position not found, but found a position for pair %s, trader %s", + q.pair, + q.traderAddress, + ), false } return ctx, nil, false @@ -145,13 +149,16 @@ func QueryPositionNotFound(pair asset.Pair, traderAddress sdk.AccAddress) action } type queryMarkets struct { + versioned bool allResponseCheckers []QueryMarketsChecker } func (q queryMarkets) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { queryServer := keeper.NewQuerier(app.PerpKeeperV2) - resp, err := queryServer.QueryMarkets(sdk.WrapSDKContext(ctx), &types.QueryMarketsRequest{}) + resp, err := queryServer.QueryMarkets(sdk.WrapSDKContext(ctx), &types.QueryMarketsRequest{ + Versioned: q.versioned, + }) if err != nil { return ctx, err, false } @@ -165,8 +172,10 @@ func (q queryMarkets) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, erro return ctx, nil, false } -func QueryMarkets(responseCheckers ...QueryMarketsChecker) action.Action { +// QueryMarkets queries all markets, versioned contains active and inactive markets +func QueryMarkets(versioned bool, responseCheckers ...QueryMarketsChecker) action.Action { return queryMarkets{ + versioned: versioned, allResponseCheckers: responseCheckers, } } @@ -188,6 +197,16 @@ func QueryMarkets_MarketsShouldContain(expectedMarket types.Market) QueryMarkets } } +func QueryMarkets_ShouldLength(length int) QueryMarketsChecker { + return func(resp []types.AmmMarket) error { + if len(resp) != length { + return fmt.Errorf("expected markets to have length %d, got %d", length, len(resp)) + } + + return nil + } +} + type queryModuleAccounts struct { allResponseCheckers []QueryModuleAccountsChecker } diff --git a/x/perp/v2/keeper/grpc_query.go b/x/perp/v2/keeper/grpc_query.go index 7b1307193..72be07dc6 100644 --- a/x/perp/v2/keeper/grpc_query.go +++ b/x/perp/v2/keeper/grpc_query.go @@ -164,7 +164,7 @@ func (q queryServer) ModuleAccounts( } func (q queryServer) QueryMarkets( - goCtx context.Context, _ *types.QueryMarketsRequest, + goCtx context.Context, req *types.QueryMarketsRequest, ) (*types.QueryMarketsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -172,7 +172,7 @@ func (q queryServer) QueryMarkets( markets := q.k.Markets.Iterate(ctx, collections.Range[collections.Pair[asset.Pair, uint64]]{}).Values() for _, market := range markets { // disabled markets are not returned - if !market.Enabled { + if !req.Versioned && !market.Enabled { continue } diff --git a/x/perp/v2/keeper/grpc_query_test.go b/x/perp/v2/keeper/grpc_query_test.go index 4fc736d94..09302cac4 100644 --- a/x/perp/v2/keeper/grpc_query_test.go +++ b/x/perp/v2/keeper/grpc_query_test.go @@ -348,7 +348,7 @@ func TestQueryMarkets(t *testing.T) { ), ). Then( - QueryMarkets(QueryMarkets_MarketsShouldContain(types.DefaultMarket(pair))), + QueryMarkets(false, QueryMarkets_MarketsShouldContain(types.DefaultMarket(pair))), QueryModuleAccounts(QueryModuleAccounts_ModulesBalanceShouldBe( map[string]sdk.Coins{ "perp_ef": sdk.NewCoins( @@ -358,6 +358,20 @@ func TestQueryMarkets(t *testing.T) { }, )), ), + TC("versioned, all markets (active and inactive)").Given( + CreateCustomMarket("BTC:USD", WithVersion(1), WithEnabled(true)), + CreateCustomMarket("ETC:USD", WithVersion(1), WithEnabled(false)), + CreateCustomMarket("ETC:USD", WithVersion(2), WithEnabled(true)), + ).Then( + QueryMarkets(true, QueryMarkets_ShouldLength(3)), + ), + TC("not versioned, only active markets").Given( + CreateCustomMarket("BTC:USD", WithVersion(1), WithEnabled(true)), + CreateCustomMarket("ETC:USD", WithVersion(1), WithEnabled(false)), + CreateCustomMarket("ETC:USD", WithVersion(2), WithEnabled(true)), + ).Then( + QueryMarkets(true, QueryMarkets_ShouldLength(3)), + ), } NewTestSuite(t).WithTestCases(tc...).Run() diff --git a/x/perp/v2/keeper/twap.go b/x/perp/v2/keeper/twap.go index 05aef231a..b84f261ac 100644 --- a/x/perp/v2/keeper/twap.go +++ b/x/perp/v2/keeper/twap.go @@ -11,7 +11,7 @@ import ( ) /* -Gets the time-weighted average price from [ ctx.BlockTime() - interval, ctx.BlockTime() ) +CalcTwap Gets the time-weighted average price from [ ctx.BlockTime() - interval, ctx.BlockTime() ) Note the open-ended right bracket. args: diff --git a/x/perp/v2/types/query.pb.go b/x/perp/v2/types/query.pb.go index f36919ad8..b66a0e70f 100644 --- a/x/perp/v2/types/query.pb.go +++ b/x/perp/v2/types/query.pb.go @@ -512,6 +512,7 @@ func (m *AmmMarket) GetAmm() AMM { } type QueryMarketsRequest struct { + Versioned bool `protobuf:"varint,1,opt,name=versioned,proto3" json:"versioned,omitempty"` } func (m *QueryMarketsRequest) Reset() { *m = QueryMarketsRequest{} } @@ -547,6 +548,13 @@ func (m *QueryMarketsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMarketsRequest proto.InternalMessageInfo +func (m *QueryMarketsRequest) GetVersioned() bool { + if m != nil { + return m.Versioned + } + return false +} + type QueryMarketsResponse struct { AmmMarkets []AmmMarket `protobuf:"bytes,1,rep,name=amm_markets,json=ammMarkets,proto3" json:"amm_markets"` } @@ -609,63 +617,64 @@ func init() { func init() { proto.RegisterFile("nibiru/perp/v2/query.proto", fileDescriptor_fc8f0be94fac333f) } var fileDescriptor_fc8f0be94fac333f = []byte{ - // 887 bytes of a gzipped FileDescriptorProto + // 904 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x93, 0x74, 0xdb, 0x7d, 0x69, 0x23, 0x98, 0xb6, 0x8b, 0xe3, 0x56, 0x4e, 0x6a, 0x4a, - 0xba, 0xb4, 0xaa, 0x87, 0x0d, 0x5c, 0x40, 0x1c, 0x68, 0x5a, 0x51, 0x71, 0x48, 0x95, 0x1a, 0x21, - 0x10, 0x1c, 0xa2, 0x89, 0x33, 0xf2, 0x5a, 0x8d, 0x67, 0x5c, 0x8f, 0xb3, 0xa2, 0x95, 0xe0, 0xd0, - 0x4f, 0x80, 0xe8, 0x47, 0xe0, 0x04, 0x57, 0xbe, 0x44, 0x8f, 0x95, 0xb8, 0xa0, 0x1e, 0x0a, 0xda, - 0xe5, 0x83, 0x20, 0x8f, 0x67, 0xb2, 0xb1, 0x93, 0xdd, 0x44, 0x7b, 0x8a, 0x3d, 0xef, 0xf7, 0xde, - 0xfb, 0xfd, 0xde, 0x9f, 0x71, 0xc0, 0x62, 0xe1, 0x38, 0x4c, 0x66, 0x38, 0xa6, 0x49, 0x8c, 0x0f, - 0x7a, 0xf8, 0xe9, 0x8c, 0x26, 0xcf, 0xdc, 0x38, 0xe1, 0x29, 0x47, 0xcd, 0xdc, 0xe6, 0x66, 0x36, - 0xf7, 0xa0, 0x67, 0x5d, 0x09, 0x78, 0xc0, 0xa5, 0x09, 0x67, 0x4f, 0x39, 0xca, 0xba, 0x1e, 0x70, - 0x1e, 0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x3e, - 0x63, 0xa9, 0xde, 0x40, 0xc7, 0x87, 0x6b, 0x2b, 0xad, 0xaa, 0xfe, 0x0f, 0xe0, 0x02, 0x51, 0x67, - 0x6a, 0x3c, 0x9d, 0x72, 0xfd, 0x95, 0xcf, 0xb7, 0x61, 0xba, 0xdf, 0x27, 0x53, 0xc2, 0x7c, 0xbd, - 0x6a, 0x73, 0x4f, 0xe7, 0x77, 0x03, 0xd0, 0x32, 0x0c, 0x21, 0xa8, 0x33, 0x12, 0x51, 0xb5, 0xfb, - 0xf2, 0x19, 0x99, 0x70, 0x9e, 0x4c, 0x26, 0x09, 0x15, 0x42, 0xcd, 0x88, 0x7e, 0x45, 0x14, 0xce, - 0x8f, 0x73, 0x47, 0xb3, 0x26, 0x99, 0xb4, 0x0a, 0x93, 0xae, 0x67, 0xfc, 0x3e, 0x0f, 0x59, 0xff, - 0xa3, 0x8c, 0xc0, 0x1f, 0xff, 0xb4, 0x77, 0x37, 0x28, 0x58, 0xe6, 0x20, 0x3c, 0x1d, 0xdb, 0x61, - 0xb0, 0x7d, 0x2f, 0x8a, 0x06, 0x24, 0x79, 0x42, 0x53, 0xf4, 0x09, 0x6c, 0x45, 0xf2, 0x49, 0x0d, - 0xdf, 0x4e, 0x59, 0x7c, 0x8e, 0x53, 0x82, 0x15, 0x16, 0xdd, 0x81, 0x1a, 0x89, 0x22, 0xb5, 0x8f, - 0x97, 0x97, 0xea, 0x35, 0x18, 0x28, 0x7c, 0x86, 0x72, 0xae, 0xc2, 0xe5, 0xbc, 0x01, 0xd2, 0x77, - 0xde, 0x97, 0xef, 0xd4, 0x46, 0xce, 0x8f, 0x55, 0x43, 0xbe, 0x80, 0x06, 0x89, 0xa2, 0x51, 0x9e, - 0x49, 0xf7, 0xa4, 0xb5, 0x94, 0x43, 0x2b, 0x50, 0x99, 0x80, 0xe8, 0x03, 0xd1, 0xfb, 0xf3, 0x1c, - 0x9c, 0x93, 0xa1, 0xd1, 0xcf, 0x70, 0xa9, 0xb0,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 0x7d, 0x9f, 0x59, 0xb0, 0x57, 0xbe, 0x04, 0xd0, 0xd9, 0xb1, 0x4d, 0xed, 0x9c, 0xe6, 0x32, + 0x98, 0xe6, 0x70, 0x55, 0x71, 0xb8, 0x82, 0x6a, 0x6f, 0xe2, 0x20, 0xd1, 0x73, 0x0b, 0xd0, 0xfc, + 0xf1, 0x8d, 0x3e, 0x3a, 0x33, 0xc3, 0xec, 0x45, 0xe2, 0xdc, 0x58, 0x05, 0xaa, 0x09, 0x35, 0x15, + 0xa1, 0x06, 0x72, 0xdf, 0x44, 0xa8, 0x27, 0x55, 0xfa, 0x5f, 0x2d, 0xd8, 0x2b, 0x2f, 0x2c, 0x5a, + 0x9c, 0x66, 0xe1, 0xce, 0x3b, 0x37, 0x57, 0xc2, 0x6a, 0x4e, 0xd7, 0x15, 0xa7, 0xab, 0xa8, 0x5e, + 0xe5, 0x14, 0x2b, 0x7c, 0xcf, 0x2c, 0x39, 0x7a, 0x0a, 0x17, 0x66, 0x67, 0x12, 0x7d, 0xb0, 0x38, + 0x4b, 0x69, 0xcc, 0x9d, 0x6b, 0x67, 0x83, 0x34, 0x87, 0xba, 0xe2, 0x50, 0x43, 0xef, 0xcf, 0x71, + 0x28, 0x80, 0xed, 0xfb, 0x2f, 0x4e, 0x5c, 0xeb, 0xe5, 0x89, 0x6b, 0xfd, 0x7b, 0xe2, 0x5a, 0xbf, + 0x9c, 0xba, 0x6b, 0x2f, 0x4f, 0xdd, 0xb5, 0xbf, 0x4f, 0xdd, 0xb5, 0xef, 0x6f, 0x2d, 0xbb, 0xab, + 0x4c, 0x28, 0x75, 0x18, 0xf4, 0xb7, 0xd4, 0x1f, 0x96, 0xdb, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, + 0xbb, 0xf9, 0xd2, 0xa6, 0x7a, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1324,6 +1333,16 @@ func (m *QueryMarketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Versioned { + i-- + if m.Versioned { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -1533,6 +1552,9 @@ func (m *QueryMarketsRequest) Size() (n int) { } var l int _ = l + if m.Versioned { + n += 2 + } return n } @@ -2657,6 +2679,26 @@ func (m *QueryMarketsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryMarketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Versioned", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Versioned = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/perp/v2/types/query.pb.gw.go b/x/perp/v2/types/query.pb.gw.go index 155f87eb2..d7f2bee0d 100644 --- a/x/perp/v2/types/query.pb.gw.go +++ b/x/perp/v2/types/query.pb.gw.go @@ -159,10 +159,21 @@ func local_request_Query_ModuleAccounts_0(ctx context.Context, marshaler runtime } +var ( + filter_Query_QueryMarkets_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_QueryMarkets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryMarketsRequest 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_QueryMarkets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryMarkets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -172,6 +183,13 @@ func local_request_Query_QueryMarkets_0(ctx context.Context, marshaler runtime.M var protoReq QueryMarketsRequest 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_QueryMarkets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.QueryMarkets(ctx, &protoReq) return msg, metadata, err