Skip to content

Commit

Permalink
add events
Browse files Browse the repository at this point in the history
  • Loading branch information
kruspy committed Jan 11, 2024
1 parent 4494676 commit 94d6f28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions x/liquidstakeibc/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) {
for _, userUnbonding := range userUnbondings {
address, err := sdk.AccAddressFromBech32(userUnbonding.Address)
if err != nil {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventFailedClaimUnbondings,
sdk.NewAttribute(types.AttributeChainID, hc.ChainId),
sdk.NewAttribute(types.AttributeEpoch, strconv.FormatInt(epochNumber, 10)),
sdk.NewAttribute(types.AttributeClaimAddress, userUnbonding.Address),
sdk.NewAttribute(types.AttributeClaimStatus, unbonding.State.String()),
),
)

continue
}

Expand Down Expand Up @@ -168,6 +178,18 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) {
"epoch",
userUnbonding.EpochNumber,
)

ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventFailedClaimUnbondings,
sdk.NewAttribute(types.AttributeChainID, hc.ChainId),
sdk.NewAttribute(types.AttributeEpoch, strconv.FormatInt(epochNumber, 10)),
sdk.NewAttribute(types.AttributeClaimAmount, eventAmount.String()),
sdk.NewAttribute(types.AttributeClaimAddress, userUnbonding.Address),
sdk.NewAttribute(types.AttributeClaimStatus, unbonding.State.String()),
),
)

continue
}

Expand Down
2 changes: 2 additions & 0 deletions x/liquidstakeibc/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
EventUnsuccessfulValidatorUndelegationTransfer = "unsuccessful_validator_undelegation_transfer"
EventUnsuccessfulLSMRedeem = "unsuccessful_lsm_redeem"
EventUnsuccessfulRedelegate = "unsuccessful_redelegate"
EventFailedClaimUnbondings = "failed_claim_unbondings"

AttributeInputAmount = "input_amount"
AttributeOutputAmount = "output_amount"
Expand Down Expand Up @@ -77,6 +78,7 @@ const (
AttributeICAMessages = "ica_messages"
AttributeClaimAmount = "claimed_amount"
AttributeClaimAddress = "claim_address"
AttributeClaimStatus = "claim_status"
AttributeModuleMintedAmount = "minted_amount"
AttributeModuleLSMTokenizedAmount = "lsm_tokenized_amount" //nolint:gosec
AttributeModuleStakedAmount = "staked_amount"
Expand Down

0 comments on commit 94d6f28

Please sign in to comment.