Skip to content

Commit

Permalink
Add maxAmountOut attr to PlaceLimitOrder events
Browse files Browse the repository at this point in the history
  • Loading branch information
jcompagni10 committed Mar 3, 2025
1 parent 178f84b commit 5a74beb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions x/dex/keeper/place_limit_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (k Keeper) PlaceLimitOrderCore(
totalIn,
tickIndexInToOut,
orderType.String(),
maxAmountOut,
minAvgSellPrice,
sharesIssued,
trancheKey,
Expand Down
7 changes: 7 additions & 0 deletions x/dex/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
AttributeSharesOwned = "SharesOwned"
AttributeSharesWithdrawn = "SharesWithdrawn"
AttributeMinAvgSellPrice = "MinAvgSellPrice"
AttributeMaxAmountOut = "MaxAmountOut"
)

// Event Keys
Expand Down Expand Up @@ -171,12 +172,17 @@ func CreatePlaceLimitOrderEvent(
amountIn math.Int,
limitTick int64,
orderType string,
maxAmountOut *math.Int,
minAvgSellPrice math_utils.PrecDec,
shares math.Int,
trancheKey string,
swapAmountIn math.Int,
swapAmountOut math.Int,
) sdk.Event {
maxAmountOutStr := ""
if maxAmountOut != nil {
maxAmountOutStr = maxAmountOut.String()
}
attrs := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, "dex"),
sdk.NewAttribute(sdk.AttributeKeyAction, PlaceLimitOrderEventKey),
Expand All @@ -194,6 +200,7 @@ func CreatePlaceLimitOrderEvent(
sdk.NewAttribute(AttributeSwapAmountIn, swapAmountIn.String()),
sdk.NewAttribute(AttributeSwapAmountOut, swapAmountOut.String()),
sdk.NewAttribute(AttributeMinAvgSellPrice, minAvgSellPrice.String()),
sdk.NewAttribute(AttributeMaxAmountOut, maxAmountOutStr),
}

return sdk.NewEvent(sdk.EventTypeMessage, attrs...)
Expand Down

0 comments on commit 5a74beb

Please sign in to comment.