Skip to content

Commit

Permalink
Axelarcork events
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit committed Oct 22, 2024
1 parent 10561f1 commit 9f0eff1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions x/axelarcork/keeper/abci.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"encoding/hex"
"fmt"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -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())))),
),
},
)
}
}

Expand Down
12 changes: 12 additions & 0 deletions x/axelarcork/types/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package types

// axelarcork module event types
const (
EventTypeAxelarCorkApproved = "axelar_cork_approved"

AttributeKeyCork = "cork"
AttributeKeyBlockHeight = "block_height"
AttributeKeyCorkId = "cork_id"

Check failure on line 9 in x/axelarcork/types/events.go

View workflow job for this annotation

GitHub Actions / golangci-lint

const `AttributeKeyCorkId` should be `AttributeKeyCorkID` (golint)

AttributeValueCategory = ModuleName
)

0 comments on commit 9f0eff1

Please sign in to comment.