diff --git a/x/axelarcork/keeper/abci.go b/x/axelarcork/keeper/abci.go index d5fb43eb..980a967d 100644 --- a/x/axelarcork/keeper/abci.go +++ b/x/axelarcork/keeper/abci.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/hex" "fmt" "github.com/ethereum/go-ethereum/common" @@ -33,6 +34,18 @@ func (k Keeper) EndBlocker(ctx sdk.Context) { "chain id", config.Id) for _, c := range winningScheduledVotes { k.SetWinningAxelarCork(ctx, config.Id, uint64(ctx.BlockHeight()), c) + + ctx.EventManager().EmitEvents( + sdk.Events{ + sdk.NewEvent( + types.EventTypeAxelarCorkApproved, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeyCork, c.String()), + sdk.NewAttribute(types.AttributeKeyBlockHeight, fmt.Sprintf("%d", ctx.BlockHeight())), + sdk.NewAttribute(types.AttributeKeyCorkId, hex.EncodeToString(c.IDHash(uint64(ctx.BlockHeight())))), + ), + }, + ) } } diff --git a/x/axelarcork/types/events.go b/x/axelarcork/types/events.go new file mode 100644 index 00000000..ac05154d --- /dev/null +++ b/x/axelarcork/types/events.go @@ -0,0 +1,12 @@ +package types + +// axelarcork module event types +const ( + EventTypeAxelarCorkApproved = "axelar_cork_approved" + + AttributeKeyCork = "cork" + AttributeKeyBlockHeight = "block_height" + AttributeKeyCorkId = "cork_id" + + AttributeValueCategory = ModuleName +)