Skip to content

Commit

Permalink
fix: Use correct existing delegation amount (#752)
Browse files Browse the repository at this point in the history
* use correct existing delegation amount

* changelog
  • Loading branch information
kruspy authored Jan 25, 2024
1 parent 721ede7 commit c7cc855
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion x/liquidstakeibc/keeper/icq.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()),
),
Expand Down

0 comments on commit c7cc855

Please sign in to comment.