@@ -525,7 +525,7 @@ contract KlerosCore is IArbitratorV2 {
525
525
function setStakeBySortitionModule (
526
526
address _account ,
527
527
uint96 _courtID ,
528
- uint256 _stake ,
528
+ uint256 _newStake ,
529
529
bool _alreadyTransferred
530
530
) external {
531
531
if (msg .sender != address (sortitionModule)) revert WrongCaller ();
@@ -1127,13 +1127,9 @@ contract KlerosCore is IArbitratorV2 {
1127
1127
/// @param _alreadyTransferred True if the tokens were already transferred from juror. Only relevant for delayed stakes.
1128
1128
/// @return succeeded True if the call succeeded, false otherwise.
1129
1129
function _setStakeForAccount (
1130
-
1131
1130
address _account ,
1132
-
1133
1131
uint96 _courtID ,
1134
-
1135
- uint256 _newStake
1136
- ,
1132
+ uint256 _newStake ,
1137
1133
bool _alreadyTransferred
1138
1134
) internal returns (bool succeeded ) {
1139
1135
if (_courtID == FORKING_COURT || _courtID > courts.length ) return false ;
@@ -1159,7 +1155,7 @@ contract KlerosCore is IArbitratorV2 {
1159
1155
if (_newStake >= currentStake) {
1160
1156
if (! _alreadyTransferred) {
1161
1157
// Stake increase
1162
- // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.
1158
+ // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.
1163
1159
// (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.
1164
1160
uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0 ; // underflow guard
1165
1161
transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard
@@ -1202,13 +1198,15 @@ contract KlerosCore is IArbitratorV2 {
1202
1198
// Note that stakedPnk can become async with currentStake (e.g. after penalty).
1203
1199
// Also note that these values were already updated if the stake was only partially delayed.
1204
1200
if (! _alreadyTransferred) {
1205
- juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;
1201
+ juror.stakedPnk = (juror.stakedPnk >= currentStake)
1202
+ ? juror.stakedPnk - currentStake + _newStake
1203
+ : _newStake;
1206
1204
juror.stakedPnkByCourt[_courtID] = _newStake;
1207
1205
}
1208
1206
1209
1207
// Transfer the tokens but don't update sortition module.
1210
1208
if (result == ISortitionModule.preStakeHookResult.partiallyDelayed) {
1211
- emit StakePartiallyDelayed (_account, _courtID, _stake );
1209
+ emit StakePartiallyDelayed (_account, _courtID, _newStake );
1212
1210
return true ;
1213
1211
}
1214
1212
0 commit comments