Skip to content

Commit

Permalink
Add amountOut for cancel limitOrderEvent to avoid breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcompagni10 committed Sep 25, 2024
1 parent b251376 commit f9bbf8c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/dex/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ func CancelLimitOrderEvent(
amountOutMaker math.Int,
trancheKey string,
) sdk.Event {
pairID := PairID{Token0: token0, Token1: token1}
takerDenom := pairID.MustOppositeToken(makerDenom)
coinsOut := sdk.NewCoins(
sdk.NewCoin(makerDenom, amountOutMaker),
sdk.NewCoin(takerDenom, amountOutTaker),
)
attrs := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, "dex"),
sdk.NewAttribute(sdk.AttributeKeyAction, CancelLimitOrderEventKey),
Expand All @@ -242,6 +248,8 @@ func CancelLimitOrderEvent(
sdk.NewAttribute(AttributeToken1, token1),
sdk.NewAttribute(AttributeTokenIn, makerDenom),
sdk.NewAttribute(AttributeTokenOut, tokenOut),
// DEPRECATED: `AmountOut` will be removed in the next release
sdk.NewAttribute(AttributeAmountOut, coinsOut.String()),
sdk.NewAttribute(AttributeTokenInAmountOut, amountOutMaker.String()),
sdk.NewAttribute(AttributeTokenOutAmountOut, amountOutTaker.String()),
sdk.NewAttribute(AttributeTrancheKey, trancheKey),
Expand Down

0 comments on commit f9bbf8c

Please sign in to comment.