@@ -8,13 +8,15 @@ import {ISortitionModule} from "./interfaces/ISortitionModule.sol";
8
8
import {Initializable} from "../proxy/Initializable.sol " ;
9
9
import {UUPSProxiable} from "../proxy/UUPSProxiable.sol " ;
10
10
import {SafeERC20, IERC20 } from "../libraries/SafeERC20.sol " ;
11
+ import {SafeSend} from "../libraries/SafeSend.sol " ;
11
12
import "../libraries/Constants.sol " ;
12
13
13
14
/// @title KlerosCoreBase
14
15
/// Core arbitrator contract for Kleros v2.
15
16
/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.
16
17
abstract contract KlerosCoreBase is IArbitratorV2 , Initializable , UUPSProxiable {
17
18
using SafeERC20 for IERC20 ;
19
+ using SafeSend for address payable ;
18
20
19
21
// ************************************* //
20
22
// * Enums / Structs * //
@@ -99,6 +101,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
99
101
Dispute[] public disputes; // The disputes.
100
102
mapping (IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.
101
103
bool public paused; // Whether asset withdrawals are paused.
104
+ address public wNative; // The wrapped native token for safeSend().
102
105
103
106
// ************************************* //
104
107
// * Events * //
@@ -199,13 +202,15 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
199
202
uint256 [4 ] memory _courtParameters ,
200
203
uint256 [4 ] memory _timesPerPeriod ,
201
204
bytes memory _sortitionExtraData ,
202
- ISortitionModule _sortitionModuleAddress
205
+ ISortitionModule _sortitionModuleAddress ,
206
+ address _wNative
203
207
) internal onlyInitializing {
204
208
governor = _governor;
205
209
guardian = _guardian;
206
210
pinakion = _pinakion;
207
211
jurorProsecutionModule = _jurorProsecutionModule;
208
212
sortitionModule = _sortitionModuleAddress;
213
+ wNative = _wNative;
209
214
210
215
// NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a dispute kit is not supported.
211
216
disputeKits.push ();
@@ -802,7 +807,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
802
807
// No one was coherent, send the rewards to the governor.
803
808
if (round.feeToken == NATIVE_CURRENCY) {
804
809
// The dispute fees were paid in ETH
805
- payable (governor).send (round.totalFeesForJurors);
810
+ payable (governor).safeSend (round.totalFeesForJurors, wNative );
806
811
} else {
807
812
// The dispute fees were paid in ERC20
808
813
round.feeToken.safeTransfer (governor, round.totalFeesForJurors);
@@ -854,7 +859,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
854
859
pinakion.safeTransfer (account, pnkReward);
855
860
if (round.feeToken == NATIVE_CURRENCY) {
856
861
// The dispute fees were paid in ETH
857
- payable (account).send (feeReward);
862
+ payable (account).safeSend (feeReward, wNative );
858
863
} else {
859
864
// The dispute fees were paid in ERC20
860
865
round.feeToken.safeTransfer (account, feeReward);
@@ -880,7 +885,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
880
885
if (leftoverFeeReward != 0 ) {
881
886
if (round.feeToken == NATIVE_CURRENCY) {
882
887
// The dispute fees were paid in ETH
883
- payable (governor).send (leftoverFeeReward);
888
+ payable (governor).safeSend (leftoverFeeReward, wNative );
884
889
} else {
885
890
// The dispute fees were paid in ERC20
886
891
round.feeToken.safeTransfer (governor, leftoverFeeReward);
0 commit comments