Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit de32966

Browse files
committedSep 12, 2023
fix(KC): compiler error
1 parent 308ba85 commit de32966

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed
 

‎contracts/src/arbitration/KlerosCore.sol

+7-9
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ contract KlerosCore is IArbitratorV2 {
525525
function setStakeBySortitionModule(
526526
address _account,
527527
uint96 _courtID,
528-
uint256 _stake,
528+
uint256 _newStake,
529529
bool _alreadyTransferred
530530
) external {
531531
if (msg.sender != address(sortitionModule)) revert WrongCaller();
@@ -1127,13 +1127,9 @@ contract KlerosCore is IArbitratorV2 {
11271127
/// @param _alreadyTransferred True if the tokens were already transferred from juror. Only relevant for delayed stakes.
11281128
/// @return succeeded True if the call succeeded, false otherwise.
11291129
function _setStakeForAccount(
1130-
11311130
address _account,
1132-
11331131
uint96 _courtID,
1134-
1135-
uint256 _newStake
1136-
,
1132+
uint256 _newStake,
11371133
bool _alreadyTransferred
11381134
) internal returns (bool succeeded) {
11391135
if (_courtID == FORKING_COURT || _courtID > courts.length) return false;
@@ -1159,7 +1155,7 @@ contract KlerosCore is IArbitratorV2 {
11591155
if (_newStake >= currentStake) {
11601156
if (!_alreadyTransferred) {
11611157
// 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.
11631159
// (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.
11641160
uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard
11651161
transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard
@@ -1202,13 +1198,15 @@ contract KlerosCore is IArbitratorV2 {
12021198
// Note that stakedPnk can become async with currentStake (e.g. after penalty).
12031199
// Also note that these values were already updated if the stake was only partially delayed.
12041200
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;
12061204
juror.stakedPnkByCourt[_courtID] = _newStake;
12071205
}
12081206

12091207
// Transfer the tokens but don't update sortition module.
12101208
if (result == ISortitionModule.preStakeHookResult.partiallyDelayed) {
1211-
emit StakePartiallyDelayed(_account, _courtID, _stake);
1209+
emit StakePartiallyDelayed(_account, _courtID, _newStake);
12121210
return true;
12131211
}
12141212

0 commit comments

Comments
 (0)
Please sign in to comment.