@@ -8,13 +8,15 @@ import {ISortitionModule} from "./interfaces/ISortitionModule.sol";
88import {Initializable} from "../proxy/Initializable.sol " ;
99import {UUPSProxiable} from "../proxy/UUPSProxiable.sol " ;
1010import {SafeERC20, IERC20 } from "../libraries/SafeERC20.sol " ;
11+ import {SafeSend} from "../libraries/SafeSend.sol " ;
1112import "../libraries/Constants.sol " ;
1213
1314/// @title KlerosCoreBase
1415/// Core arbitrator contract for Kleros v2.
1516/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.
1617abstract contract KlerosCoreBase is IArbitratorV2 , Initializable , UUPSProxiable {
1718 using SafeERC20 for IERC20 ;
19+ using SafeSend for address payable ;
1820
1921 // ************************************* //
2022 // * Enums / Structs * //
@@ -99,6 +101,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
99101 Dispute[] public disputes; // The disputes.
100102 mapping (IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.
101103 bool public paused; // Whether asset withdrawals are paused.
104+ address public wNative; // The wrapped native token for safeSend().
102105
103106 // ************************************* //
104107 // * Events * //
@@ -199,13 +202,15 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
199202 uint256 [4 ] memory _courtParameters ,
200203 uint256 [4 ] memory _timesPerPeriod ,
201204 bytes memory _sortitionExtraData ,
202- ISortitionModule _sortitionModuleAddress
205+ ISortitionModule _sortitionModuleAddress ,
206+ address _wNative
203207 ) internal onlyInitializing {
204208 governor = _governor;
205209 guardian = _guardian;
206210 pinakion = _pinakion;
207211 jurorProsecutionModule = _jurorProsecutionModule;
208212 sortitionModule = _sortitionModuleAddress;
213+ wNative = _wNative;
209214
210215 // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a dispute kit is not supported.
211216 disputeKits.push ();
@@ -802,7 +807,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
802807 // No one was coherent, send the rewards to the governor.
803808 if (round.feeToken == NATIVE_CURRENCY) {
804809 // The dispute fees were paid in ETH
805- payable (governor).send (round.totalFeesForJurors);
810+ payable (governor).safeSend (round.totalFeesForJurors, wNative );
806811 } else {
807812 // The dispute fees were paid in ERC20
808813 round.feeToken.safeTransfer (governor, round.totalFeesForJurors);
@@ -854,7 +859,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
854859 pinakion.safeTransfer (account, pnkReward);
855860 if (round.feeToken == NATIVE_CURRENCY) {
856861 // The dispute fees were paid in ETH
857- payable (account).send (feeReward);
862+ payable (account).safeSend (feeReward, wNative );
858863 } else {
859864 // The dispute fees were paid in ERC20
860865 round.feeToken.safeTransfer (account, feeReward);
@@ -880,7 +885,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
880885 if (leftoverFeeReward != 0 ) {
881886 if (round.feeToken == NATIVE_CURRENCY) {
882887 // The dispute fees were paid in ETH
883- payable (governor).send (leftoverFeeReward);
888+ payable (governor).safeSend (leftoverFeeReward, wNative );
884889 } else {
885890 // The dispute fees were paid in ERC20
886891 round.feeToken.safeTransfer (governor, leftoverFeeReward);
0 commit comments