diff --git a/contracts/deploy/00-home-chain-arbitration-neo.ts b/contracts/deploy/00-home-chain-arbitration-neo.ts index c4530604e..1020da715 100644 --- a/contracts/deploy/00-home-chain-arbitration-neo.ts +++ b/contracts/deploy/00-home-chain-arbitration-neo.ts @@ -32,7 +32,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const disputeKit = await deployUpgradable(deployments, "DisputeKitClassicNeo", { from: deployer, contract: "DisputeKitClassic", - args: [deployer, ZeroAddress], + args: [deployer, ZeroAddress, weth.target], log: true, }); @@ -81,6 +81,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) ethers.toBeHex(5), // Extra data for sortition module will return the default value of K sortitionModule.address, nft.target, + weth.target, ], log: true, }); // nonce+2 (implementation), nonce+3 (proxy) diff --git a/contracts/deploy/00-home-chain-arbitration-university.ts b/contracts/deploy/00-home-chain-arbitration-university.ts index 218e498b9..81267ca91 100644 --- a/contracts/deploy/00-home-chain-arbitration-university.ts +++ b/contracts/deploy/00-home-chain-arbitration-university.ts @@ -27,7 +27,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const disputeKit = await deployUpgradable(deployments, "DisputeKitClassicUniversity", { from: deployer, contract: "DisputeKitClassic", - args: [deployer, ZeroAddress], + args: [deployer, ZeroAddress, weth.target], log: true, }); diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index f66e14cdf..c22a1b960 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -37,7 +37,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const disputeKit = await deployUpgradable(deployments, "DisputeKitClassic", { from: deployer, - args: [deployer, ZeroAddress], + args: [deployer, ZeroAddress, weth.target], log: true, }); @@ -74,6 +74,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod ethers.toBeHex(5), // Extra data for sortition module will return the default value of K sortitionModule.address, + weth.target, ], log: true, }); // nonce+2 (implementation), nonce+3 (proxy) @@ -105,7 +106,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) // Extra dispute kits const disputeKitShutter = await deployUpgradable(deployments, "DisputeKitShutter", { from: deployer, - args: [deployer, core.target], + args: [deployer, core.target, weth.target], log: true, }); await core.addNewDisputeKit(disputeKitShutter.address); @@ -113,7 +114,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const disputeKitGated = await deployUpgradable(deployments, "DisputeKitGated", { from: deployer, - args: [deployer, core.target], + args: [deployer, core.target, weth.target], log: true, }); await core.addNewDisputeKit(disputeKitGated.address); @@ -121,7 +122,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const disputeKitGatedShutter = await deployUpgradable(deployments, "DisputeKitGatedShutter", { from: deployer, - args: [deployer, core.target], + args: [deployer, core.target, weth.target], log: true, }); await core.addNewDisputeKit(disputeKitGatedShutter.address); diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index b63093413..15f0f47d8 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -30,6 +30,7 @@ contract KlerosCore is KlerosCoreBase { /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court. /// @param _sortitionExtraData The extra data for sortition module. /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors. + /// @param _wNative The wrapped native token address, typically wETH. function initialize( address _governor, address _guardian, @@ -40,7 +41,8 @@ contract KlerosCore is KlerosCoreBase { uint256[4] memory _courtParameters, uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, - ISortitionModule _sortitionModuleAddress + ISortitionModule _sortitionModuleAddress, + address _wNative ) external reinitializer(1) { __KlerosCoreBase_initialize( _governor, @@ -52,7 +54,8 @@ contract KlerosCore is KlerosCoreBase { _courtParameters, _timesPerPeriod, _sortitionExtraData, - _sortitionModuleAddress + _sortitionModuleAddress, + _wNative ); } diff --git a/contracts/src/arbitration/KlerosCoreBase.sol b/contracts/src/arbitration/KlerosCoreBase.sol index 7da1b429a..562f7eba1 100644 --- a/contracts/src/arbitration/KlerosCoreBase.sol +++ b/contracts/src/arbitration/KlerosCoreBase.sol @@ -8,6 +8,7 @@ import {ISortitionModule} from "./interfaces/ISortitionModule.sol"; import {Initializable} from "../proxy/Initializable.sol"; import {UUPSProxiable} from "../proxy/UUPSProxiable.sol"; import {SafeERC20, IERC20} from "../libraries/SafeERC20.sol"; +import {SafeSend} from "../libraries/SafeSend.sol"; import "../libraries/Constants.sol"; /// @title KlerosCoreBase @@ -15,6 +16,7 @@ import "../libraries/Constants.sol"; /// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts. abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable { using SafeERC20 for IERC20; + using SafeSend for address payable; // ************************************* // // * Enums / Structs * // @@ -99,6 +101,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable Dispute[] public disputes; // The disputes. mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH. bool public paused; // Whether asset withdrawals are paused. + address public wNative; // The wrapped native token for safeSend(). // ************************************* // // * Events * // @@ -199,13 +202,15 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable uint256[4] memory _courtParameters, uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, - ISortitionModule _sortitionModuleAddress + ISortitionModule _sortitionModuleAddress, + address _wNative ) internal onlyInitializing { governor = _governor; guardian = _guardian; pinakion = _pinakion; jurorProsecutionModule = _jurorProsecutionModule; sortitionModule = _sortitionModuleAddress; + wNative = _wNative; // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a dispute kit is not supported. disputeKits.push(); @@ -802,7 +807,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable // No one was coherent, send the rewards to the governor. if (round.feeToken == NATIVE_CURRENCY) { // The dispute fees were paid in ETH - payable(governor).send(round.totalFeesForJurors); + payable(governor).safeSend(round.totalFeesForJurors, wNative); } else { // The dispute fees were paid in ERC20 round.feeToken.safeTransfer(governor, round.totalFeesForJurors); @@ -854,7 +859,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable pinakion.safeTransfer(account, pnkReward); if (round.feeToken == NATIVE_CURRENCY) { // The dispute fees were paid in ETH - payable(account).send(feeReward); + payable(account).safeSend(feeReward, wNative); } else { // The dispute fees were paid in ERC20 round.feeToken.safeTransfer(account, feeReward); @@ -880,7 +885,7 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable if (leftoverFeeReward != 0) { if (round.feeToken == NATIVE_CURRENCY) { // The dispute fees were paid in ETH - payable(governor).send(leftoverFeeReward); + payable(governor).safeSend(leftoverFeeReward, wNative); } else { // The dispute fees were paid in ERC20 round.feeToken.safeTransfer(governor, leftoverFeeReward); diff --git a/contracts/src/arbitration/KlerosCoreNeo.sol b/contracts/src/arbitration/KlerosCoreNeo.sol index 4355bcdd1..4f748a765 100644 --- a/contracts/src/arbitration/KlerosCoreNeo.sol +++ b/contracts/src/arbitration/KlerosCoreNeo.sol @@ -39,6 +39,7 @@ contract KlerosCoreNeo is KlerosCoreBase { /// @param _sortitionExtraData The extra data for sortition module. /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors. /// @param _jurorNft NFT contract to vet the jurors. + /// @param _wNative The wrapped native token address, typically wETH. function initialize( address _governor, address _guardian, @@ -50,7 +51,8 @@ contract KlerosCoreNeo is KlerosCoreBase { uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, ISortitionModule _sortitionModuleAddress, - IERC721 _jurorNft + IERC721 _jurorNft, + address _wNative ) external reinitializer(2) { __KlerosCoreBase_initialize( _governor, @@ -62,7 +64,8 @@ contract KlerosCoreNeo is KlerosCoreBase { _courtParameters, _timesPerPeriod, _sortitionExtraData, - _sortitionModuleAddress + _sortitionModuleAddress, + _wNative ); jurorNft = _jurorNft; } diff --git a/contracts/src/arbitration/KlerosGovernor.sol b/contracts/src/arbitration/KlerosGovernor.sol index 9d0d8a712..7e9415a7b 100644 --- a/contracts/src/arbitration/KlerosGovernor.sol +++ b/contracts/src/arbitration/KlerosGovernor.sol @@ -3,10 +3,13 @@ pragma solidity ^0.8.24; import {IArbitrableV2, IArbitratorV2} from "./interfaces/IArbitrableV2.sol"; +import {SafeSend} from "../libraries/SafeSend.sol"; import "./interfaces/IDisputeTemplateRegistry.sol"; /// @title KlerosGovernor for V2. Note that appeal functionality and evidence submission will be handled by the court. contract KlerosGovernor is IArbitrableV2 { + using SafeSend for address payable; + // ************************************* // // * Enums / Structs * // // ************************************* // @@ -46,6 +49,7 @@ contract KlerosGovernor is IArbitrableV2 { IArbitratorV2 public arbitrator; // Arbitrator contract. bytes public arbitratorExtraData; // Extra data for arbitrator. + address public wNative; // The wrapped native token for safeSend(). IDisputeTemplateRegistry public templateRegistry; // The dispute template registry. uint256 public templateId; // The current dispute template identifier. @@ -111,6 +115,7 @@ contract KlerosGovernor is IArbitrableV2 { /// @param _submissionTimeout Time in seconds allocated for submitting transaction list. /// @param _executionTimeout Time in seconds after approval that allows to execute transactions of the approved list. /// @param _withdrawTimeout Time in seconds after submission that allows to withdraw submitted list. + /// @param _wNative The wrapped native token address, typically wETH. constructor( IArbitratorV2 _arbitrator, bytes memory _arbitratorExtraData, @@ -119,10 +124,12 @@ contract KlerosGovernor is IArbitrableV2 { uint256 _submissionBaseDeposit, uint256 _submissionTimeout, uint256 _executionTimeout, - uint256 _withdrawTimeout + uint256 _withdrawTimeout, + address _wNative ) { arbitrator = _arbitrator; arbitratorExtraData = _arbitratorExtraData; + wNative = _wNative; lastApprovalTime = block.timestamp; submissionBaseDeposit = _submissionBaseDeposit; @@ -237,7 +244,7 @@ contract KlerosGovernor is IArbitrableV2 { emit ListSubmitted(submissions.length - 1, msg.sender, sessions.length - 1, _description); uint256 remainder = msg.value - submission.deposit; - if (remainder > 0) payable(msg.sender).send(remainder); + if (remainder > 0) payable(msg.sender).safeSend(remainder, wNative); reservedETH += submission.deposit; } @@ -277,7 +284,7 @@ contract KlerosGovernor is IArbitrableV2 { submission.approvalTime = block.timestamp; uint256 sumDeposit = session.sumDeposit; session.sumDeposit = 0; - submission.submitter.send(sumDeposit); + submission.submitter.safeSend(sumDeposit, wNative); lastApprovalTime = block.timestamp; session.status = Status.Resolved; sessions.push(); @@ -311,7 +318,7 @@ contract KlerosGovernor is IArbitrableV2 { Submission storage submission = submissions[session.submittedLists[_ruling - 1]]; submission.approved = true; submission.approvalTime = block.timestamp; - submission.submitter.send(session.sumDeposit); + submission.submitter.safeSend(session.sumDeposit, wNative); } // If the ruling is "0" the reserved funds of this session become expendable. reservedETH -= session.sumDeposit; diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol index 5132b34ea..041c274c7 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol @@ -25,8 +25,9 @@ contract DisputeKitClassic is DisputeKitClassicBase { /// @dev Initializer. /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. - function initialize(address _governor, KlerosCore _core) external reinitializer(1) { - __DisputeKitClassicBase_initialize(_governor, _core); + /// @param _wNative The wrapped native token address, typically wETH. + function initialize(address _governor, KlerosCore _core, address _wNative) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core, _wNative); } function initialize7() external reinitializer(7) { diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol index 5c2485a8c..b8bd3ba51 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.24; import {KlerosCore, KlerosCoreBase, IDisputeKit, ISortitionModule} from "../KlerosCore.sol"; import {Initializable} from "../../proxy/Initializable.sol"; import {UUPSProxiable} from "../../proxy/UUPSProxiable.sol"; +import {SafeSend} from "../../libraries/SafeSend.sol"; /// @title DisputeKitClassicBase /// Abstract Dispute kit classic implementation of the Kleros v1 features including: @@ -13,6 +14,8 @@ import {UUPSProxiable} from "../../proxy/UUPSProxiable.sol"; /// - an incentive system: equal split between coherent votes, /// - an appeal system: fund 2 choices only, vote on any choice. abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxiable { + using SafeSend for address payable; + // ************************************* // // * Structs * // // ************************************* // @@ -64,6 +67,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi mapping(uint256 localDisputeID => mapping(uint256 localRoundID => mapping(address drawnAddress => bool))) public alreadyDrawn; // True if the address has already been drawn, false by default. To be added to the Round struct when fully redeploying rather than upgrading. mapping(uint256 coreDisputeID => bool) public coreDisputeIDToActive; // True if this dispute kit is active for this core dispute ID. + address public wNative; // The wrapped native token for safeSend(). // ************************************* // // * Events * // @@ -142,9 +146,15 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi /// @dev Initializer. /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. - function __DisputeKitClassicBase_initialize(address _governor, KlerosCore _core) internal onlyInitializing { + /// @param _wNative The wrapped native token address, typically wETH. + function __DisputeKitClassicBase_initialize( + address _governor, + KlerosCore _core, + address _wNative + ) internal onlyInitializing { governor = _governor; core = _core; + wNative = _wNative; } // ************************ // @@ -409,7 +419,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi core.appeal{value: appealCost}(_coreDisputeID, dispute.numberOfChoices, dispute.extraData); } - if (msg.value > contribution) payable(msg.sender).send(msg.value - contribution); + if (msg.value > contribution) payable(msg.sender).safeSend(msg.value - contribution, wNative); } /// @dev Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved. @@ -454,7 +464,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi round.contributions[_beneficiary][_choice] = 0; if (amount != 0) { - _beneficiary.send(amount); // Deliberate use of send to prevent reverting fallback. It's the user's responsibility to accept ETH. + _beneficiary.safeSend(amount, wNative); emit Withdrawal(_coreDisputeID, _coreRoundID, _choice, _beneficiary, amount); } } diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitGated.sol b/contracts/src/arbitration/dispute-kits/DisputeKitGated.sol index 007a039b9..82e377497 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitGated.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitGated.sol @@ -41,8 +41,9 @@ contract DisputeKitGated is DisputeKitClassicBase { /// @dev Initializer. /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. - function initialize(address _governor, KlerosCore _core) external reinitializer(1) { - __DisputeKitClassicBase_initialize(_governor, _core); + /// @param _wNative The wrapped native token address, typically wETH. + function initialize(address _governor, KlerosCore _core, address _wNative) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core, _wNative); } function initialize7() external reinitializer(7) { diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitGatedShutter.sol b/contracts/src/arbitration/dispute-kits/DisputeKitGatedShutter.sol index 2d1ea355d..e67be35bf 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitGatedShutter.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitGatedShutter.sol @@ -60,8 +60,9 @@ contract DisputeKitGatedShutter is DisputeKitClassicBase { /// @dev Initializer. /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. - function initialize(address _governor, KlerosCore _core) external reinitializer(1) { - __DisputeKitClassicBase_initialize(_governor, _core); + /// @param _wNative The wrapped native token address, typically wETH. + function initialize(address _governor, KlerosCore _core, address _wNative) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core, _wNative); } function initialize7() external reinitializer(7) { diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol b/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol index 1c332aac7..768b149be 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol @@ -44,8 +44,9 @@ contract DisputeKitShutter is DisputeKitClassicBase { /// @dev Initializer. /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. - function initialize(address _governor, KlerosCore _core) external reinitializer(1) { - __DisputeKitClassicBase_initialize(_governor, _core); + /// @param _wNative The wrapped native token address, typically wETH. + function initialize(address _governor, KlerosCore _core, address _wNative) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core, _wNative); } function initialize8() external reinitializer(8) { diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol index 7bde0feb6..5b0605f18 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol @@ -39,8 +39,14 @@ contract DisputeKitSybilResistant is DisputeKitClassicBase { /// @param _governor The governor's address. /// @param _core The KlerosCore arbitrator. /// @param _poh The Proof of Humanity registry. - function initialize(address _governor, KlerosCore _core, IProofOfHumanity _poh) external reinitializer(1) { - __DisputeKitClassicBase_initialize(_governor, _core); + /// @param _wNative The wrapped native token address, typically wETH. + function initialize( + address _governor, + KlerosCore _core, + IProofOfHumanity _poh, + address _wNative + ) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core, _wNative); poh = _poh; singleDrawPerJuror = true; } diff --git a/contracts/src/libraries/SafeSend.sol b/contracts/src/libraries/SafeSend.sol new file mode 100644 index 000000000..fcd02d815 --- /dev/null +++ b/contracts/src/libraries/SafeSend.sol @@ -0,0 +1,24 @@ +/** + * @authors: [@andreimvp] + * @reviewers: [@divyangchauhan, @wadader, @fcanela, @unknownunknown1] + * @auditors: [] + * @bounties: [] + * SPDX-License-Identifier: MIT + */ + +pragma solidity ^0.8.24; + +interface WethLike { + function deposit() external payable; + + function transfer(address dst, uint256 wad) external; +} + +library SafeSend { + function safeSend(address payable _to, uint256 _value, address _wethLike) internal { + if (_to.send(_value)) return; + + WethLike(_wethLike).deposit{value: _value}(); + WethLike(_wethLike).transfer(_to, _value); + } +} diff --git a/contracts/test/foundry/KlerosCore.t.sol b/contracts/test/foundry/KlerosCore.t.sol index e1f452da4..c214b42f8 100644 --- a/contracts/test/foundry/KlerosCore.t.sol +++ b/contracts/test/foundry/KlerosCore.t.sol @@ -28,6 +28,7 @@ contract KlerosCoreTest is Test { BlockHashRNG rng; PNK pinakion; TestERC20 feeToken; + TestERC20 wNative; ArbitrableExample arbitrable; DisputeTemplateRegistry registry; address governor; @@ -65,6 +66,7 @@ contract KlerosCoreTest is Test { rng = new BlockHashRNG(); pinakion = new PNK(); feeToken = new TestERC20("Test", "TST"); + wNative = new TestERC20("wrapped ETH", "wETH"); governor = msg.sender; guardian = vm.addr(1); @@ -96,7 +98,12 @@ contract KlerosCoreTest is Test { UUPSProxy proxyCore = new UUPSProxy(address(coreLogic), ""); - bytes memory initDataDk = abi.encodeWithSignature("initialize(address,address)", governor, address(proxyCore)); + bytes memory initDataDk = abi.encodeWithSignature( + "initialize(address,address,address)", + governor, + address(proxyCore), + address(wNative) + ); UUPSProxy proxyDk = new UUPSProxy(address(dkLogic), initDataDk); disputeKit = DisputeKitClassic(address(proxyDk)); @@ -125,7 +132,8 @@ contract KlerosCoreTest is Test { [minStake, alpha, feeForJuror, jurorsForCourtJump], timesPerPeriod, sortitionExtraData, - sortitionModule + sortitionModule, + address(wNative) ); vm.prank(staker1); pinakion.approve(address(core), 1 ether); @@ -277,7 +285,12 @@ contract KlerosCoreTest is Test { UUPSProxy proxyCore = new UUPSProxy(address(coreLogic), ""); - bytes memory initDataDk = abi.encodeWithSignature("initialize(address,address)", governor, address(proxyCore)); + bytes memory initDataDk = abi.encodeWithSignature( + "initialize(address,address,address)", + governor, + address(proxyCore), + address(wNative) + ); UUPSProxy proxyDk = new UUPSProxy(address(dkLogic), initDataDk); disputeKit = DisputeKitClassic(address(proxyDk)); @@ -325,7 +338,8 @@ contract KlerosCoreTest is Test { [minStake, alpha, feeForJuror, jurorsForCourtJump], timesPerPeriod, sortitionExtraData, - sortitionModule + sortitionModule, + address(wNative) ); } @@ -2075,7 +2089,12 @@ contract KlerosCoreTest is Test { uint256 disputeID = 0; DisputeKitClassic dkLogic = new DisputeKitClassic(); // Create a new DK and court to check the switch - bytes memory initDataDk = abi.encodeWithSignature("initialize(address,address)", governor, address(core)); + bytes memory initDataDk = abi.encodeWithSignature( + "initialize(address,address,address)", + governor, + address(core), + address(wNative) + ); UUPSProxy proxyDk = new UUPSProxy(address(dkLogic), initDataDk); DisputeKitClassic newDisputeKit = DisputeKitClassic(address(proxyDk)); @@ -2856,7 +2875,12 @@ contract KlerosCoreTest is Test { function test_castVote_differentDK() public { DisputeKitClassic dkLogic = new DisputeKitClassic(); // Create a new DK to check castVote. - bytes memory initDataDk = abi.encodeWithSignature("initialize(address,address)", governor, address(core)); + bytes memory initDataDk = abi.encodeWithSignature( + "initialize(address,address,address)", + governor, + address(core), + address(wNative) + ); UUPSProxy proxyDk = new UUPSProxy(address(dkLogic), initDataDk); DisputeKitClassic newDisputeKit = DisputeKitClassic(address(proxyDk));