-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add helper fn for emit event
- Loading branch information
Showing
4 changed files
with
30 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package keeper | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" | ||
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" | ||
) | ||
|
||
// Emit event so that relayers know an incentivized packet is ready to be relayed | ||
func EmitIncentivizedPacket(ctx sdk.Context, identifiedFee types.IdentifiedPacketFee) { | ||
ctx.EventManager().EmitEvent( | ||
sdk.NewEvent( | ||
types.EventTypeIncentivizedPacket, | ||
sdk.NewAttribute(channeltypes.AttributeKeyPortID, identifiedFee.PacketId.PortId), | ||
sdk.NewAttribute(channeltypes.AttributeKeyChannelID, identifiedFee.PacketId.ChannelId), | ||
sdk.NewAttribute(channeltypes.AttributeKeySequence, fmt.Sprint(identifiedFee.PacketId.Sequence)), | ||
sdk.NewAttribute(types.AttributeKeyRecvFee, fmt.Sprint(identifiedFee.Fee.RecvFee)), | ||
sdk.NewAttribute(types.AttributeKeyAckFee, fmt.Sprint(identifiedFee.Fee.AckFee)), | ||
sdk.NewAttribute(types.AttributeKeyTimeoutFee, fmt.Sprint(identifiedFee.Fee.TimeoutFee)), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters