Skip to content

Commit

Permalink
Merge pull request #571 from PeggyJV/collin/events
Browse files Browse the repository at this point in the history
Better events for corks and contract call observation
  • Loading branch information
cbrit authored Oct 23, 2024
2 parents 198cad6 + c93341e commit 397d3b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/x/gravity/keeper/contract_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"bytes"
"encoding/hex"
"fmt"
"sort"

"cosmossdk.io/errors"
Expand Down Expand Up @@ -65,6 +66,12 @@ func (k Keeper) contractCallExecuted(ctx sdk.Context, invalidationScope []byte,
})

k.CompleteOutgoingTx(ctx, completedCallTx)

ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeContractCallTxCompleted,
sdk.NewAttribute(types.AttributeKeyContractCallInvalidationScope, hex.EncodeToString(invalidationScope)),
sdk.NewAttribute(types.AttributeKeyContractCallInvalidationNonce, fmt.Sprint(invalidationNonce)),
))
}

// orderContractCallsByNonceAscending sorts a slice of contract calls by nonce in ascending order
Expand Down
1 change: 1 addition & 0 deletions module/x/gravity/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
EventTypeBridgeWithdrawalReceived = "withdrawal_received"
EventTypeBridgeDepositReceived = "deposit_received"
EventTypeBridgeWithdrawCanceled = "withdraw_canceled"
EventTypeContractCallTxCompleted = "contract_call_tx_completed"

AttributeKeyEthereumEventVoteRecordID = "ethereum_event_vote_record_id"
AttributeKeyBatchConfirmKey = "batch_confirm_key"
Expand Down

0 comments on commit 397d3b1

Please sign in to comment.