Skip to content

Commit

Permalink
fix(eibc): add event for order deleted (#1664)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Dec 17, 2024
1 parent b544906 commit c710052
Show file tree
Hide file tree
Showing 4 changed files with 449 additions and 45 deletions.
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}
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

0 comments on commit c710052

Please sign in to comment.