From 1d1c83a50b3097d82f33254a7e10281b9aec00d6 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Fri, 20 Sep 2024 19:38:41 -0400 Subject: [PATCH 1/8] add minAverageSellPrice --- proto/neutron/dex/tx.proto | 6 + .../grpc_query_estimate_place_limit_order.go | 1 + .../integration_placelimitorder_test.go | 95 ++++++ x/dex/keeper/liquidity.go | 10 +- x/dex/keeper/msg_server.go | 11 +- x/dex/keeper/msg_server_test.go | 49 ++++ x/dex/keeper/place_limit_order.go | 13 +- x/dex/types/errors.go | 5 + x/dex/types/message_place_limit_order.go | 4 + x/dex/types/tx.pb.go | 276 +++++++++++------- 10 files changed, 353 insertions(+), 117 deletions(-) diff --git a/proto/neutron/dex/tx.proto b/proto/neutron/dex/tx.proto index 093591440..db65e25f7 100644 --- a/proto/neutron/dex/tx.proto +++ b/proto/neutron/dex/tx.proto @@ -140,6 +140,12 @@ message MsgPlaceLimitOrder { (gogoproto.nullable) = true, (gogoproto.jsontag) = "limit_sell_price" ]; + string min_average_sell_price = 12 [ + (gogoproto.moretags) = "yaml:\"min_average_sell_price\"", + (gogoproto.customtype) = "github.com/neutron-org/neutron/v4/utils/math.PrecDec", + (gogoproto.nullable) = true, + (gogoproto.jsontag) = "min_average_sell_price" + ]; } message MsgPlaceLimitOrderResponse { diff --git a/x/dex/keeper/grpc_query_estimate_place_limit_order.go b/x/dex/keeper/grpc_query_estimate_place_limit_order.go index 6a4447d0f..404c019d6 100644 --- a/x/dex/keeper/grpc_query_estimate_place_limit_order.go +++ b/x/dex/keeper/grpc_query_estimate_place_limit_order.go @@ -53,6 +53,7 @@ func (k Keeper) EstimatePlaceLimitOrder( req.OrderType, req.ExpirationTime, req.MaxAmountOut, + nil, callerAddr, receiverAddr, ) diff --git a/x/dex/keeper/integration_placelimitorder_test.go b/x/dex/keeper/integration_placelimitorder_test.go index 37c822973..c5919a39d 100644 --- a/x/dex/keeper/integration_placelimitorder_test.go +++ b/x/dex/keeper/integration_placelimitorder_test.go @@ -243,6 +243,59 @@ func (s *DexTestSuite) TestPlaceLimitOrderInsufficientFunds() { s.assertAliceLimitSellFails(err, "TokenA", 0, 10) } +func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPriceFails() { + s.fundAliceBalances(1, 0) + s.fundBobBalances(0, 1) + // GIVEN LP liq at 148.37-148.42 (with dust) + s.bobDeposits( + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_000, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_001, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_002, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(10), 50_003, 1), + ) + // THEN alice GTC limitOrder minAvgPrice == limitPrice fails + limitPrice := math_utils.MustNewPrecDecFromStr("0.006737") + _, err := s.msgServer.PlaceLimitOrder(s.Ctx, &types.MsgPlaceLimitOrder{ + Creator: s.alice.String(), + Receiver: s.alice.String(), + TokenIn: "TokenA", + TokenOut: "TokenB", + TickIndexInToOut: 0, + LimitSellPrice: &limitPrice, + AmountIn: sdkmath.NewInt(2000), + OrderType: types.LimitOrderType_GOOD_TIL_CANCELLED, + MinAverageSellPrice: &limitPrice, + }) + s.ErrorIs(err, types.ErrLimitPriceNotSatisfied) +} + +func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPrice() { + s.fundAliceBalances(1, 0) + s.fundBobBalances(0, 1) + // GIVEN LP liq at 148.37-148.42 (with dust) + s.bobDeposits( + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_000, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_001, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_002, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(10), 50_003, 1), + ) + // THEN alice IoC limitOrder with lower min avg prices success + limitPrice := math_utils.MustNewPrecDecFromStr("0.006737") + minAvgPrice := math_utils.MustNewPrecDecFromStr("0.006736") + _, err := s.msgServer.PlaceLimitOrder(s.Ctx, &types.MsgPlaceLimitOrder{ + Creator: s.alice.String(), + Receiver: s.alice.String(), + TokenIn: "TokenA", + TokenOut: "TokenB", + TickIndexInToOut: 0, + LimitSellPrice: &limitPrice, + AmountIn: sdkmath.NewInt(2000), + OrderType: types.LimitOrderType_GOOD_TIL_CANCELLED, + MinAverageSellPrice: &minAvgPrice, + }) + s.NoError(err) +} + func (s *DexTestSuite) TestLimitOrderPartialFillDepositCancel() { s.fundAliceBalances(100, 100) s.fundBobBalances(100, 100) @@ -303,6 +356,48 @@ func (s *DexTestSuite) TestPlaceLimitOrderWithDustHitsTruePriceLimit() { s.assertAliceLimitSellFails(types.ErrLimitPriceNotSatisfied, "TokenA", 20005, 1, types.LimitOrderType_IMMEDIATE_OR_CANCEL) } +func (s *DexTestSuite) TestPlaceLimitOrderIOCWithDustMinAvgPriceFails() { + s.fundAliceBalances(1, 0) + s.fundBobBalances(0, 1) + // GIVEN LP liq at 148.37-148.42 (with dust) + s.bobDeposits( + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_000, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_001, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_002, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(10), 50_003, 1), + ) + // THEN alice IoC limitOrder minAvgPrice == limitPrice fails + _, err := s.aliceLimitSellsWithMinAvgPrice( + "TokenA", + math_utils.MustNewPrecDecFromStr("0.006730"), + 1, + math_utils.MustNewPrecDecFromStr("0.006730"), + types.LimitOrderType_IMMEDIATE_OR_CANCEL, + ) + s.ErrorIs(err, types.ErrLimitPriceNotSatisfied) +} + +func (s *DexTestSuite) TestPlaceLimitOrderIOCWithDustMinAvgPrice() { + s.fundAliceBalances(1, 0) + s.fundBobBalances(0, 1) + // GIVEN LP liq at 148.37-148.42 (with dust) + s.bobDeposits( + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_000, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_001, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(1), 50_002, 1), + NewDepositInt(sdkmath.ZeroInt(), sdkmath.NewInt(10), 50_003, 1), + ) + // THEN alice IoC limitOrder with lower min avg prices success + _, err := s.aliceLimitSellsWithMinAvgPrice( + "TokenA", + math_utils.MustNewPrecDecFromStr("0.006730"), + 1, + math_utils.MustNewPrecDecFromStr("0.006727"), + types.LimitOrderType_IMMEDIATE_OR_CANCEL, + ) + s.NoError(err) +} + func (s *DexTestSuite) TestPlaceLimitOrderWithDust() { s.fundAliceBalances(1, 0) s.fundBobBalances(0, 1) diff --git a/x/dex/keeper/liquidity.go b/x/dex/keeper/liquidity.go index 145657505..cff5c8a86 100644 --- a/x/dex/keeper/liquidity.go +++ b/x/dex/keeper/liquidity.go @@ -127,6 +127,7 @@ func (k Keeper) TakerLimitOrderSwap( amountIn math.Int, maxAmountOut *math.Int, limitPrice math_utils.PrecDec, + minAvgSellPrice math_utils.PrecDec, orderType types.LimitOrderType, ) (totalInCoin, totalOutCoin sdk.Coin, err error) { totalInCoin, totalOutCoin, orderFilled, err := k.SwapWithCache( @@ -136,6 +137,7 @@ func (k Keeper) TakerLimitOrderSwap( maxAmountOut, &limitPrice, ) + if err != nil { return sdk.Coin{}, sdk.Coin{}, err } @@ -150,7 +152,7 @@ func (k Keeper) TakerLimitOrderSwap( truePrice := math_utils.NewPrecDecFromInt(totalOutCoin.Amount).QuoInt(totalInCoin.Amount) - if truePrice.LT(limitPrice) { + if truePrice.LT(minAvgSellPrice) { return sdk.Coin{}, sdk.Coin{}, types.ErrLimitPriceNotSatisfied } @@ -164,7 +166,9 @@ func (k Keeper) MakerLimitOrderSwap( tradePairID types.TradePairID, amountIn math.Int, limitPrice math_utils.PrecDec, + minAvgSellPrice math_utils.PrecDec, ) (totalInCoin, totalOutCoin sdk.Coin, filled bool, err error) { + totalInCoin, totalOutCoin, filled, err = k.SwapWithCache( ctx, &tradePairID, @@ -178,11 +182,11 @@ func (k Keeper) MakerLimitOrderSwap( if totalInCoin.Amount.IsPositive() { remainingIn := amountIn.Sub(totalInCoin.Amount) - expectedOutMakerPortion := limitPrice.MulInt(remainingIn).Ceil() + expectedOutMakerPortion := limitPrice.MulInt(remainingIn) totalExpectedOut := expectedOutMakerPortion.Add(math_utils.NewPrecDecFromInt(totalOutCoin.Amount)) truePrice := totalExpectedOut.QuoInt(amountIn) - if truePrice.LT(limitPrice) { + if truePrice.LT(minAvgSellPrice) { return sdk.Coin{}, sdk.Coin{}, false, types.ErrLimitPriceNotSatisfied } } diff --git a/x/dex/keeper/msg_server.go b/x/dex/keeper/msg_server.go index 2b3bca666..83c0cb0f9 100644 --- a/x/dex/keeper/msg_server.go +++ b/x/dex/keeper/msg_server.go @@ -145,6 +145,7 @@ func (k MsgServer) PlaceLimitOrder( msg.OrderType, msg.ExpirationTime, msg.MaxAmountOut, + msg.MinAverageSellPrice, callerAddr, receiverAddr, ) @@ -259,6 +260,12 @@ func (k MsgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return &types.MsgUpdateParamsResponse{}, nil } -func (k MsgServer) AssertNotPaused(_ context.Context) error { - return types.ErrDexPaused +func (k MsgServer) AssertNotPaused(goCtx context.Context) error { + ctx := sdk.UnwrapSDKContext(goCtx) + paused := k.GetParams(ctx).Paused + + if paused { + return types.ErrDexPaused + } + return nil } diff --git a/x/dex/keeper/msg_server_test.go b/x/dex/keeper/msg_server_test.go index 905d129aa..cd2ecfd90 100644 --- a/x/dex/keeper/msg_server_test.go +++ b/x/dex/keeper/msg_server_test.go @@ -398,6 +398,40 @@ func (s *DexTestSuite) limitSellsWithMaxOut( return msg.TrancheKey } +func (s *DexTestSuite) aliceLimitSellsWithMinAvgPrice( + selling string, + limitPrice math_utils.PrecDec, + amountIn int, + minAvgPrice math_utils.PrecDec, + orderType types.LimitOrderType, +) (*types.MsgPlaceLimitOrderResponse, error) { + return s.limitSellsWithMinAvgPrice(s.alice, selling, limitPrice, amountIn, minAvgPrice, orderType) +} + +func (s *DexTestSuite) limitSellsWithMinAvgPrice( + account sdk.AccAddress, + tokenIn string, + limitPrice math_utils.PrecDec, + amountIn int, + minAvgPrice math_utils.PrecDec, + orderType types.LimitOrderType, +) (*types.MsgPlaceLimitOrderResponse, error) { + tokenIn, tokenOut := dexkeeper.GetInOutTokens(tokenIn, "TokenA", "TokenB") + + return s.msgServer.PlaceLimitOrder(s.Ctx, &types.MsgPlaceLimitOrder{ + Creator: account.String(), + Receiver: account.String(), + TokenIn: tokenIn, + TokenOut: tokenOut, + TickIndexInToOut: 0, + LimitSellPrice: &limitPrice, + AmountIn: sdkmath.NewInt(int64(amountIn)).Mul(denomMultiple), + OrderType: orderType, + MinAverageSellPrice: &minAvgPrice, + }) + +} + func (s *DexTestSuite) limitSellsWithPrice( account sdk.AccAddress, tokenIn string, @@ -2006,6 +2040,7 @@ func TestMsgPlaceLimitOrderValidate(t *testing.T) { ZEROINT := sdkmath.ZeroInt() ONEINT := sdkmath.OneInt() + ZERODEC := math_utils.ZeroPrecDec() TINYDEC := math_utils.MustNewPrecDecFromStr("0.000000000000000000000000494") HUGEDEC := math_utils.MustNewPrecDecFromStr("2020125331305056766452345.127500016657360222036663652") FIVEDEC := math_utils.NewPrecDec(5) @@ -2177,6 +2212,20 @@ func TestMsgPlaceLimitOrderValidate(t *testing.T) { }, types.ErrInvalidPriceAndTick, }, + { + "invalid zero min average sell price", + types.MsgPlaceLimitOrder{ + Creator: sample.AccAddress(), + Receiver: sample.AccAddress(), + TokenIn: "TokenA", + TokenOut: "TokenB", + LimitSellPrice: &FIVEDEC, + TickIndexInToOut: 0, + AmountIn: sdkmath.OneInt(), + MinAverageSellPrice: &ZERODEC, + }, + types.ErrInvalidPriceAndTick, + }, } for _, tt := range tests { diff --git a/x/dex/keeper/place_limit_order.go b/x/dex/keeper/place_limit_order.go index 161707765..680fe8a51 100644 --- a/x/dex/keeper/place_limit_order.go +++ b/x/dex/keeper/place_limit_order.go @@ -21,6 +21,7 @@ func (k Keeper) PlaceLimitOrderCore( orderType types.LimitOrderType, goodTil *time.Time, maxAmountOut *math.Int, + minAvgSellPrice *math_utils.PrecDec, callerAddr sdk.AccAddress, receiverAddr sdk.AccAddress, ) (trancheKey string, totalInCoin, swapInCoin, swapOutCoin sdk.Coin, err error) { @@ -38,6 +39,7 @@ func (k Keeper) PlaceLimitOrderCore( orderType, goodTil, maxAmountOut, + minAvgSellPrice, receiverAddr, ) if err != nil { @@ -100,6 +102,7 @@ func (k Keeper) ExecutePlaceLimitOrder( orderType types.LimitOrderType, goodTil *time.Time, maxAmountOut *math.Int, + minAvgSellPriceP *math_utils.PrecDec, receiverAddr sdk.AccAddress, ) (trancheKey string, totalIn math.Int, swapInCoin, swapOutCoin sdk.Coin, sharesIssued math.Int, err error) { amountLeft := amountIn @@ -110,6 +113,12 @@ func (k Keeper) ExecutePlaceLimitOrder( return trancheKey, totalIn, swapInCoin, swapOutCoin, math.ZeroInt(), err } + // Use limitPrice for minAvgSellPrice if it has not be specified + minAvgSellPrice := limitPrice + if minAvgSellPriceP != nil { + minAvgSellPrice = *minAvgSellPriceP + } + // Ensure that after rounding user will get at least 1 token out. err = types.ValidateFairOutput(amountIn, limitPrice) if err != nil { @@ -118,9 +127,9 @@ func (k Keeper) ExecutePlaceLimitOrder( var orderFilled bool if orderType.IsTakerOnly() { - swapInCoin, swapOutCoin, err = k.TakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, maxAmountOut, limitPrice, orderType) + swapInCoin, swapOutCoin, err = k.TakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, maxAmountOut, limitPrice, minAvgSellPrice, orderType) } else { - swapInCoin, swapOutCoin, orderFilled, err = k.MakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, limitPrice) + swapInCoin, swapOutCoin, orderFilled, err = k.MakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, minAvgSellPrice, limitPrice) } if err != nil { return trancheKey, totalIn, swapInCoin, swapOutCoin, math.ZeroInt(), err diff --git a/x/dex/types/errors.go b/x/dex/types/errors.go index 69211ca8f..dacdfec5b 100644 --- a/x/dex/types/errors.go +++ b/x/dex/types/errors.go @@ -224,4 +224,9 @@ var ( 1163, "Cannot convert price to int64 tick value", ) + ErrZeroMinAverageSellPrice = sdkerrors.Register( + ModuleName, + 1164, + "MinAverageSellPrice must be nil or > 0.", + ) ) diff --git a/x/dex/types/message_place_limit_order.go b/x/dex/types/message_place_limit_order.go index 47206d49c..69b0de8ea 100644 --- a/x/dex/types/message_place_limit_order.go +++ b/x/dex/types/message_place_limit_order.go @@ -121,6 +121,10 @@ func (msg *MsgPlaceLimitOrder) Validate() error { return ErrInvalidPriceAndTick } + if msg.MinAverageSellPrice != nil && msg.MinAverageSellPrice.IsZero() { + return ErrZeroMinAverageSellPrice + } + return nil } diff --git a/x/dex/types/tx.pb.go b/x/dex/types/tx.pb.go index 433e795c2..79fa690bd 100644 --- a/x/dex/types/tx.pb.go +++ b/x/dex/types/tx.pb.go @@ -448,9 +448,10 @@ type MsgPlaceLimitOrder struct { AmountIn cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=amount_in,json=amountIn,proto3,customtype=cosmossdk.io/math.Int" json:"amount_in" yaml:"amount_in"` OrderType LimitOrderType `protobuf:"varint,8,opt,name=order_type,json=orderType,proto3,enum=neutron.dex.LimitOrderType" json:"order_type,omitempty"` // expirationTime is only valid iff orderType == GOOD_TIL_TIME. - ExpirationTime *time.Time `protobuf:"bytes,9,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` - MaxAmountOut *cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=max_amount_out,json=maxAmountOut,proto3,customtype=cosmossdk.io/math.Int" json:"max_amount_out" yaml:"max_amount_out"` - LimitSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,11,opt,name=limit_sell_price,json=limitSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"limit_sell_price" yaml:"limit_sell_price"` + ExpirationTime *time.Time `protobuf:"bytes,9,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` + MaxAmountOut *cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=max_amount_out,json=maxAmountOut,proto3,customtype=cosmossdk.io/math.Int" json:"max_amount_out" yaml:"max_amount_out"` + LimitSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,11,opt,name=limit_sell_price,json=limitSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"limit_sell_price" yaml:"limit_sell_price"` + MinAverageSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,12,opt,name=min_average_sell_price,json=minAverageSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"min_average_sell_price" yaml:"min_average_sell_price"` } func (m *MsgPlaceLimitOrder) Reset() { *m = MsgPlaceLimitOrder{} } @@ -1034,113 +1035,116 @@ func init() { func init() { proto.RegisterFile("neutron/dex/tx.proto", fileDescriptor_a489f6e187d5e074) } var fileDescriptor_a489f6e187d5e074 = []byte{ - // 1687 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x4f, 0xdb, 0x89, 0x3f, 0x2a, 0x89, 0xe3, 0x74, 0x32, 0xeb, 0x8e, 0x07, 0xdc, 0x56, 0xcf, - 0xb2, 0x63, 0x22, 0x62, 0x4f, 0xc2, 0xb2, 0x07, 0x23, 0x21, 0xd9, 0xf9, 0xd8, 0x35, 0x6b, 0xaf, - 0xa3, 0x8e, 0x57, 0x48, 0xbb, 0x12, 0x4d, 0xdb, 0x5d, 0x71,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0x75, - 0x01, 0xec, 0x06, 0x01, 0xec, 0x83, 0xb5, 0x53, 0x06, 0xb0, 0x67, 0x87, 0xa5, 0x38, 0x4b, 0x60, - 0x7e, 0x26, 0x81, 0x33, 0x49, 0x50, 0x33, 0xa7, 0xe1, 0x29, 0x56, 0xfe, 0x16, 0x03, 0xab, 0x2d, - 0xdc, 0xff, 0x99, 0x49, 0xce, 0x0c, 0x47, 0xff, 0x4a, 0xb7, 0xbe, 0xb5, 0x9e, 0x1b, 0x83, 0x2c, - 0x3e, 0xd3, 0x1d, 0x88, 0x69, 0xc5, 0x3a, 0x70, 0x80, 0xc6, 0x90, 0xb7, 0x5e, 0xf3, 0x2e, 0xf4, - 0xe6, 0x16, 0x5e, 0x4d, 0xe5, 0x9c, 0x8b, 0x5d, 0x54, 0xa3, 0xa8, 0x19, 0x57, 0xd4, 0x41, 0x2a, - 0x13, 0xdc, 0xd4, 0x31, 0x89, 0xdb, 0x3b, 0x26, 0x19, 0x74, 0x4c, 0x55, 0x89, 0x96, 0xfe, 0x3a, - 0x2f, 0xfd, 0x00, 0x45, 0x25, 0x07, 0x1e, 0xcc, 0x08, 0xbc, 0xba, 0x55, 0xfe, 0xb2, 0xc4, 0xca, - 0xf9, 0xd8, 0xd2, 0x7b, 0xb0, 0x69, 0x0e, 0x4c, 0xd2, 0x76, 0x0c, 0xe8, 0xbc, 0x25, 0xea, 0x5b, - 0x20, 0xe5, 0x82, 0x6b, 0xda, 0x1c, 0x76, 0x17, 0xec, 0x86, 0x2d, 0x3e, 0x04, 0x69, 0x57, 0x85, - 0x46, 0x84, 0x23, 0xef, 0xda, 0xb6, 0x47, 0x44, 0xdc, 0x03, 0x9b, 0x01, 0x06, 0x9a, 0x69, 0x53, - 0x08, 0xa8, 0xdd, 0x52, 0x51, 0x28, 0xc5, 0xeb, 0x31, 0x49, 0x50, 0xb3, 0x3e, 0x10, 0x0d, 0xbb, - 0x83, 0xe8, 0x1a, 0x9f, 0xc6, 0xe8, 0x66, 0x49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- 0x27, 0x72, 0xb3, 0x9d, 0xe4, 0x7f, 0x22, 0xe4, 0xe5, 0x1b, 0x14, 0x7e, 0x01, 0x34, 0x01, 0x08, - 0x3d, 0x78, 0xf3, 0x51, 0xf3, 0x40, 0x97, 0x57, 0x6e, 0xd6, 0xf9, 0xde, 0xbe, 0x04, 0x6b, 0xd1, - 0xd7, 0xdc, 0x5c, 0x04, 0x11, 0x83, 0xfc, 0xe3, 0x3b, 0x0c, 0x7c, 0xe7, 0x63, 0x20, 0xdd, 0x48, - 0xfc, 0xa5, 0x9b, 0x82, 0x8b, 0x5a, 0xe6, 0x9f, 0xbc, 0xa9, 0xa5, 0xbf, 0xef, 0xcf, 0x41, 0x76, - 0x8e, 0xbd, 0x8b, 0x51, 0x2f, 0x51, 0x8b, 0x7c, 0xe9, 0x2e, 0x0b, 0xdf, 0xbf, 0x0a, 0x56, 0x66, - 0xc8, 0xf5, 0x3b, 0xd1, 0x95, 0x61, 0x6d, 0xfe, 0xfd, 0xdb, 0xb4, 0x61, 0x9f, 0x33, 0x0d, 0x36, - 0xe7, 0x33, 0xac, 0x9d, 0xf7, 0x79, 0x5d, 0xc5, 0xe7, 0x97, 0xbe, 0xa6, 0x3d, 0x54, 0xff, 0xf8, - 0xf2, 0x45, 0x41, 0x78, 0xfe, 0xa2, 0x20, 0xfc, 0xe7, 0x45, 0x41, 0x78, 0xfa, 0xb2, 0xb0, 0xf0, - 0xfc, 0x65, 0x61, 0xe1, 0xef, 0x2f, 0x0b, 0x0b, 0x5f, 0xec, 0xdc, 0xcd, 0x95, 0x13, 0xf7, 0x5f, - 0x41, 0x94, 0x22, 0xba, 0x09, 0xf6, 0x16, 0xfd, 0xe1, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x2a, - 0x07, 0x8e, 0x98, 0x26, 0x12, 0x00, 0x00, + // 1731 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc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49, 0xcf, 0x4c, + 0x5a, 0x8b, 0x6f, 0x5f, 0x65, 0x4d, 0xc6, 0x9c, 0x6a, 0xb0, 0x73, 0x31, 0x93, 0xd6, 0xf3, 0x31, + 0x2f, 0xaa, 0xf8, 0xe2, 0xfc, 0x67, 0xa2, 0x87, 0xea, 0xef, 0xbf, 0x78, 0xb9, 0xa5, 0x7d, 0xf9, + 0x72, 0x4b, 0xfb, 0xf7, 0xcb, 0x2d, 0xed, 0x8b, 0x57, 0x5b, 0x33, 0x5f, 0xbe, 0xda, 0x9a, 0xf9, + 0xdb, 0xab, 0xad, 0x99, 0x4f, 0x1e, 0x5e, 0xaf, 0x95, 0xe3, 0xe0, 0x3f, 0x57, 0x42, 0x22, 0x3a, + 0x59, 0x79, 0x75, 0xfe, 0xc1, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xba, 0x1b, 0x2c, 0xa7, 0xd5, + 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1857,6 +1861,18 @@ func (m *MsgPlaceLimitOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinAverageSellPrice != nil { + { + size := m.MinAverageSellPrice.Size() + i -= size + if _, err := m.MinAverageSellPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } if m.LimitSellPrice != nil { { size := m.LimitSellPrice.Size() @@ -2543,6 +2559,10 @@ func (m *MsgPlaceLimitOrder) Size() (n int) { l = m.LimitSellPrice.Size() n += 1 + l + sovTx(uint64(l)) } + if m.MinAverageSellPrice != nil { + l = m.MinAverageSellPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -4237,6 +4257,42 @@ func (m *MsgPlaceLimitOrder) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinAverageSellPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_neutron_org_neutron_v4_utils_math.PrecDec + m.MinAverageSellPrice = &v + if err := m.MinAverageSellPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 4cf7dd337bf6b60821acb2dc27cef598e9823697 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Mon, 23 Sep 2024 16:45:04 -0400 Subject: [PATCH 2/8] comments + fmt --- proto/neutron/dex/tx.proto | 13 ++++++++----- x/dex/keeper/liquidity.go | 2 -- x/dex/keeper/msg_server_test.go | 1 - x/dex/types/tx.pb.go | 9 ++++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/proto/neutron/dex/tx.proto b/proto/neutron/dex/tx.proto index db65e25f7..8ad7f4bd8 100644 --- a/proto/neutron/dex/tx.proto +++ b/proto/neutron/dex/tx.proto @@ -140,12 +140,15 @@ message MsgPlaceLimitOrder { (gogoproto.nullable) = true, (gogoproto.jsontag) = "limit_sell_price" ]; + // min_average_sell_price is an optional parameter that sets a required minimum average price for the entire trade. + // if the min_average_sell_price is not met the trade will fail. + // If min_average_sell_price is omitted limit_sell_price will be used instead string min_average_sell_price = 12 [ - (gogoproto.moretags) = "yaml:\"min_average_sell_price\"", - (gogoproto.customtype) = "github.com/neutron-org/neutron/v4/utils/math.PrecDec", - (gogoproto.nullable) = true, - (gogoproto.jsontag) = "min_average_sell_price" - ]; + (gogoproto.moretags) = "yaml:\"min_average_sell_price\"", + (gogoproto.customtype) = "github.com/neutron-org/neutron/v4/utils/math.PrecDec", + (gogoproto.nullable) = true, + (gogoproto.jsontag) = "min_average_sell_price" + ]; } message MsgPlaceLimitOrderResponse { diff --git a/x/dex/keeper/liquidity.go b/x/dex/keeper/liquidity.go index cff5c8a86..626502c31 100644 --- a/x/dex/keeper/liquidity.go +++ b/x/dex/keeper/liquidity.go @@ -137,7 +137,6 @@ func (k Keeper) TakerLimitOrderSwap( maxAmountOut, &limitPrice, ) - if err != nil { return sdk.Coin{}, sdk.Coin{}, err } @@ -168,7 +167,6 @@ func (k Keeper) MakerLimitOrderSwap( limitPrice math_utils.PrecDec, minAvgSellPrice math_utils.PrecDec, ) (totalInCoin, totalOutCoin sdk.Coin, filled bool, err error) { - totalInCoin, totalOutCoin, filled, err = k.SwapWithCache( ctx, &tradePairID, diff --git a/x/dex/keeper/msg_server_test.go b/x/dex/keeper/msg_server_test.go index cd2ecfd90..2a64badc8 100644 --- a/x/dex/keeper/msg_server_test.go +++ b/x/dex/keeper/msg_server_test.go @@ -429,7 +429,6 @@ func (s *DexTestSuite) limitSellsWithMinAvgPrice( OrderType: orderType, MinAverageSellPrice: &minAvgPrice, }) - } func (s *DexTestSuite) limitSellsWithPrice( diff --git a/x/dex/types/tx.pb.go b/x/dex/types/tx.pb.go index 79fa690bd..5c9eccfbb 100644 --- a/x/dex/types/tx.pb.go +++ b/x/dex/types/tx.pb.go @@ -448,9 +448,12 @@ type MsgPlaceLimitOrder struct { AmountIn cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=amount_in,json=amountIn,proto3,customtype=cosmossdk.io/math.Int" json:"amount_in" yaml:"amount_in"` OrderType LimitOrderType `protobuf:"varint,8,opt,name=order_type,json=orderType,proto3,enum=neutron.dex.LimitOrderType" json:"order_type,omitempty"` // expirationTime is only valid iff orderType == GOOD_TIL_TIME. - ExpirationTime *time.Time `protobuf:"bytes,9,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` - MaxAmountOut *cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=max_amount_out,json=maxAmountOut,proto3,customtype=cosmossdk.io/math.Int" json:"max_amount_out" yaml:"max_amount_out"` - LimitSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,11,opt,name=limit_sell_price,json=limitSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"limit_sell_price" yaml:"limit_sell_price"` + ExpirationTime *time.Time `protobuf:"bytes,9,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` + MaxAmountOut *cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=max_amount_out,json=maxAmountOut,proto3,customtype=cosmossdk.io/math.Int" json:"max_amount_out" yaml:"max_amount_out"` + LimitSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,11,opt,name=limit_sell_price,json=limitSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"limit_sell_price" yaml:"limit_sell_price"` + // min_average_sell_price is an optional parameter that sets a required minimum average price for the entire trade. + // if the min_average_sell_price is not met the trade will fail. + // If min_average_sell_price is omitted limit_sell_price will be used instead MinAverageSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,12,opt,name=min_average_sell_price,json=minAverageSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"min_average_sell_price" yaml:"min_average_sell_price"` } From 0abd365744f51b18bcb86dbf1be98fd090936938 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Tue, 24 Sep 2024 11:37:51 -0400 Subject: [PATCH 3/8] Add param to SimulatePlaceLimitOrder --- x/dex/keeper/grpc_query_simulate_place_limit_order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/dex/keeper/grpc_query_simulate_place_limit_order.go b/x/dex/keeper/grpc_query_simulate_place_limit_order.go index 259fcdc95..b65e35193 100644 --- a/x/dex/keeper/grpc_query_simulate_place_limit_order.go +++ b/x/dex/keeper/grpc_query_simulate_place_limit_order.go @@ -49,6 +49,7 @@ func (k Keeper) SimulatePlaceLimitOrder( msg.OrderType, msg.ExpirationTime, msg.MaxAmountOut, + msg.MinAverageSellPrice, receiverAddr, ) if err != nil { From 9e6a99bf3f707a461ae0bdf0229e0684f1969b88 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Tue, 24 Sep 2024 17:40:45 -0400 Subject: [PATCH 4/8] fix merge --- x/dex/keeper/place_limit_order.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/dex/keeper/place_limit_order.go b/x/dex/keeper/place_limit_order.go index 680fe8a51..2ea6379d7 100644 --- a/x/dex/keeper/place_limit_order.go +++ b/x/dex/keeper/place_limit_order.go @@ -109,6 +109,7 @@ func (k Keeper) ExecutePlaceLimitOrder( var limitPrice math_utils.PrecDec limitPrice, err = types.CalcPrice(tickIndexInToOut) + if err != nil { return trancheKey, totalIn, swapInCoin, swapOutCoin, math.ZeroInt(), err } @@ -129,7 +130,7 @@ func (k Keeper) ExecutePlaceLimitOrder( if orderType.IsTakerOnly() { swapInCoin, swapOutCoin, err = k.TakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, maxAmountOut, limitPrice, minAvgSellPrice, orderType) } else { - swapInCoin, swapOutCoin, orderFilled, err = k.MakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, minAvgSellPrice, limitPrice) + swapInCoin, swapOutCoin, orderFilled, err = k.MakerLimitOrderSwap(ctx, *takerTradePairID, amountIn, limitPrice, minAvgSellPrice) } if err != nil { return trancheKey, totalIn, swapInCoin, swapOutCoin, math.ZeroInt(), err From 1848d6862e8c6e6493826f347bbe3dab2ce48bd7 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Tue, 24 Sep 2024 17:40:55 -0400 Subject: [PATCH 5/8] fix tests --- x/dex/keeper/integration_placelimitorder_test.go | 4 +--- x/dex/keeper/msg_server_test.go | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/x/dex/keeper/integration_placelimitorder_test.go b/x/dex/keeper/integration_placelimitorder_test.go index c5919a39d..f1a530681 100644 --- a/x/dex/keeper/integration_placelimitorder_test.go +++ b/x/dex/keeper/integration_placelimitorder_test.go @@ -260,7 +260,6 @@ func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPriceFails() { Receiver: s.alice.String(), TokenIn: "TokenA", TokenOut: "TokenB", - TickIndexInToOut: 0, LimitSellPrice: &limitPrice, AmountIn: sdkmath.NewInt(2000), OrderType: types.LimitOrderType_GOOD_TIL_CANCELLED, @@ -281,13 +280,12 @@ func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPrice() { ) // THEN alice IoC limitOrder with lower min avg prices success limitPrice := math_utils.MustNewPrecDecFromStr("0.006737") - minAvgPrice := math_utils.MustNewPrecDecFromStr("0.006736") + minAvgPrice := math_utils.MustNewPrecDecFromStr("0.006728") _, err := s.msgServer.PlaceLimitOrder(s.Ctx, &types.MsgPlaceLimitOrder{ Creator: s.alice.String(), Receiver: s.alice.String(), TokenIn: "TokenA", TokenOut: "TokenB", - TickIndexInToOut: 0, LimitSellPrice: &limitPrice, AmountIn: sdkmath.NewInt(2000), OrderType: types.LimitOrderType_GOOD_TIL_CANCELLED, diff --git a/x/dex/keeper/msg_server_test.go b/x/dex/keeper/msg_server_test.go index 2a64badc8..af8a907e0 100644 --- a/x/dex/keeper/msg_server_test.go +++ b/x/dex/keeper/msg_server_test.go @@ -2219,11 +2219,10 @@ func TestMsgPlaceLimitOrderValidate(t *testing.T) { TokenIn: "TokenA", TokenOut: "TokenB", LimitSellPrice: &FIVEDEC, - TickIndexInToOut: 0, AmountIn: sdkmath.OneInt(), MinAverageSellPrice: &ZERODEC, }, - types.ErrInvalidPriceAndTick, + types.ErrZeroMinAverageSellPrice, }, } From f289c3ef217b0df88ff2f2b51a184645b388245e Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Wed, 25 Sep 2024 15:40:52 -0400 Subject: [PATCH 6/8] fix: better test naming --- x/dex/keeper/integration_placelimitorder_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dex/keeper/integration_placelimitorder_test.go b/x/dex/keeper/integration_placelimitorder_test.go index f1a530681..291be4f13 100644 --- a/x/dex/keeper/integration_placelimitorder_test.go +++ b/x/dex/keeper/integration_placelimitorder_test.go @@ -243,7 +243,7 @@ func (s *DexTestSuite) TestPlaceLimitOrderInsufficientFunds() { s.assertAliceLimitSellFails(err, "TokenA", 0, 10) } -func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPriceFails() { +func (s *DexTestSuite) TestPlaceLimitOrderGTCWithDustMinAvgPriceFails() { s.fundAliceBalances(1, 0) s.fundBobBalances(0, 1) // GIVEN LP liq at 148.37-148.42 (with dust) @@ -268,7 +268,7 @@ func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPriceFails() { s.ErrorIs(err, types.ErrLimitPriceNotSatisfied) } -func (s *DexTestSuite) TestPlaceLimitOrderWithDustMinAvgPrice() { +func (s *DexTestSuite) TestPlaceLimitOrderGTCWithDustMinAvgPrice() { s.fundAliceBalances(1, 0) s.fundBobBalances(0, 1) // GIVEN LP liq at 148.37-148.42 (with dust) From 78730d73d84846192f01a9a20b74884e8e2ebfc2 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Thu, 10 Oct 2024 23:38:58 -0400 Subject: [PATCH 7/8] fix proto version --- proto/neutron/dex/tx.proto | 2 +- x/dex/types/tx.pb.go | 249 ++++++++++++++++++------------------- 2 files changed, 125 insertions(+), 126 deletions(-) diff --git a/proto/neutron/dex/tx.proto b/proto/neutron/dex/tx.proto index 17f5cb26e..4b5bb18be 100644 --- a/proto/neutron/dex/tx.proto +++ b/proto/neutron/dex/tx.proto @@ -170,7 +170,7 @@ message MsgPlaceLimitOrder { // If min_average_sell_price is omitted limit_sell_price will be used instead string min_average_sell_price = 12 [ (gogoproto.moretags) = "yaml:\"min_average_sell_price\"", - (gogoproto.customtype) = "github.com/neutron-org/neutron/v4/utils/math.PrecDec", + (gogoproto.customtype) = "github.com/neutron-org/neutron/v5/utils/math.PrecDec", (gogoproto.nullable) = true, (gogoproto.jsontag) = "min_average_sell_price" ]; diff --git a/x/dex/types/tx.pb.go b/x/dex/types/tx.pb.go index 024869f3d..93681d614 100644 --- a/x/dex/types/tx.pb.go +++ b/x/dex/types/tx.pb.go @@ -16,7 +16,6 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" - github_com_neutron_org_neutron_v4_utils_math "github.com/neutron-org/neutron/v4/utils/math" github_com_neutron_org_neutron_v5_utils_math "github.com/neutron-org/neutron/v5/utils/math" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -459,7 +458,7 @@ type MsgPlaceLimitOrder struct { // min_average_sell_price is an optional parameter that sets a required minimum average price for the entire trade. // if the min_average_sell_price is not met the trade will fail. // If min_average_sell_price is omitted limit_sell_price will be used instead - MinAverageSellPrice *github_com_neutron_org_neutron_v4_utils_math.PrecDec `protobuf:"bytes,12,opt,name=min_average_sell_price,json=minAverageSellPrice,proto3,customtype=github.com/neutron-org/neutron/v4/utils/math.PrecDec" json:"min_average_sell_price" yaml:"min_average_sell_price"` + MinAverageSellPrice *github_com_neutron_org_neutron_v5_utils_math.PrecDec `protobuf:"bytes,12,opt,name=min_average_sell_price,json=minAverageSellPrice,proto3,customtype=github.com/neutron-org/neutron/v5/utils/math.PrecDec" json:"min_average_sell_price" yaml:"min_average_sell_price"` } func (m *MsgPlaceLimitOrder) Reset() { *m = MsgPlaceLimitOrder{} } @@ -1062,129 +1061,129 @@ func init() { func init() { proto.RegisterFile("neutron/dex/tx.proto", fileDescriptor_a489f6e187d5e074) } var fileDescriptor_a489f6e187d5e074 = []byte{ - // 1942 bytes of a gzipped FileDescriptorProto + // 1940 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcb, 0x6f, 0x23, 0x49, - 0x19, 0x4f, 0xdb, 0x79, 0xb9, 0x92, 0x38, 0x9e, 0x4e, 0x66, 0xd2, 0xf1, 0x40, 0xda, 0xea, 0x59, - 0xed, 0x98, 0x11, 0x63, 0x8f, 0x87, 0xdd, 0x3d, 0xe4, 0x80, 0x64, 0xe7, 0xb1, 0x6b, 0xd6, 0x9e, - 0x44, 0x3d, 0x5e, 0x81, 0x76, 0x25, 0x9a, 0xb6, 0xbb, 0xe2, 0xb4, 0xd2, 0xdd, 0x65, 0x75, 0x95, - 0x1d, 0x87, 0x0b, 0x2b, 0xc4, 0x69, 0x4f, 0x7b, 0x41, 0x20, 0xf1, 0x0f, 0x80, 0xc4, 0x61, 0x0e, - 0x7b, 0xe6, 0x3c, 0xdc, 0x56, 0x48, 0x48, 0xc0, 0xc1, 0xc0, 0xcc, 0x61, 0xa4, 0x3d, 0xe6, 0x00, - 0x17, 0x84, 0x50, 0x3d, 0xdc, 0x2f, 0x3b, 0xaf, 0x65, 0x16, 0x71, 0xd8, 0x4b, 0xdc, 0xf5, 0xfb, - 0xbe, 0xfa, 0xea, 0x57, 0xf5, 0x3d, 0xea, 0xeb, 0x0e, 0x58, 0xf7, 0x60, 0x9f, 0xf8, 0xc8, 0x2b, - 0x5b, 0x70, 0x58, 0x26, 0xc3, 0x52, 0xcf, 0x47, 0x04, 0xc9, 0x4b, 0x02, 0x2d, 0x59, 0x70, 0x98, - 0xbf, 0x65, 0xba, 0xb6, 0x87, 0xca, 0xec, 0x2f, 0x97, 0xe7, 0xb7, 0x3a, 0x08, 0xbb, 0x08, 0x97, - 0xdb, 0x26, 0x86, 0xe5, 0x41, 0xa5, 0x0d, 0x89, 0x59, 0x29, 0x77, 0x90, 0xed, 0x09, 0xf9, 0x86, - 0x90, 0xbb, 0xb8, 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c, 0x0b, 0xd8, 0xb9, 0x49, 0x76, 0x6e, 0x84, 0x9d, 0xf6, 0x13, 0xb0, 0xde, + 0xc2, 0xbd, 0x1d, 0xd3, 0xeb, 0x42, 0xe7, 0xf5, 0xf8, 0xb9, 0x94, 0xf4, 0xf3, 0xa6, 0xf0, 0x73, + 0x72, 0x11, 0xed, 0x2f, 0x29, 0x16, 0x6c, 0x49, 0xfc, 0x6b, 0xbf, 0xbe, 0x06, 0xbf, 0xde, 0x05, + 0xab, 0xad, 0x81, 0x43, 0xec, 0x77, 0x51, 0x5f, 0x47, 0x03, 0x02, 0x69, 0x0f, 0x7d, 0x8c, 0xfa, + 0x98, 0xbf, 0x37, 0xea, 0xec, 0x59, 0xfb, 0x7d, 0x1a, 0xac, 0xb5, 0x70, 0x6f, 0xa2, 0xf8, 0xe4, + 0xd4, 0xec, 0x7f, 0xc1, 0x2e, 0xeb, 0x11, 0x58, 0xf4, 0xe9, 0x32, 0xb3, 0x5f, 0xcc, 0x62, 0x4c, + 0x74, 0xa1, 0x19, 0xef, 0x96, 0xe6, 0x5f, 0x73, 0xb7, 0x44, 0x5b, 0x06, 0x38, 0xb2, 0x89, 0xc1, + 0x6f, 0x71, 0x7e, 0x29, 0x2f, 0x04, 0x2d, 0xc3, 0xdc, 0x97, 0x69, 0x19, 0x92, 0x76, 0xc3, 0x96, + 0x21, 0x29, 0xd1, 0x68, 0xeb, 0x64, 0x13, 0x16, 0xdb, 0xbc, 0x65, 0x78, 0x13, 0xac, 0xf5, 0x69, + 0x5b, 0xd9, 0x81, 0x98, 0x18, 0xec, 0x20, 0x94, 0x45, 0xf6, 0x71, 0x68, 0x95, 0xc2, 0x75, 0x88, + 0x09, 0x3b, 0xa4, 0xed, 0x37, 0x92, 0x59, 0xb4, 0x2e, 0xb2, 0x28, 0xea, 0x2c, 0xed, 0x0f, 0x29, + 0xb0, 0x99, 0xc0, 0x82, 0xec, 0xf9, 0xb9, 0x04, 0x32, 0xaf, 0x9e, 0x37, 0x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 0xd2, 0x27, 0x2f, 0xb6, 0xe6, 0x3e, 0x7b, 0xb1, 0x35, + 0xf7, 0xe7, 0x17, 0x5b, 0x73, 0x1f, 0x3c, 0xb8, 0xba, 0xd0, 0x8f, 0xf8, 0xff, 0x30, 0x68, 0xa9, + 0xe8, 0x2c, 0xb2, 0x77, 0xe1, 0xef, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x95, 0x04, 0x7c, 0xe0, + 0xdf, 0x18, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -4623,7 +4622,7 @@ func (m *MsgPlaceLimitOrder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_neutron_org_neutron_v4_utils_math.PrecDec + var v github_com_neutron_org_neutron_v5_utils_math.PrecDec m.MinAverageSellPrice = &v if err := m.MinAverageSellPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err From 4fbfc0124e7cde8970d1b6da6d4be21e0cdfb81d Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Thu, 10 Oct 2024 23:57:59 -0400 Subject: [PATCH 8/8] Add additional test for MinAveragePrice > LimitSellPrice --- .../integration_placelimitorder_test.go | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/x/dex/keeper/integration_placelimitorder_test.go b/x/dex/keeper/integration_placelimitorder_test.go index e86f985c9..f63f9b8a3 100644 --- a/x/dex/keeper/integration_placelimitorder_test.go +++ b/x/dex/keeper/integration_placelimitorder_test.go @@ -396,6 +396,48 @@ func (s *DexTestSuite) TestPlaceLimitOrderIOCWithDustMinAvgPrice() { s.NoError(err) } +func (s *DexTestSuite) TestPlaceLimitOrderIOCMinAvgPriceGTSellPriceFails() { + s.fundAliceBalances(40, 0) + s.fundBobBalances(0, 40) + // GIVEN LP liq between taker price .995 and .992 + s.bobDeposits( + NewDeposit(0, 10, 50, 1), + NewDeposit(0, 10, 60, 1), + NewDeposit(0, 10, 70, 1), + NewDeposit(0, 10, 80, 1), + ) + // THEN alice places IOC limitOrder with very low MinAveragePrice Fails + _, err := s.aliceLimitSellsWithMinAvgPrice( + "TokenA", + math_utils.MustNewPrecDecFromStr("0.99"), + 40, + math_utils.MustNewPrecDecFromStr("0.995"), + types.LimitOrderType_IMMEDIATE_OR_CANCEL, + ) + s.ErrorIs(err, types.ErrLimitPriceNotSatisfied) +} + +func (s *DexTestSuite) TestPlaceLimitOrderIOCMinAvgPriceGTSellPrice() { + s.fundAliceBalances(40, 0) + s.fundBobBalances(0, 40) + // GIVEN LP liq between taker price .995 and .992 + s.bobDeposits( + NewDeposit(0, 10, 50, 1), + NewDeposit(0, 10, 60, 1), + NewDeposit(0, 10, 70, 1), + NewDeposit(0, 10, 80, 1), + ) + // THEN alice places IOC limitOrder with an achievable MinAveragePrice + _, err := s.aliceLimitSellsWithMinAvgPrice( + "TokenA", + math_utils.MustNewPrecDecFromStr("0.99"), + 40, + math_utils.MustNewPrecDecFromStr("0.993"), + types.LimitOrderType_IMMEDIATE_OR_CANCEL, + ) + s.NoError(err) +} + func (s *DexTestSuite) TestPlaceLimitOrderWithDust() { s.fundAliceBalances(1, 0) s.fundBobBalances(0, 1)