@@ -101,7 +101,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
101
101
Dispute[] public disputes; // The disputes.
102
102
mapping (IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.
103
103
bool public paused; // Whether asset withdrawals are paused.
104
- address public wNative ; // The address for WETH tranfers.
104
+ address immutable W_NATIVE ; // The address for WETH tranfers.
105
105
106
106
// ************************************* //
107
107
// * Events * //
@@ -192,6 +192,17 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
192
192
// * Constructor * //
193
193
// ************************************* //
194
194
195
+ /**
196
+ * @dev This contract is deployed only once per chain, as the logic master contract.
197
+ * New instances are created with minimal proxy from the factory.
198
+ * This is only needed to set the wrapped native token, which is used in SafeSend.
199
+ * Since it is constant per chain, it can be safely set as immutable to optimize gas usage.
200
+ * @param _wNative The Wrapped Native Token on this chain.
201
+ */
202
+ constructor (address _wNative ) {
203
+ W_NATIVE = _wNative;
204
+ }
205
+
195
206
function __KlerosCoreBase_initialize (
196
207
address _governor ,
197
208
address _guardian ,
@@ -203,14 +214,12 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
203
214
uint256 [4 ] memory _timesPerPeriod ,
204
215
bytes memory _sortitionExtraData ,
205
216
ISortitionModule _sortitionModuleAddress ,
206
- address _wNative
207
217
) internal onlyInitializing {
208
218
governor = _governor;
209
219
guardian = _guardian;
210
220
pinakion = _pinakion;
211
221
jurorProsecutionModule = _jurorProsecutionModule;
212
222
sortitionModule = _sortitionModuleAddress;
213
- wNative = _wNative;
214
223
215
224
// NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a dispute kit is not supported.
216
225
disputeKits.push ();
@@ -805,7 +814,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
805
814
// No one was coherent, send the rewards to the governor.
806
815
if (round.feeToken == NATIVE_CURRENCY) {
807
816
// The dispute fees were paid in ETH
808
- SafeSend.safeSend (payable (governor), round.totalFeesForJurors, wNative );
817
+ SafeSend.safeSend (payable (governor), round.totalFeesForJurors, W_NATIVE );
809
818
} else {
810
819
// The dispute fees were paid in ERC20
811
820
round.feeToken.safeTransfer (governor, round.totalFeesForJurors);
@@ -862,7 +871,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
862
871
pinakion.safeTransfer (account, pnkReward);
863
872
if (round.feeToken == NATIVE_CURRENCY) {
864
873
// The dispute fees were paid in ETH
865
- SafeSend.safeSend (payable (account), feeReward, wNative );
874
+ SafeSend.safeSend (payable (account), feeReward, W_NATIVE );
866
875
} else {
867
876
// The dispute fees were paid in ERC20
868
877
round.feeToken.safeTransfer (account, feeReward);
@@ -888,7 +897,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
888
897
if (leftoverFeeReward != 0 ) {
889
898
if (round.feeToken == NATIVE_CURRENCY) {
890
899
// The dispute fees were paid in ETH
891
- SafeSend.safeSend (payable (governor), leftoverFeeReward, wNative );
900
+ SafeSend.safeSend (payable (governor), leftoverFeeReward, W_NATIVE );
892
901
} else {
893
902
// The dispute fees were paid in ERC20
894
903
round.feeToken.safeTransfer (governor, leftoverFeeReward);
0 commit comments