Skip to content

Commit

Permalink
fix: correct and simplify calc for slashed pending magnitude
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Oct 1, 2024
1 parent 9cdc3a0 commit 159af29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ contract AllocationManager is
mInfo.currentMagnitude -= slashedMagnitude;
// if there is a pending deallocation, slash pending deallocation proportionally
if (mInfo.pendingMagnitudeDiff < 0) {
uint256 pendingMagnitudeDiff = uint256(uint128(-mInfo.pendingMagnitudeDiff)) * (BIPS_FACTOR - bipsToSlash) / BIPS_FACTOR;
mInfo.pendingMagnitudeDiff += -int128(uint128(pendingMagnitudeDiff));
uint128 slashedPending = uint128(uint128(-mInfo.pendingMagnitudeDiff) * bipsToSlash / BIPS_FACTOR);
mInfo.pendingMagnitudeDiff += int128(slashedPending);
}
// update operatorMagnitudeInfo
_operatorMagnitudeInfo[operator][strategies[i]][operatorSetKey] = mInfo;
Expand Down

0 comments on commit 159af29

Please sign in to comment.