Skip to content

Commit

Permalink
fix: ruler
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Aug 9, 2024
1 parent e2a3a58 commit 740193d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import {DisputeResolver, IArbitratorV2, IDisputeTemplateRegistry} from "../arbitrables/DisputeResolver.sol";

pragma solidity 0.8.18;
pragma solidity 0.8.24;

interface IKlerosCoreRulerFragment {
function getNextDisputeID() external view returns (uint256);
Expand Down
31 changes: 15 additions & 16 deletions contracts/src/arbitration/devtools/KlerosCoreRuler.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.18;
pragma solidity 0.8.24;

import {IArbitrableV2, IArbitratorV2} from "../interfaces/IArbitratorV2.sol";
import {SafeERC20, IERC20} from "../../libraries/SafeERC20.sol";
import {Constants} from "../../libraries/Constants.sol";
import {OnError} from "../../libraries/Types.sol";
import {UUPSProxiable} from "../../proxy/UUPSProxiable.sol";
import {Initializable} from "../../proxy/Initializable.sol";
import "../../libraries/Constants.sol";

/// @title KlerosCoreRuler
/// Core arbitrator contract for development and testing purposes.
Expand Down Expand Up @@ -188,7 +187,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {

// GENERAL_COURT
Court storage court = courts.push();
court.parent = Constants.FORKING_COURT;
court.parent = FORKING_COURT;
court.children = new uint256[](0);
court.hiddenVotes = false;
court.minStake = _courtParameters[0];
Expand Down Expand Up @@ -262,7 +261,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
uint256 _jurorsForCourtJump,
uint256[4] memory _timesPerPeriod
) external onlyByGovernor {
if (_parent == Constants.FORKING_COURT) revert InvalidForkingCourtAsParent();
if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent();

uint256 courtID = courts.length;
Court storage court = courts.push();
Expand Down Expand Up @@ -387,7 +386,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
) external payable override returns (uint256 disputeID) {
if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();

return _createDispute(_numberOfChoices, _extraData, Constants.NATIVE_CURRENCY, msg.value);
return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);
}

/// @inheritdoc IArbitratorV2
Expand Down Expand Up @@ -516,7 +515,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
Round storage round = dispute.rounds[_round];
uint256 feeReward = round.totalFeesForJurors;
round.sumFeeRewardPaid += feeReward;
if (round.feeToken == Constants.NATIVE_CURRENCY) {
if (round.feeToken == NATIVE_CURRENCY) {
// The dispute fees were paid in ETH
payable(account).send(feeReward);
} else {
Expand Down Expand Up @@ -573,7 +572,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
uint256 nbVotes = round.totalFeesForJurors / court.feeForJuror;
if (_jump) {
// Jump to parent court.
if (dispute.courtID == Constants.GENERAL_COURT) {
if (dispute.courtID == GENERAL_COURT) {
// TODO: Handle the forking when appealed in General court.
cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.
} else {
Expand Down Expand Up @@ -648,19 +647,19 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable {
minJurors := mload(add(_extraData, 0x40))
disputeKitID := mload(add(_extraData, 0x60))
}
if (courtID == Constants.FORKING_COURT || courtID >= courts.length) {
courtID = Constants.GENERAL_COURT;
if (courtID == FORKING_COURT || courtID >= courts.length) {
courtID = GENERAL_COURT;
}
if (minJurors == 0) {
minJurors = Constants.DEFAULT_NB_OF_JURORS;
minJurors = DEFAULT_NB_OF_JURORS;
}
if (disputeKitID == Constants.NULL_DISPUTE_KIT) {
disputeKitID = Constants.DISPUTE_KIT_CLASSIC; // 0 index is not used.
if (disputeKitID == NULL_DISPUTE_KIT) {
disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.
}
} else {
courtID = Constants.GENERAL_COURT;
minJurors = Constants.DEFAULT_NB_OF_JURORS;
disputeKitID = Constants.DISPUTE_KIT_CLASSIC;
courtID = GENERAL_COURT;
minJurors = DEFAULT_NB_OF_JURORS;
disputeKitID = DISPUTE_KIT_CLASSIC;
}
}

Expand Down

0 comments on commit 740193d

Please sign in to comment.