Skip to content

Commit 8f14e34

Browse files
committed
refactor: change variable naming (xdai-->eth)
1 parent 1bf78ef commit 8f14e34

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

contracts/kleros/xKlerosLiquid.sol

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import { SortitionSumTreeFactory } from "@kleros/kleros/contracts/data-structure
2121
/**
2222
* @title xKlerosLiquid
2323
* @dev This contract is an adaption of Mainnet's KlerosLiquid (https://github.com/kleros/kleros/blob/69cfbfb2128c29f1625b3a99a3183540772fda08/contracts/kleros/KlerosLiquid.sol)
24-
* for xDai chain.
24+
* for xDai chain. Notice that variables referring to ETH values in this contract, will hold the native token values of the chain on which xKlerosLiquid is deployed.
25+
* When this contract gets deployed on xDai chain, ETH variables will hold xDai values.
2526
*/
2627
contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
2728
/* Enums */
@@ -133,12 +134,11 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
133134
*/
134135
event Draw(address indexed _address, uint indexed _disputeID, uint _appeal, uint _voteID);
135136

136-
/** @dev Emitted when a juror wins or loses tokens and xDai from a dispute.
137-
* The original name from KlerosLiquid is kept in this event to match its ABI.
137+
/** @dev Emitted when a juror wins or loses tokens and ETH from a dispute.
138138
* @param _address The juror affected.
139139
* @param _disputeID The ID of the dispute.
140140
* @param _tokenAmount The amount of tokens won or lost.
141-
* @param _ETHAmount The amount of xDai won or lost.
141+
* @param _ETHAmount The amount of ETH won or lost.
142142
*/
143143
event TokenAndETHShift(address indexed _address, uint indexed _disputeID, int _tokenAmount, int _ETHAmount);
144144

@@ -147,7 +147,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
147147
// General Constants
148148
uint public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.
149149
uint public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.
150-
uint public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of xDai.
150+
uint public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.
151151
uint public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.
152152
// General Contracts
153153
address public governor; // The governor of the contract.
@@ -571,12 +571,11 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
571571
}
572572
}
573573

574-
/** @dev Computes the token and xDai rewards for a specified appeal in a specified dispute.
575-
* The original name from KlerosLiquid is kept in this function to match its ABI.
574+
/** @dev Computes the token and ETH rewards for a specified appeal in a specified dispute.
576575
* @param _disputeID The ID of the dispute.
577576
* @param _appeal The appeal.
578577
* @return tokenReward The token reward.
579-
* @return ETHReward The xDai reward.
578+
* @return ETHReward The ETH reward.
580579
*/
581580
function computeTokenAndETHRewards(uint _disputeID, uint _appeal) private view returns(uint tokenReward, uint ETHReward) {
582581
Dispute storage dispute = disputes[_disputeID];
@@ -601,7 +600,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
601600
}
602601
}
603602

604-
/** @dev Repartitions tokens and xDai for a specified appeal in a specified dispute. Can be called in parts.
603+
/** @dev Repartitions tokens and ETH for a specified appeal in a specified dispute. Can be called in parts.
605604
* `O(i + u * n * (n + p * log_k(j)))` where
606605
* `i` is the number of iterations to run,
607606
* `u` is the number of jurors that need to be unstaked,
@@ -619,7 +618,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
619618
uint end = dispute.repartitionsInEachRound[_appeal] + _iterations;
620619
require(end >= dispute.repartitionsInEachRound[_appeal]);
621620
uint penaltiesInRoundCache = dispute.penaltiesInEachRound[_appeal]; // For saving gas.
622-
(uint tokenReward, uint xDaiReward) = (0, 0);
621+
(uint tokenReward, uint ETHReward) = (0, 0);
623622

624623
// Avoid going out of range.
625624
if (
@@ -630,7 +629,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
630629
if (end > dispute.votes[_appeal].length) end = dispute.votes[_appeal].length;
631630
} else {
632631
// We loop over the votes twice, first to collect penalties, and second to distribute them as rewards along with arbitration fees.
633-
(tokenReward, xDaiReward) = dispute.repartitionsInEachRound[_appeal] >= dispute.votes[_appeal].length ? computeTokenAndETHRewards(_disputeID, _appeal) : (0, 0); // Compute rewards if rewarding.
632+
(tokenReward, ETHReward) = dispute.repartitionsInEachRound[_appeal] >= dispute.votes[_appeal].length ? computeTokenAndETHRewards(_disputeID, _appeal) : (0, 0); // Compute rewards if rewarding.
634633
if (end > dispute.votes[_appeal].length * 2) end = dispute.votes[_appeal].length * 2;
635634
}
636635
for (uint i = dispute.repartitionsInEachRound[_appeal]; i < end; i++) {
@@ -644,8 +643,8 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
644643
// Reward.
645644
pinakion.transfer(vote.account, tokenReward);
646645
// Intentional use to avoid blocking.
647-
vote.account.send(xDaiReward); // solium-disable-line security/no-send
648-
emit TokenAndETHShift(vote.account, _disputeID, int(tokenReward), int(xDaiReward));
646+
vote.account.send(ETHReward); // solium-disable-line security/no-send
647+
emit TokenAndETHShift(vote.account, _disputeID, int(tokenReward), int(ETHReward));
649648
jurors[vote.account].lockedTokens -= dispute.tokensAtStakePerJuror[_appeal];
650649
}
651650
} else { // Juror was inactive, or voted incoherently and it was not a tie.
@@ -674,7 +673,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
674673
} else if (i + 1 < end) {
675674
// Compute rewards because we are going into rewarding.
676675
dispute.penaltiesInEachRound[_appeal] = penaltiesInRoundCache;
677-
(tokenReward, xDaiReward) = computeTokenAndETHRewards(_disputeID, _appeal);
676+
(tokenReward, ETHReward) = computeTokenAndETHRewards(_disputeID, _appeal);
678677
}
679678
}
680679
}
@@ -760,8 +759,8 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
760759
emit NewPeriod(_disputeID, Period.evidence);
761760
}
762761

763-
/** @dev DEPRECATED. Called when `_owner` sends xDai to the Wrapped Token contract.
764-
* @param _owner The address that sent the xDai to create tokens.
762+
/** @dev DEPRECATED. Called when `_owner` sends ETH to the Wrapped Token contract.
763+
* @param _owner The address that sent the ETH to create tokens.
765764
* @return allowed Whether the operation should be allowed or not.
766765
*/
767766
function proxyPayment(address _owner) public payable returns(bool allowed) { allowed = false; }

0 commit comments

Comments
 (0)