diff --git a/CHANGELOG.md b/CHANGELOG.md index 0925aa67a..b9e6b7671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +- [720](https://github.com/persistenceOne/pstake-native/pull/720) Fix unbondings loop. - [719](https://github.com/persistenceOne/pstake-native/pull/719) Fix afterEpoch hooks to take LiquidStake feature instead of LiquidStakeIBC diff --git a/x/liquidstakeibc/keeper/abci.go b/x/liquidstakeibc/keeper/abci.go index a718c0b3f..bf2bbd982 100644 --- a/x/liquidstakeibc/keeper/abci.go +++ b/x/liquidstakeibc/keeper/abci.go @@ -138,7 +138,25 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) { for _, userUnbonding := range userUnbondings { address, err := sdk.AccAddressFromBech32(userUnbonding.Address) if err != nil { - return + k.Logger(ctx).Error( + "could not send unbonded tokens from module account to delegator", + "host_chain", + hc.ChainId, + "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.AttributeClaimAddress, userUnbonding.Address), + sdk.NewAttribute(types.AttributeClaimStatus, unbonding.State.String()), + ), + ) + + continue } var claimableCoins sdk.Coins @@ -168,7 +186,19 @@ func (k *Keeper) DoClaim(ctx sdk.Context, hc *types.HostChain) { "epoch", userUnbonding.EpochNumber, ) - return + + 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 } // update the unbonding remaining amount and delete it if it reaches zero 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"