Skip to content

Commit

Permalink
fix(KC): maxTotal bug
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownunknown1 committed Mar 4, 2024
1 parent 46a0f39 commit 1248c09
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions contracts/src/arbitration/KlerosCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {

address public guardian; // The address that is capable to pause the asset withdrawals.
bool public paused;
uint256 public maxTotalStaked;
uint256 public maxTotalStaked; // Max total allowed.
uint256 public totalStaked; // Total pnk staked in all courts.
IERC721 public nftContract;

address public jurorProsecutionModule; // The module for juror's prosecution.
Expand Down Expand Up @@ -1151,14 +1152,18 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {
_stakingFailed(_onError);
return false;
}
maxTotalStaked += pnkDeposit;
totalStaked += pnkDeposit;
if (totalStaked > maxTotalStaked) {
_stakingFailed(_onError);
return false;
}
}
if (pnkWithdrawal > 0) {
if (!pinakion.safeTransfer(_account, pnkWithdrawal)) {
_stakingFailed(_onError);
return false;
}
maxTotalStaked -= pnkWithdrawal;
totalStaked -= pnkWithdrawal;
}
return true;
}
Expand Down

0 comments on commit 1248c09

Please sign in to comment.