Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eibc): add event for order deleted #1664

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions proto/dymensionxyz/dymension/eibc/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,16 @@ message EventDemandOrderFulfilledAuthorized {
// operator_fee is the fee of the operator.
string operator_fee = 14;
}

message EventDemandOrderDeleted {
// order_id is the unique identifier of the demand order.
string order_id = 1;
// packet_key is the base64 encoded key of the packet.
string packet_key = 2;
// packet_status is the status of the packet.
string packet_status = 3;
// rollapp_id is the id of the rollapp.
string rollapp_id = 4;
// packet_type is the type of the packet.
string packet_type = 5;
}
11 changes: 11 additions & 0 deletions x/eibc/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/dymensionxyz/sdk-utils/utils/uevent"

commontypes "github.com/dymensionxyz/dymension/v3/x/common/types"
delayeacktypes "github.com/dymensionxyz/dymension/v3/x/delayedack/types"
Expand Down Expand Up @@ -68,5 +69,15 @@ func (d delayedAckHooks) AfterPacketDeleted(ctx sdk.Context, rollappPacket *comm
statuses := []commontypes.Status{commontypes.Status_PENDING, commontypes.Status_FINALIZED}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any other package status can be deleted?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

for _, status := range statuses {
d.deleteDemandOrder(ctx, status, demandOrderID)

if err := uevent.EmitTypedEvent(ctx, &types.EventDemandOrderDeleted{
OrderId: demandOrderID,
PacketKey: string(packetKey),
PacketStatus: status.String(),
RollappId: rollappPacket.RollappId,
PacketType: rollappPacket.Type.String(),
}); err != nil {
d.Logger(ctx).Error("emit event", "error", err)
}
}
}
Loading
Loading