From 94d6f28a9418ccfc82aa2079da8eb0fe237dace1 Mon Sep 17 00:00:00 2001 From: kruspy Date: Thu, 11 Jan 2024 17:38:55 +0100 Subject: [PATCH] add events --- x/liquidstakeibc/keeper/abci.go | 22 ++++++++++++++++++++++ x/liquidstakeibc/types/events.go | 2 ++ 2 files changed, 24 insertions(+) diff --git a/x/liquidstakeibc/keeper/abci.go b/x/liquidstakeibc/keeper/abci.go index 6e65f70b3..32e5ff248 100644 --- a/x/liquidstakeibc/keeper/abci.go +++ b/x/liquidstakeibc/keeper/abci.go @@ -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 } @@ -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 } diff --git a/x/liquidstakeibc/types/events.go b/x/liquidstakeibc/types/events.go index 9f25670c0..f928c332e 100644 --- a/x/liquidstakeibc/types/events.go +++ b/x/liquidstakeibc/types/events.go @@ -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" @@ -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"