Skip to content

Commit bc906e5

Browse files
committed
fix: autostake the token rewards in the court where the stake originates from
1 parent 7cb1275 commit bc906e5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

contracts/src/arbitration/KlerosCore.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,12 +969,13 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
969969
Dispute storage dispute = disputes[_params.disputeID];
970970
Round storage round = dispute.rounds[_params.round];
971971
IDisputeKit disputeKit = disputeKits[round.disputeKitID];
972+
uint256 repartition = _params.repartition % _params.numberOfVotesInRound;
972973

973974
// [0, 1] value that determines how coherent the juror was in this round, in basis points.
974975
(uint256 pnkCoherence, uint256 feeCoherence) = disputeKit.getDegreeOfCoherenceReward(
975976
_params.disputeID,
976977
_params.round,
977-
_params.repartition % _params.numberOfVotesInRound,
978+
repartition,
978979
_params.feePerJurorInRound,
979980
_params.pnkAtStakePerJurorInRound
980981
);
@@ -987,7 +988,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
987988
feeCoherence = ONE_BASIS_POINT;
988989
}
989990

990-
address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];
991+
address account = round.drawnJurors[repartition];
991992
uint256 pnkLocked = _applyCoherence(round.pnkAtStakePerJuror, pnkCoherence);
992993

993994
// Release the rest of the PNKs of the juror for this round.
@@ -1004,8 +1005,10 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
10041005
_transferFeeToken(round.feeToken, payable(account), feeReward);
10051006
}
10061007
if (pnkReward != 0) {
1008+
uint96 rewardedInCourtID = round.drawnJurorFromCourtIDs[repartition];
1009+
10071010
// Stake the PNK reward if possible, bypasses delayed stakes and other checks done by validateStake()
1008-
if (!sortitionModule.setStakeReward(account, dispute.courtID, pnkReward)) {
1011+
if (!sortitionModule.setStakeReward(account, rewardedInCourtID, pnkReward)) {
10091012
pinakion.safeTransfer(account, pnkReward);
10101013
}
10111014
}

0 commit comments

Comments
 (0)