@@ -497,7 +497,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
497
497
function setStakeBySortitionModule (
498
498
address _account ,
499
499
uint96 _courtID ,
500
- uint256 _stake ,
500
+ uint256 _newStake ,
501
501
bool _alreadyTransferred
502
502
) external {
503
503
if (msg .sender != address (sortitionModule)) revert WrongCaller ();
@@ -1075,13 +1075,9 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
1075
1075
/// @param _alreadyTransferred True if the tokens were already transferred from juror. Only relevant for delayed stakes.
1076
1076
/// @return succeeded True if the call succeeded, false otherwise.
1077
1077
function _setStakeForAccount (
1078
-
1079
1078
address _account ,
1080
-
1081
1079
uint96 _courtID ,
1082
-
1083
- uint256 _newStake
1084
- ,
1080
+ uint256 _newStake ,
1085
1081
bool _alreadyTransferred
1086
1082
) internal returns (bool succeeded ) {
1087
1083
if (_courtID == Constants.FORKING_COURT || _courtID > courts.length ) return false ;
@@ -1107,7 +1103,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
1107
1103
if (_newStake >= currentStake) {
1108
1104
if (! _alreadyTransferred) {
1109
1105
// 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.
1111
1107
// (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.
1112
1108
uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0 ; // underflow guard
1113
1109
transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard
@@ -1150,13 +1146,15 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
1150
1146
// Note that stakedPnk can become async with currentStake (e.g. after penalty).
1151
1147
// Also note that these values were already updated if the stake was only partially delayed.
1152
1148
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;
1154
1152
juror.stakedPnkByCourt[_courtID] = _newStake;
1155
1153
}
1156
1154
1157
1155
// Transfer the tokens but don't update sortition module.
1158
1156
if (result == ISortitionModule.preStakeHookResult.partiallyDelayed) {
1159
- emit StakePartiallyDelayed (_account, _courtID, _stake );
1157
+ emit StakePartiallyDelayed (_account, _courtID, _newStake );
1160
1158
return true ;
1161
1159
}
1162
1160
0 commit comments