@@ -497,7 +497,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
497497 function setStakeBySortitionModule (
498498 address _account ,
499499 uint96 _courtID ,
500- uint256 _stake ,
500+ uint256 _newStake ,
501501 bool _alreadyTransferred
502502 ) external {
503503 if (msg .sender != address (sortitionModule)) revert WrongCaller ();
@@ -1075,13 +1075,9 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
10751075 /// @param _alreadyTransferred True if the tokens were already transferred from juror. Only relevant for delayed stakes.
10761076 /// @return succeeded True if the call succeeded, false otherwise.
10771077 function _setStakeForAccount (
1078-
10791078 address _account ,
1080-
10811079 uint96 _courtID ,
1082-
1083- uint256 _newStake
1084- ,
1080+ uint256 _newStake ,
10851081 bool _alreadyTransferred
10861082 ) internal returns (bool succeeded ) {
10871083 if (_courtID == Constants.FORKING_COURT || _courtID > courts.length ) return false ;
@@ -1107,7 +1103,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
11071103 if (_newStake >= currentStake) {
11081104 if (! _alreadyTransferred) {
11091105 // Stake increase
1110- // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.
1106+ // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.
11111107 // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.
11121108 uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0 ; // underflow guard
11131109 transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard
@@ -1150,13 +1146,15 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
11501146 // Note that stakedPnk can become async with currentStake (e.g. after penalty).
11511147 // Also note that these values were already updated if the stake was only partially delayed.
11521148 if (! _alreadyTransferred) {
1153- juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;
1149+ juror.stakedPnk = (juror.stakedPnk >= currentStake)
1150+ ? juror.stakedPnk - currentStake + _newStake
1151+ : _newStake;
11541152 juror.stakedPnkByCourt[_courtID] = _newStake;
11551153 }
11561154
11571155 // Transfer the tokens but don't update sortition module.
11581156 if (result == ISortitionModule.preStakeHookResult.partiallyDelayed) {
1159- emit StakePartiallyDelayed (_account, _courtID, _stake );
1157+ emit StakePartiallyDelayed (_account, _courtID, _newStake );
11601158 return true ;
11611159 }
11621160
0 commit comments