From c7cc855e4cf2abd525f00a979981093f6bb27c5f Mon Sep 17 00:00:00 2001 From: Marc Puig Date: Thu, 25 Jan 2024 17:55:30 +0100 Subject: [PATCH] fix: Use correct existing delegation amount (#752) * use correct existing delegation amount * changelog --- CHANGELOG.md | 1 + x/liquidstakeibc/keeper/icq.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d64595acf..aaf3396b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +- [752](https://github.com/persistenceOne/pstake-native/pull/752) Use correct existing delegation amount. - [751](https://github.com/persistenceOne/pstake-native/pull/751) Set LSM bond factor as -1 by default. - [750](https://github.com/persistenceOne/pstake-native/pull/750) Shares to tokens. - [734](https://github.com/persistenceOne/pstake-native/pull/734) Host chain duplication check. diff --git a/x/liquidstakeibc/keeper/icq.go b/x/liquidstakeibc/keeper/icq.go index b054ff2de..508939e4b 100644 --- a/x/liquidstakeibc/keeper/icq.go +++ b/x/liquidstakeibc/keeper/icq.go @@ -96,6 +96,7 @@ func DelegationCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Q ) } + existingDelegatedAmount := validator.DelegatedAmount delegatedAmount := validator.ExchangeRate.Mul(delegation.Shares) slashedAmount := sdk.NewDecFromInt(validator.DelegatedAmount).Sub(delegatedAmount) @@ -115,7 +116,7 @@ func DelegationCallback(k Keeper, ctx sdk.Context, data []byte, query icqtypes.Q types.EventTypeSlashing, sdk.NewAttribute(types.AttributeChainID, hc.ChainId), sdk.NewAttribute(types.AttributeValidatorAddress, validator.OperatorAddress), - sdk.NewAttribute(types.AttributeExistingDelegation, validator.DelegatedAmount.String()), + sdk.NewAttribute(types.AttributeExistingDelegation, existingDelegatedAmount.String()), sdk.NewAttribute(types.AttributeUpdatedDelegation, delegatedAmount.String()), sdk.NewAttribute(types.AttributeSlashedAmount, slashedAmount.String()), ),