From be13916d2191c2c1f16ecd924050cb9a6f32ddb0 Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 10:39:29 +0200 Subject: [PATCH 01/16] fix(contract): hard optimization of kleroscore deployed size --- contracts/src/arbitration/KlerosCore.sol | 107 +++++++++++++---------- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 5e7616882..48a638077 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -102,15 +102,15 @@ contract KlerosCore is IArbitratorV2 { // * Storage * // // ************************************* // - uint96 public constant FORKING_COURT = 0; // Index of the forking court. + uint96 private constant FORKING_COURT = 0; // Index of the forking court. uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court. - uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. - uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped. - uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute. - uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by. - uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH. - uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court. - IERC20 public constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1. + uint256 private constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. + uint256 private constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped. + uint256 private constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute. + uint256 private constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by. + uint256 private constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH. + uint256 private constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court. + IERC20 private constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1. address public governor; // The governor of the contract. IERC20 public pinakion; // The Pinakion token contract. @@ -192,12 +192,15 @@ contract KlerosCore is IArbitratorV2 { // * Function Modifiers * // // ************************************* // - modifier onlyByGovernor() { + function onlyByGovernor() private view { if (governor != msg.sender) revert GovernorOnly(); - _; } - /// @dev Constructor. + // ************************************* // + // * Constructor * // + // ************************************* // + + /// @dev Constructor /// @param _governor The governor's address. /// @param _pinakion The address of the token contract. /// @param _jurorProsecutionModule The address of the juror prosecution module. @@ -278,37 +281,38 @@ contract KlerosCore is IArbitratorV2 { /// @param _destination The destination of the call. /// @param _amount The value sent with the call. /// @param _data The data sent with the call. - function executeGovernorProposal( - address _destination, - uint256 _amount, - bytes memory _data - ) external onlyByGovernor { + function executeGovernorProposal(address _destination, uint256 _amount, bytes memory _data) external { + onlyByGovernor(); (bool success, ) = _destination.call{value: _amount}(_data); if (!success) revert UnsuccessfulCall(); } /// @dev Changes the `governor` storage variable. /// @param _governor The new value for the `governor` storage variable. - function changeGovernor(address payable _governor) external onlyByGovernor { + function changeGovernor(address payable _governor) external { + onlyByGovernor(); governor = _governor; } /// @dev Changes the `pinakion` storage variable. /// @param _pinakion The new value for the `pinakion` storage variable. - function changePinakion(IERC20 _pinakion) external onlyByGovernor { + function changePinakion(IERC20 _pinakion) external { + onlyByGovernor(); pinakion = _pinakion; } /// @dev Changes the `jurorProsecutionModule` storage variable. /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable. - function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor { + function changeJurorProsecutionModule(address _jurorProsecutionModule) external { + onlyByGovernor(); jurorProsecutionModule = _jurorProsecutionModule; } /// @dev Changes the `_sortitionModule` storage variable. /// Note that the new module should be initialized for all courts. /// @param _sortitionModule The new value for the `sortitionModule` storage variable. - function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor { + function changeSortitionModule(ISortitionModule _sortitionModule) external { + onlyByGovernor(); sortitionModule = _sortitionModule; } @@ -316,7 +320,8 @@ contract KlerosCore is IArbitratorV2 { /// @param _disputeKitAddress The address of the dispute kit contract. /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created. /// Note that the root DK must be supported by the general court. - function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor { + function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external { + onlyByGovernor(); uint256 disputeKitID = disputeKitNodes.length; if (_parent >= disputeKitID) revert InvalidDisputKitParent(); uint256 depthLevel; @@ -363,7 +368,8 @@ contract KlerosCore is IArbitratorV2 { uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, uint256[] memory _supportedDisputeKits - ) external onlyByGovernor { + ) external { + onlyByGovernor(); if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt(); if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit(); if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent(); @@ -412,21 +418,23 @@ contract KlerosCore is IArbitratorV2 { uint256 _feeForJuror, uint256 _jurorsForCourtJump, uint256[4] memory _timesPerPeriod - ) external onlyByGovernor { - if (_courtID != GENERAL_COURT && courts[courts[_courtID].parent].minStake > _minStake) { + ) external { + onlyByGovernor(); + Court storage court = courts[_courtID]; + if (_courtID != GENERAL_COURT && courts[court.parent].minStake > _minStake) { revert MinStakeLowerThanParentCourt(); } - for (uint256 i = 0; i < courts[_courtID].children.length; i++) { - if (courts[courts[_courtID].children[i]].minStake < _minStake) { + for (uint256 i = 0; i < court.children.length; i++) { + if (courts[court.children[i]].minStake < _minStake) { revert MinStakeLowerThanParentCourt(); } } - courts[_courtID].minStake = _minStake; - courts[_courtID].hiddenVotes = _hiddenVotes; - courts[_courtID].alpha = _alpha; - courts[_courtID].feeForJuror = _feeForJuror; - courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump; - courts[_courtID].timesPerPeriod = _timesPerPeriod; + court.minStake = _minStake; + court.hiddenVotes = _hiddenVotes; + court.alpha = _alpha; + court.feeForJuror = _feeForJuror; + court.jurorsForCourtJump = _jurorsForCourtJump; + court.timesPerPeriod = _timesPerPeriod; emit CourtModified( _courtID, _hiddenVotes, @@ -442,7 +450,8 @@ contract KlerosCore is IArbitratorV2 { /// @param _courtID The ID of the court. /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed. /// @param _enable Whether add or remove the dispute kits from the court. - function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor { + function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external { + onlyByGovernor(); for (uint256 i = 0; i < _disputeKitIDs.length; i++) { if (_enable) { if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) { @@ -461,7 +470,8 @@ contract KlerosCore is IArbitratorV2 { /// @dev Changes the supported fee tokens. /// @param _feeToken The fee token. /// @param _accepted Whether the token is supported or not as a method of fee payment. - function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor { + function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external { + onlyByGovernor(); currencyRates[_feeToken].feePaymentAccepted = _accepted; emit AcceptedFeeToken(_feeToken, _accepted); } @@ -470,10 +480,11 @@ contract KlerosCore is IArbitratorV2 { /// @param _feeToken The fee token. /// @param _rateInEth The new rate of the fee token in ETH. /// @param _rateDecimals The new decimals of the fee token rate. - function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor { - CurrencyRate storage rate = currencyRates[_feeToken]; - rate.rateInEth = _rateInEth; - rate.rateDecimals = _rateDecimals; + function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external { + onlyByGovernor(); + // CurrencyRate storage rate = currencyRates[_feeToken]; + currencyRates[_feeToken].rateInEth = _rateInEth; + currencyRates[_feeToken].rateDecimals = _rateDecimals; emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals); } @@ -513,7 +524,7 @@ contract KlerosCore is IArbitratorV2 { if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted(); if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough(); - require(_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount), "Transfer failed"); + if (!_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount)) revert TransferFailed(); return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount); } @@ -688,9 +699,14 @@ contract KlerosCore is IArbitratorV2 { // Dispute kit was changed, so create a dispute in the new DK contract. if (extraRound.disputeKitID != round.disputeKitID) { - IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit; + // IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit; emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID); - disputeKit.createDispute(_disputeID, _numberOfChoices, _extraData, extraRound.nbVotes); + disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute( + _disputeID, + _numberOfChoices, + _extraData, + extraRound.nbVotes + ); } emit AppealDecision(_disputeID, dispute.arbitrated); @@ -1007,8 +1023,8 @@ contract KlerosCore is IArbitratorV2 { /// @param _courtID The ID of the court to get the times from. /// @return timesPerPeriod The timesPerPeriod array for the given court. function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) { - Court storage court = courts[_courtID]; - timesPerPeriod = court.timesPerPeriod; + // Court storage court = courts[_courtID]; + timesPerPeriod = courts[_courtID].timesPerPeriod; } // ************************************* // @@ -1055,8 +1071,7 @@ contract KlerosCore is IArbitratorV2 { } function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) { - CurrencyRate storage rate = currencyRates[_toToken]; - return (_amountInEth * 10 ** rate.rateDecimals) / rate.rateInEth; + return (_amountInEth * 10 ** currencyRates[_toToken].rateDecimals) / currencyRates[_toToken].rateInEth; } // ************************************* // @@ -1221,4 +1236,6 @@ contract KlerosCore is IArbitratorV2 { error NotExecutionPeriod(); error RulingAlreadyExecuted(); error DisputePeriodIsFinal(); + /// Transfer failed + error TransferFailed(); } From e5fc1d7a4e3938e18ab80bc613ea81b3356ce467 Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:52:54 +0200 Subject: [PATCH 02/16] feat(proxy): add upgradability contracts --- contracts/src/proxy/Initializable.sol | 209 ++++++++++++++++++++++++++ contracts/src/proxy/UUPSProxiable.sol | 160 ++++++++++++++++++++ contracts/src/proxy/UUPSProxy.sol | 109 ++++++++++++++ 3 files changed, 478 insertions(+) create mode 100644 contracts/src/proxy/Initializable.sol create mode 100644 contracts/src/proxy/UUPSProxiable.sol create mode 100644 contracts/src/proxy/UUPSProxy.sol diff --git a/contracts/src/proxy/Initializable.sol b/contracts/src/proxy/Initializable.sol new file mode 100644 index 000000000..f1fa5f1db --- /dev/null +++ b/contracts/src/proxy/Initializable.sol @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) + +pragma solidity 0.8.18; + +/** + * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed + * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an + * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer + * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. + * + * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be + * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in + * case an upgrade adds a module that needs to be initialized. + * + * For example: + * + * ```solidity + * contract MyToken is ERC20Upgradeable { + * function initialize() initializer public { + * __ERC20_init("MyToken", "MTK"); + * } + * } + * + * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { + * function initializeV2() reinitializer(2) public { + * __ERC20Permit_init("MyToken"); + * } + * } + * ``` + * + * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as + * possible by providing the encoded function call as the `_data` argument to the proxy constructor + * + * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure + * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. + * + * [CAUTION] + * ==== + * Avoid leaving a contract uninitialized. + * + * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation + * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke + * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: + * + */ +abstract contract Initializable { + /** + * @dev Storage of the initializable contract. + * + * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions + * when using with upgradeable contracts. + * + * @custom:storage-location erc7201:openzeppelin.storage.Initializable + */ + struct InitializableStorage { + /** + * @dev Indicates that the contract has been initialized. + */ + uint64 _initialized; + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool _initializing; + } + + // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) + bytes32 private constant _INITIALIZABLE_STORAGE = + 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e; + + /** + * @dev The contract is already initialized. + */ + error AlreadyInitialized(); + + /** + * @dev The contract is not initializing. + */ + error NotInitializing(); + + /** + * @dev Triggered when the contract has been initialized or reinitialized. + */ + event Initialized(uint64 version); + + /** + * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, + * `onlyInitializing` functions can be used to initialize parent contracts. + * + * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a + * constructor. + * + * Emits an {Initialized} event. + */ + modifier initializer() { + // solhint-disable-next-line var-name-mixedcase + InitializableStorage storage $ = _getInitializableStorage(); + + bool isTopLevelCall = !$._initializing; + uint64 initialized = $._initialized; + if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) { + revert AlreadyInitialized(); + } + $._initialized = 1; + if (isTopLevelCall) { + $._initializing = true; + } + _; + if (isTopLevelCall) { + $._initializing = false; + emit Initialized(1); + } + } + + /** + * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the + * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be + * used to initialize parent contracts. + * + * A reinitializer may be used after the original initialization step. This is essential to configure modules that + * are added through upgrades and that require initialization. + * + * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` + * cannot be nested. If one is invoked in the context of another, execution will revert. + * + * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in + * a contract, executing them in the right order is up to the developer or operator. + * + * WARNING: setting the version to 255 will prevent any future reinitialization. + * + * Emits an {Initialized} event. + */ + modifier reinitializer(uint64 version) { + // solhint-disable-next-line var-name-mixedcase + InitializableStorage storage $ = _getInitializableStorage(); + + if ($._initializing || $._initialized >= version) { + revert AlreadyInitialized(); + } + $._initialized = version; + $._initializing = true; + _; + $._initializing = false; + emit Initialized(version); + } + + /** + * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the + * {initializer} and {reinitializer} modifiers, directly or indirectly. + */ + modifier onlyInitializing() { + _checkInitializing(); + _; + } + + /** + * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. + */ + function _checkInitializing() internal view virtual { + if (!_isInitializing()) { + revert NotInitializing(); + } + } + + /** + * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. + * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized + * to any version. It is recommended to use this to lock implementation contracts that are designed to be called + * through proxies. + * + * Emits an {Initialized} event the first time it is successfully executed. + */ + function _disableInitializers() internal virtual { + // solhint-disable-next-line var-name-mixedcase + InitializableStorage storage $ = _getInitializableStorage(); + + if ($._initializing) { + revert AlreadyInitialized(); + } + if ($._initialized != type(uint64).max) { + $._initialized = type(uint64).max; + emit Initialized(type(uint64).max); + } + } + + /** + * @dev Returns the highest version that has been initialized. See {reinitializer}. + */ + function _getInitializedVersion() internal view returns (uint64) { + return _getInitializableStorage()._initialized; + } + + /** + * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. + */ + function _isInitializing() internal view returns (bool) { + return _getInitializableStorage()._initializing; + } + + /** + * @dev Returns a pointer to the storage namespace. + */ + // solhint-disable-next-line var-name-mixedcase + function _getInitializableStorage() private pure returns (InitializableStorage storage $) { + assembly { + $.slot := _INITIALIZABLE_STORAGE + } + } +} diff --git a/contracts/src/proxy/UUPSProxiable.sol b/contracts/src/proxy/UUPSProxiable.sol new file mode 100644 index 000000000..fd94df7b7 --- /dev/null +++ b/contracts/src/proxy/UUPSProxiable.sol @@ -0,0 +1,160 @@ +//SPDX-License-Identifier: MIT +// Adapted from + +/** + * @authors: [@malatrax] + * @reviewers: [] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ +pragma solidity 0.8.18; + +/** + * @title UUPS Proxiable + * @author Simon Malatrait + * @dev This contract implements an upgradeability mechanism designed for UUPS proxies. + * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy. + * + * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy. + * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable. + * + * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is + * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing + * `UUPSProxiable` with a custom implementation of upgrades. + * + * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism. + */ +abstract contract UUPSProxiable { + // ************************************* // + // * Event * // + // ************************************* // + + /** + * Emitted when the `implementation` has been successfully upgraded. + * @param newImplementation Address of the new implementation the proxy is now forwarding calls to. + */ + event Upgraded(address indexed newImplementation); + + // ************************************* // + // * Error * // + // ************************************* // + + /** + * @dev The call is from an unauthorized context. + */ + error UUPSUnauthorizedCallContext(); + + /** + * @dev The storage `slot` is unsupported as a UUID. + */ + error UUPSUnsupportedProxiableUUID(bytes32 slot); + + /// The `implementation` is not UUPS-compliant + error InvalidImplementation(address implementation); + + /// Failed Delegated call + error FailedDelegateCall(); + + // ************************************* // + // * Storage * // + // ************************************* // + + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is + * validated in the constructor. + * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) + */ + bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /** + * @dev Storage variable of the proxiable contract address. + * It is used to check whether or not the current call is from the proxy. + */ + address private immutable __self = address(this); + + // ************************************* // + // * Governance * // + // ************************************* // + + /** + * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. + * @dev Called by {upgradeToAndCall}. + */ + function _authorizeUpgrade(address newImplementation) internal virtual; + + // ************************************* // + // * State Modifiers * // + // ************************************* // + + /** + * @dev Upgrade mechanism including access control and UUPS-compliance. + * @param newImplementation Address of the new implementation contract. + * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded + * function call, and allows initializing the storage of the proxy like a Solidity constructor. + * + * @dev Reverts if the execution is not performed via delegatecall or the execution + * context is not of a proxy with an ERC1967-compliant implementation pointing to self. + */ + function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual { + _authorizeUpgrade(newImplementation); + + /* Check that the execution is being performed through a delegatecall call and that the execution context is + a proxy contract with an implementation (as defined in ERC1967) pointing to self. */ + if (address(this) == __self || _getImplementation() != __self) { + revert UUPSUnauthorizedCallContext(); + } + + try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { + if (slot != IMPLEMENTATION_SLOT) { + revert UUPSUnsupportedProxiableUUID(slot); + } + // Store the new implementation address to the implementation storage slot. + assembly { + sstore(IMPLEMENTATION_SLOT, newImplementation) + } + emit Upgraded(newImplementation); + + if (data.length != 0) { + // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted. + (bool success, ) = newImplementation.delegatecall(data); + if (!success) { + revert FailedDelegateCall(); + } + } + } catch { + revert InvalidImplementation(newImplementation); + } + } + + // ************************************* // + // * Public Views * // + // ************************************* // + + /** + * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the + * implementation. It is used to validate the implementation's compatibility when performing an upgrade. + * + * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks + * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this + * function revert if invoked through a proxy. This is guaranteed by the if statement. + */ + function proxiableUUID() external view virtual returns (bytes32) { + if (address(this) != __self) { + // Must not be called through delegatecall + revert UUPSUnauthorizedCallContext(); + } + return IMPLEMENTATION_SLOT; + } + + // ************************************* // + // * Internal Views * // + // ************************************* // + + function _getImplementation() internal view returns (address implementation) { + assembly { + implementation := sload(IMPLEMENTATION_SLOT) + } + } +} diff --git a/contracts/src/proxy/UUPSProxy.sol b/contracts/src/proxy/UUPSProxy.sol new file mode 100644 index 000000000..375c6e11c --- /dev/null +++ b/contracts/src/proxy/UUPSProxy.sol @@ -0,0 +1,109 @@ +//SPDX-License-Identifier: MIT +// Adapted from + +/** + * @authors: [@malatrax] + * @reviewers: [] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ +pragma solidity 0.8.18; + +/** + * @title UUPS Proxy + * @author Simon Malatrait + * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822. + * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction. + * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`. + */ +contract UUPSProxy { + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is + * validated in the constructor. + * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) + */ + bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + // ************************************* // + // * Constructor * // + // ************************************* // + + /** + * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. + * + * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded + * function call, and allows initializing the storage of the proxy like a Solidity constructor. + */ + constructor(address _implementation, bytes memory _data) { + assembly { + sstore(IMPLEMENTATION_SLOT, _implementation) + } + + if (_data.length != 0) { + (bool success, ) = _implementation.delegatecall(_data); + require(success, "Proxy Constructor failed"); + } + } + + // ************************************* // + // * State Modifiers * // + // ************************************* // + + /** + * @dev Delegates the current call to `implementation`. + * + * NOTE: This function does not return to its internal call site, it will return directly to the external caller. + */ + function _delegate(address implementation) internal { + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + // Call the implementation. + // out and outsize are 0 because we don't know the size yet. + let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) + + // Copy the returned data. + returndatacopy(0, 0, returndatasize()) + + switch result + // delegatecall returns 0 on error. + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } + + // ************************************* // + // * Internal Views * // + // ************************************* // + + function _getImplementation() internal view returns (address implementation) { + assembly { + implementation := sload(IMPLEMENTATION_SLOT) + } + } + + // ************************************* // + // * Fallback * // + // ************************************* // + + /** + * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other + * function in the contract matches the call data. + */ + fallback() external payable { + _delegate(_getImplementation()); + } + + receive() external payable { + _delegate(_getImplementation()); + } +} From dd0f9b37e767ed2dc22514d2847a82ad636db8ab Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:54:18 +0200 Subject: [PATCH 03/16] feat(proxy): add test on mock implementation --- .../src/proxy/mock/MockImplementations.sol | 63 ++++++++++ contracts/test/proxy/index.ts | 117 ++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 contracts/src/proxy/mock/MockImplementations.sol create mode 100644 contracts/test/proxy/index.ts diff --git a/contracts/src/proxy/mock/MockImplementations.sol b/contracts/src/proxy/mock/MockImplementations.sol new file mode 100644 index 000000000..de8eafdc8 --- /dev/null +++ b/contracts/src/proxy/mock/MockImplementations.sol @@ -0,0 +1,63 @@ +//SPDX-License-Identifier: MIT +// Adapted from + +pragma solidity 0.8.18; + +import "../UUPSProxiable.sol"; + +contract NonUpgradeableMock { + uint256 public _counter; + + function counter() external view returns (uint256) { + return _counter; + } + + function increment() external { + _counter++; + } + + function version() external pure virtual returns (string memory) { + return "NonUpgradeableMock 0.0.0"; + } +} + +contract UUPSUpgradeableMock is UUPSProxiable, NonUpgradeableMock { + bool private initialized; + address public governor; + + uint256[50] __gap; + + constructor() { + initialized = true; + } + + function initialize(address _governor) external { + require(!initialized, "Contract instance has already been initialized"); + governor = _governor; + initialized = true; + } + + function _authorizeUpgrade(address) internal view override { + require(governor == msg.sender, "No privilege to upgrade"); + } + + function version() external pure virtual override returns (string memory) { + return "UUPSUpgradeableMock 1.0.0"; + } +} + +contract UUPSUpgradeableMockV2 is UUPSUpgradeableMock { + function version() external pure override returns (string memory) { + return "UUPSUpgradeableMock 2.0.0"; + } +} + +contract UUPSUnsupportedProxiableUUID is UUPSUpgradeableMock { + function proxiableUUID() external pure override returns (bytes32) { + return keccak256("invalid UUID"); + } + + function version() external pure override returns (string memory) { + return "UUPSUnsupportedProxiableUUID 1.0.0"; + } +} diff --git a/contracts/test/proxy/index.ts b/contracts/test/proxy/index.ts new file mode 100644 index 000000000..dbb3b4c7e --- /dev/null +++ b/contracts/test/proxy/index.ts @@ -0,0 +1,117 @@ +import { expect } from "chai"; +import { ethers, deployments, getNamedAccounts } from "hardhat"; +const hre = require("hardhat"); + +let deployer; +let user1; + +let uupsProxyDeployment; +let uupsProxy; +let uupsImplementationInit; + +describe("Mock Implementation Proxy", async () => { + beforeEach("Setup Contracts", async () => { + [deployer, user1] = await ethers.getSigners(); + // uupsProxyDeployment = await deployments.get("UUPSUpgradeableMock"); + + // Deploy Proxy with hardhat-deploy + uupsProxyDeployment = await deployments.deploy("UUPSUpgradeableMock", { + from: deployer.address, + proxy: { + proxyContract: "UUPSProxy", + execute: { + init: { + methodName: "initialize", + args: [deployer.address], + }, + onUpgrade: { + methodName: "counter", + args: [], + }, + }, + proxyArgs: ["{implementation}", "{data}"], + }, + log: true, + args: [], + }); + uupsProxy = await ethers.getContractAt("UUPSUpgradeableMock", uupsProxyDeployment.address); + uupsImplementationInit = await ethers.getContractAt("UUPSUpgradeableMock", uupsProxyDeployment.implementation); + // console.log(uupsProxyDeployment.implementation); + }); + + describe("Initialization", async () => { + it("Governor cannot re-initialize the proxy", async () => { + await expect(uupsProxy.connect(deployer).initialize(deployer.address)).to.be.revertedWith( + "Contract instance has already been initialized" + ); + }); + it("User cannot re-initialize the proxy", async () => { + await expect(uupsProxy.connect(user1).initialize(user1.address)).to.be.revertedWith( + "Contract instance has already been initialized" + ); + }); + it("Implementation cannot be directly upgraded", async () => { + await expect(uupsImplementationInit.initialize(user1.address)).to.be.revertedWith( + "Contract instance has already been initialized" + ); + }); + // it("Unauthorized user cannot upgrade", async () => {}); + }); + describe("Upgrade", async () => { + describe("Security", async () => { + it("Should revert if implementation has a broken UUID", async () => { + const UUPSUnsupportedProxiableUUIDFactory = await ethers.getContractFactory("UUPSUnsupportedProxiableUUID"); + const uupsUnsupportedUUID = await UUPSUnsupportedProxiableUUIDFactory.deploy(); + await expect( + uupsProxy.connect(deployer).upgradeToAndCall(uupsUnsupportedUUID.address, "0x") + ).to.be.revertedWithCustomError(uupsProxy, "UUPSUnsupportedProxiableUUID"); + }); + it("Should revert on upgrades to non UUPS-compliant implementation", async () => { + const NonUpgradeableMockFactory = await ethers.getContractFactory("NonUpgradeableMock"); + const nonUpgradeableMock = await NonUpgradeableMockFactory.deploy(); + await expect(uupsProxy.upgradeToAndCall(nonUpgradeableMock.address, "0x")) + .to.be.revertedWithCustomError(uupsProxy, "InvalidImplementation") + .withArgs(nonUpgradeableMock.address); + }); + + // If the `governor` storage slot is not initialized in the constructor, trying to directly upgrade the implementation as `governor === address(0)` + // it("Should revert if upgrade is performed directly through the implementation", async () => { + // const UUPSUpgradeableMockV2Factory = await ethers.getContractFactory("UUPSUpgradeableMockV2"); + // const newImplementation = await UUPSUpgradeableMockV2Factory.connect(deployer).deploy(); + + // await expect(uupsImplementationInit.connect(deployer).upgradeToAndCall(newImplementation.address, "0x")).to.be.revertedWith( + // "Must be called through delegatecall" + // ); + // }) + }); + + describe("Governance", async () => { + it("Only the governor (deployer here) can perform upgrades", async () => { + // Unauthorized user try to upgrade the implementation + const UUPSUpgradeableMockV2Factory = await ethers.getContractFactory("UUPSUpgradeableMockV2"); + const newUserImplementation = await UUPSUpgradeableMockV2Factory.connect(user1).deploy(); + + await expect(uupsProxy.connect(user1).upgradeToAndCall(newUserImplementation.address, "0x")).to.be.revertedWith( + "No privilege to upgrade" + ); + + // Governor updates the implementation + const newGovernorImplementation = await UUPSUpgradeableMockV2Factory.connect(deployer).deploy(); + console.log("Version: ", await uupsProxy.version()); + + await expect(uupsProxy.connect(deployer).upgradeToAndCall(newGovernorImplementation.address, "0x")) + .to.emit(uupsProxy, "Upgraded") + .withArgs(newGovernorImplementation.address); + + console.log("Version: ", await uupsProxy.version()); + }); + }); + }); + + describe("After Test", async () => { + it("Reset implementation to deployment's implementation address", async () => { + await uupsProxy.upgradeToAndCall(uupsProxyDeployment.implementation, "0x"); + console.log("Version: ", await uupsProxy.version()); + }); + }); +}); From f06cc9030d13e2fd6aae96aca7df0b701df9ead0 Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:54:56 +0200 Subject: [PATCH 04/16] feat(proxy): make SortitionModule upgradeable --- contracts/src/arbitration/SortitionModule.sol | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/contracts/src/arbitration/SortitionModule.sol b/contracts/src/arbitration/SortitionModule.sol index 1cd4e3bf6..53e5bb179 100644 --- a/contracts/src/arbitration/SortitionModule.sol +++ b/contracts/src/arbitration/SortitionModule.sol @@ -14,10 +14,12 @@ import "./KlerosCore.sol"; import "./interfaces/ISortitionModule.sol"; import "./interfaces/IDisputeKit.sol"; import "../rng/RNG.sol"; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; /// @title SortitionModule /// @dev A factory of trees that keeps track of staked values for sortition. -contract SortitionModule is ISortitionModule { +contract SortitionModule is ISortitionModule, UUPSProxiable, Initializable { // ************************************* // // * Enums / Structs * // // ************************************* // @@ -79,20 +81,25 @@ contract SortitionModule is ISortitionModule { // * Constructor * // // ************************************* // - /// @dev Constructor. + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer (constructor equivalent for upgradable contracts). /// @param _core The KlerosCore. /// @param _minStakingTime Minimal time to stake /// @param _maxDrawingTime Time after which the drawing phase can be switched /// @param _rng The random number generator. /// @param _rngLookahead Lookahead value for rng. - constructor( + function initialize( address _governor, KlerosCore _core, uint256 _minStakingTime, uint256 _maxDrawingTime, RNG _rng, uint256 _rngLookahead - ) { + ) external reinitializer(1) { governor = _governor; core = _core; minStakingTime = _minStakingTime; @@ -106,6 +113,13 @@ contract SortitionModule is ISortitionModule { // * Governance * // // ************************************* // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + + function _authorizeUpgrade(address) internal view override onlyByGovernor {} + /// @dev Changes the `minStakingTime` storage variable. /// @param _minStakingTime The new value for the `minStakingTime` storage variable. function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor { From 871fd60aba2925df830b91fbda49da2c5850dada Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:55:16 +0200 Subject: [PATCH 05/16] feat(proxy): make KlerosCore upgradeable --- contracts/src/arbitration/KlerosCore.sol | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 48a638077..76e46913d 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -12,11 +12,13 @@ import {IArbitrableV2, IArbitratorV2} from "./interfaces/IArbitratorV2.sol"; import "./interfaces/IDisputeKit.sol"; import "./interfaces/ISortitionModule.sol"; import "../libraries/SafeERC20.sol"; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; /// @title KlerosCore /// Core arbitrator contract for Kleros v2. /// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts. -contract KlerosCore is IArbitratorV2 { +contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { using SafeERC20 for IERC20; // ************************************* // @@ -200,7 +202,12 @@ contract KlerosCore is IArbitratorV2 { // * Constructor * // // ************************************* // - /// @dev Constructor + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer (constructor equivalent for upgradable contracts). /// @param _governor The governor's address. /// @param _pinakion The address of the token contract. /// @param _jurorProsecutionModule The address of the juror prosecution module. @@ -210,7 +217,7 @@ contract KlerosCore is IArbitratorV2 { /// @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. - constructor( + function initialize( address _governor, IERC20 _pinakion, address _jurorProsecutionModule, @@ -220,7 +227,7 @@ contract KlerosCore is IArbitratorV2 { uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, ISortitionModule _sortitionModuleAddress - ) { + ) external initializer { governor = _governor; pinakion = _pinakion; jurorProsecutionModule = _jurorProsecutionModule; @@ -277,6 +284,13 @@ contract KlerosCore is IArbitratorV2 { // * Governance * // // ************************************* // + /* @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override { + onlyByGovernor(); + } + /// @dev Allows the governor to call anything on behalf of the contract. /// @param _destination The destination of the call. /// @param _amount The value sent with the call. From 6c275741bd3c70e1a3d5e60e2c0c22252cff84ea Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:55:55 +0200 Subject: [PATCH 06/16] feat(proxy): update deployment scripts --- contracts/deploy/00-home-chain-arbitration.ts | 69 +++++++++++++++---- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index f7fa437f8..b4a152d97 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -76,13 +76,36 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) log: true, }); - const nonce = await ethers.provider.getTransactionCount(deployer); - const KlerosCoreAddress = getContractAddress(deployer, nonce + 1); - console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress); + let nonce; + let KlerosCoreAddress; + + const klerosCoreDeployment = await deployments.getOrNull("KlerosCore"); + if (!klerosCoreDeployment) { + nonce = await ethers.provider.getTransactionCount(deployer); + KlerosCoreAddress = getContractAddress(deployer, nonce + 3); // Deploying an upgradeable version of SortionModule requires 2 transactions instead of 1 (implementation then proxy) + console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress); + } else { + KlerosCoreAddress = klerosCoreDeployment.address; + } const sortitionModule = await deploy("SortitionModule", { from: deployer, - args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime + }, + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, log: true, }); @@ -94,17 +117,33 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const feeForJuror = BigNumber.from(10).pow(17); const klerosCore = await deploy("KlerosCore", { from: deployer, - args: [ - deployer, - pnk, - AddressZero, - disputeKit.address, - false, - [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump - [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K - sortitionModule.address, - ], + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModule.address, + ], + }, + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + args: [], log: true, }); From 80cd4631402e9c9fb56a29046e4f5916d44ae184 Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:56:13 +0200 Subject: [PATCH 07/16] feat(proxy): update test script --- contracts/test/arbitration/index.ts | 83 ++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/contracts/test/arbitration/index.ts b/contracts/test/arbitration/index.ts index 8c526d3e6..8bf65831b 100644 --- a/contracts/test/arbitration/index.ts +++ b/contracts/test/arbitration/index.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { ethers } from "hardhat"; +import { deployments, ethers } from "hardhat"; import { BigNumber } from "ethers"; import getContractAddress from "../../deploy-helpers/getContractAddress"; @@ -83,34 +83,65 @@ async function deployContracts(deployer) { await disputeKit.deployed(); let nonce; nonce = await deployer.getTransactionCount(); - nonce += 1; + nonce += 3; // SortitionModule is upgradeable, it deploys an implementation and a proxy const KlerosCoreAddress = getContractAddress(deployer.address, nonce); - const sortitionModuleFactory = await ethers.getContractFactory("SortitionModule", deployer); - const sortitionModule = await sortitionModuleFactory.deploy( - deployer.address, - KlerosCoreAddress, - 120, - 120, - rng.address, - LOOKAHEAD - ); // minStakingTime, maxFreezingTime - - const klerosCoreFactory = await ethers.getContractFactory("KlerosCore", { - signer: deployer, + const sortitionModuleDeployment = await deployments.deploy("SortitionModule_DisputeKitClassic", { + contract: "SortitionModule", + from: deployer.address, + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + execute: { + init: { + methodName: "initialize", + args: [deployer.address, KlerosCoreAddress, 120, 120, rng.address, LOOKAHEAD], // minStakingTime, maxFreezingTime + }, + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + log: true, + args: [], }); - const core = await klerosCoreFactory.deploy( - deployer.address, - ethers.constants.AddressZero, // should be an ERC20 - ethers.constants.AddressZero, // should be a Juror Prosecution module - disputeKit.address, - false, - [200, 10000, 100, 3], - [0, 0, 0, 0], - 0xfa, - sortitionModule.address - ); - await core.deployed(); + + const sortitionModule = await ethers.getContractAt("SortitionModule", sortitionModuleDeployment.address); + + const coreDeployment = await deployments.deploy("KlerosCore_DisputeKitClassic", { + contract: "KlerosCore", + from: deployer.address, + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: [ + deployer.address, + ethers.constants.AddressZero, // should be an ERC20 + ethers.constants.AddressZero, // should be a Juror Prosecution module + disputeKit.address, + false, + [200, 10000, 100, 3], + [0, 0, 0, 0], + "0xfa", + sortitionModule.address, + ], + }, + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + args: [], + log: true, + }); + const core = await ethers.getContractAt("KlerosCore", coreDeployment.address); await disputeKit.changeCore(core.address); From b4b319911925d2fe6be03d3033fd850bfc47d9bf Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:56:38 +0200 Subject: [PATCH 08/16] feat(proxy): add selective upgrade scripts --- contracts/deploy/upgrade-kleros-core.ts | 89 ++++++++++++++++++++ contracts/deploy/upgrade-sortition-module.ts | 72 ++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 contracts/deploy/upgrade-kleros-core.ts create mode 100644 contracts/deploy/upgrade-sortition-module.ts diff --git a/contracts/deploy/upgrade-kleros-core.ts b/contracts/deploy/upgrade-kleros-core.ts new file mode 100644 index 000000000..54c50269e --- /dev/null +++ b/contracts/deploy/upgrade-kleros-core.ts @@ -0,0 +1,89 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; +import { BigNumber } from "ethers"; +import getContractAddress from "../deploy-helpers/getContractAddress"; +import { get } from "http"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_GOERLI = 421613, + HARDHAT = 31337, +} + +const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { ethers, deployments, getNamedAccounts, getChainId } = hre; + const { deploy, execute } = deployments; + const { AddressZero } = hre.ethers.constants; + const RNG_LOOKAHEAD = 20; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Upgrading to %s with deployer %s", HomeChains[chainId], deployer); + + try { + const pnk = await deployments.get("PNK"); + + const dai = await deployments.get("DAI"); + + const weth = await deployments.get("WETH"); + + const rng = await deployments.get("RandomizerRNG"); + + const disputeKit = await deployments.get("DisputeKitClassic"); + + const minStake = BigNumber.from(10).pow(20).mul(2); + const alpha = 10000; + const feeForJuror = BigNumber.from(10).pow(17); + + // console.log("Upgrading the SortitionModule..."); + // const sortitionModuleDeployment = await deployments.get("SortitionModule") + const sortitionModuleDeployment = await deployments.get("SortitionModule"); + + console.log("Upgrading the KlerosCore..."); + const klerosCoreDeploymenent = await deploy("KlerosCore", { + from: deployer, + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModuleDeployment.address, + ], + }, + // Workaround to bypass the current version of hardhat-deploy which fallback on `upgradeTo` when no updateMethod is defined + // To be replaced by `initialize` or any new function when upgrading while initializing again the proxy storage (reinitializer(uint version) modifier) + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + args: [], + log: true, + }); + } catch (err) { + console.error(err); + throw err; + } +}; + +deployUpgradeKlerosCore.tags = ["Upgrade", "KlerosCore"]; +deployUpgradeKlerosCore.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !HomeChains[chainId]; +}; + +export default deployUpgradeKlerosCore; diff --git a/contracts/deploy/upgrade-sortition-module.ts b/contracts/deploy/upgrade-sortition-module.ts new file mode 100644 index 000000000..310ff948d --- /dev/null +++ b/contracts/deploy/upgrade-sortition-module.ts @@ -0,0 +1,72 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; +import { BigNumber } from "ethers"; +import getContractAddress from "../deploy-helpers/getContractAddress"; +import { get } from "http"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_GOERLI = 421613, + HARDHAT = 31337, +} + +const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { ethers, deployments, getNamedAccounts, getChainId } = hre; + const { deploy, execute } = deployments; + const { AddressZero } = hre.ethers.constants; + const RNG_LOOKAHEAD = 20; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Upgrading to %s with deployer %s", HomeChains[chainId], deployer); + + try { + const pnk = await deployments.get("PNK"); + + const dai = await deployments.get("DAI"); + + const weth = await deployments.get("WETH"); + + const rng = await deployments.get("RandomizerRNG"); + + const klerosCore = await deployments.get("KlerosCore"); + const KlerosCoreAddress = klerosCore.address; + + console.log("Upgrading the SortitionModule..."); + const sortitionModuleDeployment = await deploy("SortitionModule", { + from: deployer, + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime + }, + // Workaround to bypass the current version of hardhat-deploy which fallback on `upgradeTo` when no updateMethod is defined + // To be replaced by `initialize` or any new function when upgrading while initializing again the proxy storage (reinitializer(uint version) modifier) + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + log: true, + args: [], + }); + } catch (err) { + console.error(err); + throw err; + } +}; + +deployUpgradeSortitionModule.tags = ["Upgrade", "SortitionModule"]; +deployUpgradeSortitionModule.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !HomeChains[chainId]; +}; + +export default deployUpgradeSortitionModule; From 76cb13da2cfcefb67abe26f3cb962518c28e1bc2 Mon Sep 17 00:00:00 2001 From: zmalatrax Date: Sun, 3 Sep 2023 11:57:23 +0200 Subject: [PATCH 09/16] feat(proxy): bump hardhat-deploy for intersection tags --- contracts/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/package.json b/contracts/package.json index 81c808444..e8f53096d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -62,7 +62,7 @@ "graphql-request": "^6.1.0", "hardhat": "^2.15.0", "hardhat-contract-sizer": "^2.10.0", - "hardhat-deploy": "^0.11.34", + "hardhat-deploy": "^0.11.37", "hardhat-deploy-ethers": "^0.4.0-next.1", "hardhat-deploy-tenderly": "^0.2.0", "hardhat-docgen": "^1.3.0", diff --git a/yarn.lock b/yarn.lock index 91b555087..08ed4e0ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5174,7 +5174,7 @@ __metadata: graphql-request: ^6.1.0 hardhat: ^2.15.0 hardhat-contract-sizer: ^2.10.0 - hardhat-deploy: ^0.11.34 + hardhat-deploy: ^0.11.37 hardhat-deploy-ethers: ^0.4.0-next.1 hardhat-deploy-tenderly: ^0.2.0 hardhat-docgen: ^1.3.0 @@ -17812,9 +17812,9 @@ __metadata: languageName: node linkType: hard -"hardhat-deploy@npm:^0.11.34": - version: 0.11.34 - resolution: "hardhat-deploy@npm:0.11.34" +"hardhat-deploy@npm:^0.11.37": + version: 0.11.37 + resolution: "hardhat-deploy@npm:0.11.37" dependencies: "@ethersproject/abi": ^5.7.0 "@ethersproject/abstract-signer": ^5.7.0 @@ -17840,7 +17840,7 @@ __metadata: murmur-128: ^0.2.1 qs: ^6.9.4 zksync-web3: ^0.14.3 - checksum: 3c4bcd657a80e4f22c1f8bcee021e5277060849ce4180cbc721e0c2d625f2f98de8ebbfad23875d32eeaf06d88bdba06cb43ab29359cb9531e8bb7851a98ead1 + checksum: c338289849f26530296be648c7bfc2d4673d0786855ed256ee9cc864f40b94125cfa36808bedfbae4f2bad7adc38def7547bbeb3b84cbfb0aeabae04de5238fd languageName: node linkType: hard From 487fc5bb9473e102c70e8ab6e89263ef15897e0f Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Mon, 25 Sep 2023 18:54:22 +0100 Subject: [PATCH 10/16] feat: made the DisputeKits and RandomizerRNG upgradable, refactored the deploy scripts --- contracts/deploy/00-ethereum-pnk.ts | 6 +- contracts/deploy/00-home-chain-arbitrable.ts | 12 +- contracts/deploy/00-home-chain-arbitration.ts | 113 +++++------------- contracts/deploy/00-home-chain-pnk-faucet.ts | 12 +- contracts/deploy/00-rng.ts | 12 +- .../deploy/01-foreign-gateway-on-ethereum.ts | 13 +- .../deploy/01-foreign-gateway-on-gnosis.ts | 14 +-- .../deploy/02-home-gateway-to-ethereum.ts | 12 +- contracts/deploy/02-home-gateway-to-gnosis.ts | 12 +- contracts/deploy/03-vea-mock.ts | 15 +-- contracts/deploy/04-foreign-arbitrable.ts | 13 +- .../deploy/04-klerosliquid-to-v2-gnosis.ts | 12 +- contracts/deploy/fix1148.ts | 6 +- contracts/deploy/upgrade-kleros-core.ts | 68 +++-------- contracts/deploy/upgrade-sortition-module.ts | 54 +++------ contracts/deploy/utils/deployUpgradable.ts | 31 +++++ .../utils}/getContractAddress.js | 0 contracts/deploy/utils/index.ts | 29 +++++ .../dispute-kits/BaseDisputeKit.sol | 68 ----------- .../dispute-kits/DisputeKitClassic.sol | 68 +++++++++-- .../dispute-kits/DisputeKitSybilResistant.sol | 68 +++++++++-- contracts/src/rng/RandomizerRNG.sol | 19 ++- contracts/test/arbitration/index.ts | 103 ++-------------- cspell.json | 2 + 24 files changed, 312 insertions(+), 450 deletions(-) create mode 100644 contracts/deploy/utils/deployUpgradable.ts rename contracts/{deploy-helpers => deploy/utils}/getContractAddress.js (100%) create mode 100644 contracts/deploy/utils/index.ts delete mode 100644 contracts/src/arbitration/dispute-kits/BaseDisputeKit.sol diff --git a/contracts/deploy/00-ethereum-pnk.ts b/contracts/deploy/00-ethereum-pnk.ts index 29d6a51b3..002237ef8 100644 --- a/contracts/deploy/00-ethereum-pnk.ts +++ b/contracts/deploy/00-ethereum-pnk.ts @@ -1,6 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; +import { isSkipped } from "./utils"; enum Chains { GOERLI = 5, @@ -24,9 +25,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployArbitration.tags = ["Pinakion"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !Chains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !Chains[network.config.chainId ?? 0]); }; export default deployArbitration; diff --git a/contracts/deploy/00-home-chain-arbitrable.ts b/contracts/deploy/00-home-chain-arbitrable.ts index fe319dcd1..6370302b4 100644 --- a/contracts/deploy/00-home-chain-arbitrable.ts +++ b/contracts/deploy/00-home-chain-arbitrable.ts @@ -1,12 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, - HARDHAT = 31337, -} +import { HomeChains, isSkipped } from "./utils"; const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { deployments, getNamedAccounts, getChainId } = hre; @@ -50,9 +45,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) deployArbitration.tags = ["HomeArbitrable"]; deployArbitration.dependencies = ["Arbitration"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployArbitration; diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index b4a152d97..2983d9f52 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -1,13 +1,9 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { BigNumber } from "ethers"; -import getContractAddress from "../deploy-helpers/getContractAddress"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, - HARDHAT = 31337, -} +import getContractAddress from "./utils/getContractAddress"; +import { deployUpgradable } from "./utils/deployUpgradable"; +import { HomeChains, isSkipped } from "./utils"; const pnkByChain = new Map([ [HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"], @@ -63,51 +59,25 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }); const randomizer = randomizerByChain.get(Number(await getChainId())) ?? AddressZero; - const rng = await deploy("RandomizerRNG", { - skipIfAlreadyDeployed: true, - from: deployer, - args: [randomizer, deployer], - log: true, - }); - - const disputeKit = await deploy("DisputeKitClassic", { - from: deployer, - args: [deployer, AddressZero], - log: true, - }); + const rng = await deployUpgradable(hre, deployer, "RandomizerRNG", [randomizer, deployer]); - let nonce; - let KlerosCoreAddress; + const disputeKit = await deployUpgradable(hre, deployer, "DisputeKitClassic", [deployer, AddressZero]); - const klerosCoreDeployment = await deployments.getOrNull("KlerosCore"); - if (!klerosCoreDeployment) { - nonce = await ethers.provider.getTransactionCount(deployer); - KlerosCoreAddress = getContractAddress(deployer, nonce + 3); // Deploying an upgradeable version of SortionModule requires 2 transactions instead of 1 (implementation then proxy) - console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress); - } else { - KlerosCoreAddress = klerosCoreDeployment.address; + let klerosCoreAddress = await deployments.getOrNull("KlerosCore").then((deployment) => deployment?.address); + if (!klerosCoreAddress) { + const nonce = await ethers.provider.getTransactionCount(deployer); + klerosCoreAddress = getContractAddress(deployer, nonce + 3); // Deploying an upgradeable version of SortitionModule requires 2 transactions instead of 1 (implementation then proxy) + console.log("calculated future KlerosCore address for nonce %d: %s", nonce, klerosCoreAddress); } - const sortitionModule = await deploy("SortitionModule", { - from: deployer, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - checkProxyAdmin: false, - checkABIConflict: false, - execute: { - init: { - methodName: "initialize", - args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime - }, - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - log: true, - }); + const sortitionModule = await deployUpgradable(hre, deployer, "SortitionModule", [ + deployer, + klerosCoreAddress, + 1800, // minStakingTime + 1800, // maxFreezingTime + rng.address, + RNG_LOOKAHEAD, + ]); const pnk = pnkByChain.get(chainId) ?? AddressZero; const dai = daiByChain.get(chainId) ?? AddressZero; @@ -115,37 +85,17 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const minStake = BigNumber.from(10).pow(20).mul(2); const alpha = 10000; const feeForJuror = BigNumber.from(10).pow(17); - const klerosCore = await deploy("KlerosCore", { - from: deployer, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - checkProxyAdmin: false, - checkABIConflict: false, - execute: { - init: { - methodName: "initialize", - args: [ - deployer, - pnk, - AddressZero, - disputeKit.address, - false, - [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump - [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K - sortitionModule.address, - ], - }, - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - args: [], - log: true, - }); + const klerosCore = await deployUpgradable(hre, deployer, "KlerosCore", [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModule.address, + ]); // execute DisputeKitClassic.changeCore() only if necessary const currentCore = await hre.ethers.getContractAt("DisputeKitClassic", disputeKit.address).then((dk) => dk.core()); @@ -163,9 +113,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployArbitration.tags = ["Arbitration"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; const deployERC20AndFaucet = async ( diff --git a/contracts/deploy/00-home-chain-pnk-faucet.ts b/contracts/deploy/00-home-chain-pnk-faucet.ts index 8760614f3..3b5c983be 100644 --- a/contracts/deploy/00-home-chain-pnk-faucet.ts +++ b/contracts/deploy/00-home-chain-pnk-faucet.ts @@ -1,11 +1,6 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, - HARDHAT = 31337, -} +import { HomeChains, isSkipped } from "./utils"; const pnkByChain = new Map([ [HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"], @@ -39,9 +34,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployArbitration.tags = ["PnkFaucet"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployArbitration; diff --git a/contracts/deploy/00-rng.ts b/contracts/deploy/00-rng.ts index 0c2f79940..065c24fa6 100644 --- a/contracts/deploy/00-rng.ts +++ b/contracts/deploy/00-rng.ts @@ -1,12 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { SortitionModule, RandomizerRNG } from "../typechain-types"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, - HARDHAT = 31337, -} +import { HomeChains, isSkipped } from "./utils"; const pnkByChain = new Map([ [HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"], @@ -63,9 +58,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployArbitration.tags = ["RNG"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployArbitration; diff --git a/contracts/deploy/01-foreign-gateway-on-ethereum.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts index 1304fec72..16a67ccb0 100644 --- a/contracts/deploy/01-foreign-gateway-on-ethereum.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -1,12 +1,8 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; -import getContractAddress from "../deploy-helpers/getContractAddress"; +import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; - -enum ForeignChains { - ETHEREUM_MAINNET = 1, - ETHEREUM_GOERLI = 5, -} +import { ForeignChains, HardhatChain, isSkipped } from "./utils"; const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { ethers, deployments, getNamedAccounts, getChainId, config } = hre; @@ -56,9 +52,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme }; deployForeignGateway.tags = ["ForeignGatewayOnEthereum"]; -deployForeignGateway.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !ForeignChains[chainId]; +deployForeignGateway.skip = async ({ network }) => { + return isSkipped(network, !ForeignChains[network.config.chainId ?? 0]); }; export default deployForeignGateway; diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts index a9e33e708..ec57be903 100644 --- a/contracts/deploy/01-foreign-gateway-on-gnosis.ts +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -1,14 +1,9 @@ import { parseUnits } from "ethers/lib/utils"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; -import getContractAddress from "../deploy-helpers/getContractAddress"; +import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; - -enum ForeignChains { - GNOSIS_MAINNET = 100, - GNOSIS_CHIADO = 10200, - HARDHAT = 31337, -} +import { ForeignChains, isSkipped } from "./utils"; const ONE_GWEI = parseUnits("1", "gwei"); @@ -62,9 +57,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme }; deployForeignGateway.tags = ["ForeignGatewayOnGnosis"]; -deployForeignGateway.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !ForeignChains[chainId]; +deployForeignGateway.skip = async ({ network }) => { + return isSkipped(network, !ForeignChains[network.config.chainId ?? 0]); }; export default deployForeignGateway; diff --git a/contracts/deploy/02-home-gateway-to-ethereum.ts b/contracts/deploy/02-home-gateway-to-ethereum.ts index be6defecc..596b3e1c6 100644 --- a/contracts/deploy/02-home-gateway-to-ethereum.ts +++ b/contracts/deploy/02-home-gateway-to-ethereum.ts @@ -1,11 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { ethers } from "hardhat"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, -} +import { HardhatChain, HomeChains, isSkipped } from "./utils"; // TODO: use deterministic deployments @@ -42,9 +38,9 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployHomeGateway.tags = ["HomeGatewayToEthereum"]; -deployHomeGateway.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployHomeGateway.skip = async ({ network }) => { + const chainId = network.config.chainId ?? 0; + return isSkipped(network, !HomeChains[chainId] || HardhatChain[chainId] !== undefined); }; export default deployHomeGateway; diff --git a/contracts/deploy/02-home-gateway-to-gnosis.ts b/contracts/deploy/02-home-gateway-to-gnosis.ts index 7baaf71b0..5184007b5 100644 --- a/contracts/deploy/02-home-gateway-to-gnosis.ts +++ b/contracts/deploy/02-home-gateway-to-gnosis.ts @@ -1,10 +1,6 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; - -enum HomeChains { - ARBITRUM_ONE = 42161, - ARBITRUM_GOERLI = 421613, -} +import { HardhatChain, HomeChains, isSkipped } from "./utils"; // TODO: use deterministic deployments @@ -35,9 +31,9 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployHomeGateway.tags = ["HomeGatewayToGnosis"]; -deployHomeGateway.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployHomeGateway.skip = async ({ network }) => { + const chainId = network.config.chainId ?? 0; + return isSkipped(network, !HomeChains[chainId] || HardhatChain[chainId] !== undefined); }; export default deployHomeGateway; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index d7e09f550..aef1fb400 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -1,10 +1,9 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; -import getContractAddress from "../deploy-helpers/getContractAddress"; +import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; - -const HARDHAT_NETWORK = 31337; +import { HardhatChain, isSkipped } from "./utils"; // TODO: use deterministic deployments @@ -15,7 +14,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; - console.log("Deploying to chainId %s with deployer %s", HARDHAT_NETWORK, deployer); + console.log("Deploying to chainId %s with deployer %s", HardhatChain.HARDHAT, deployer); const klerosCore = await deployments.get("KlerosCore"); @@ -28,7 +27,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const homeGatewayAddress = getContractAddress(deployer, nonce + 1); console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); - const homeChainIdAsBytes32 = hexZeroPad(hexlify(HARDHAT_NETWORK), 32); + const homeChainIdAsBytes32 = hexZeroPad(hexlify(HardhatChain.HARDHAT), 32); const foreignGateway = await deploy("ForeignGatewayOnEthereum", { from: deployer, contract: "ForeignGateway", @@ -44,7 +43,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) deployer, klerosCore.address, vea.address, - HARDHAT_NETWORK, + HardhatChain.HARDHAT, foreignGateway.address, ethers.constants.AddressZero, // feeToken ], @@ -86,6 +85,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployHomeGateway.tags = ["VeaMock"]; -deployHomeGateway.skip = async ({ getChainId }) => HARDHAT_NETWORK !== Number(await getChainId()); +deployHomeGateway.skip = async ({ network }) => { + return isSkipped(network, HardhatChain[network.config.chainId ?? 0] === undefined); +}; export default deployHomeGateway; diff --git a/contracts/deploy/04-foreign-arbitrable.ts b/contracts/deploy/04-foreign-arbitrable.ts index c0918c2ae..801c507af 100644 --- a/contracts/deploy/04-foreign-arbitrable.ts +++ b/contracts/deploy/04-foreign-arbitrable.ts @@ -2,13 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { parseUnits } from "ethers/lib/utils"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; - -enum ForeignChains { - ETHEREUM_MAINNET = 1, - ETHEREUM_GOERLI = 5, - GNOSIS_MAINNET = 100, - GNOSIS_CHIADO = 10200, -} +import { ForeignChains, isSkipped } from "./utils"; const foreignGatewayArtifactByChain = new Map([ [ForeignChains.ETHEREUM_MAINNET, "ForeignGatewayOnEthereum"], @@ -65,9 +59,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme }; deployForeignGateway.tags = ["ForeignArbitrable"]; -deployForeignGateway.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !ForeignChains[chainId]; +deployForeignGateway.skip = async ({ network }) => { + return isSkipped(network, !ForeignChains[network.config.chainId ?? 0]); }; export default deployForeignGateway; diff --git a/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts index bc8c2bb18..0366f74ef 100644 --- a/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts +++ b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts @@ -2,12 +2,7 @@ import { parseUnits, parseEther } from "ethers/lib/utils"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; - -enum ForeignChains { - GNOSIS_MAINNET = 100, - GNOSIS_CHIADO = 10200, - HARDHAT = 31337, -} +import { ForeignChains, isSkipped } from "./utils"; const wrappedPNKByChain = new Map([ [ForeignChains.GNOSIS_MAINNET, "0xcb3231aBA3b451343e0Fddfc45883c842f223846"], @@ -148,9 +143,8 @@ const deployKlerosLiquid: DeployFunction = async (hre: HardhatRuntimeEnvironment // }; deployKlerosLiquid.tags = ["KlerosLiquidOnGnosis"]; -deployKlerosLiquid.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !ForeignChains[chainId]; +deployKlerosLiquid.skip = async ({ network }) => { + return isSkipped(network, !ForeignChains[network.config.chainId ?? 0]); }; export default deployKlerosLiquid; diff --git a/contracts/deploy/fix1148.ts b/contracts/deploy/fix1148.ts index de31fa993..446464398 100644 --- a/contracts/deploy/fix1148.ts +++ b/contracts/deploy/fix1148.ts @@ -2,6 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { DisputeKitClassic, KlerosCore, SortitionModule } from "../typechain-types"; import assert from "node:assert"; +import { isSkipped } from "./utils"; enum HomeChains { ARBITRUM_ONE = 42161, @@ -55,9 +56,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }; deployArbitration.tags = ["Fix1148"]; -deployArbitration.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployArbitration.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployArbitration; diff --git a/contracts/deploy/upgrade-kleros-core.ts b/contracts/deploy/upgrade-kleros-core.ts index 54c50269e..bd1cc1259 100644 --- a/contracts/deploy/upgrade-kleros-core.ts +++ b/contracts/deploy/upgrade-kleros-core.ts @@ -1,8 +1,8 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { BigNumber } from "ethers"; -import getContractAddress from "../deploy-helpers/getContractAddress"; -import { get } from "http"; +import { deployUpgradable } from "./utils/deployUpgradable"; +import { isSkipped } from "./utils"; enum HomeChains { ARBITRUM_ONE = 42161, @@ -12,9 +12,7 @@ enum HomeChains { const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { ethers, deployments, getNamedAccounts, getChainId } = hre; - const { deploy, execute } = deployments; const { AddressZero } = hre.ethers.constants; - const RNG_LOOKAHEAD = 20; // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; @@ -23,57 +21,24 @@ const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnviro try { const pnk = await deployments.get("PNK"); - - const dai = await deployments.get("DAI"); - - const weth = await deployments.get("WETH"); - - const rng = await deployments.get("RandomizerRNG"); - const disputeKit = await deployments.get("DisputeKitClassic"); - const minStake = BigNumber.from(10).pow(20).mul(2); const alpha = 10000; const feeForJuror = BigNumber.from(10).pow(17); - - // console.log("Upgrading the SortitionModule..."); - // const sortitionModuleDeployment = await deployments.get("SortitionModule") - const sortitionModuleDeployment = await deployments.get("SortitionModule"); + const sortitionModule = await deployments.get("SortitionModule"); console.log("Upgrading the KlerosCore..."); - const klerosCoreDeploymenent = await deploy("KlerosCore", { - from: deployer, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - checkProxyAdmin: false, - checkABIConflict: false, - execute: { - init: { - methodName: "initialize", - args: [ - deployer, - pnk, - AddressZero, - disputeKit.address, - false, - [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump - [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K - sortitionModuleDeployment.address, - ], - }, - // Workaround to bypass the current version of hardhat-deploy which fallback on `upgradeTo` when no updateMethod is defined - // To be replaced by `initialize` or any new function when upgrading while initializing again the proxy storage (reinitializer(uint version) modifier) - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - args: [], - log: true, - }); + await deployUpgradable(hre, deployer, "KlerosCore", [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModule.address, + ]); } catch (err) { console.error(err); throw err; @@ -81,9 +46,8 @@ const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnviro }; deployUpgradeKlerosCore.tags = ["Upgrade", "KlerosCore"]; -deployUpgradeKlerosCore.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployUpgradeKlerosCore.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployUpgradeKlerosCore; diff --git a/contracts/deploy/upgrade-sortition-module.ts b/contracts/deploy/upgrade-sortition-module.ts index 310ff948d..e431b78f9 100644 --- a/contracts/deploy/upgrade-sortition-module.ts +++ b/contracts/deploy/upgrade-sortition-module.ts @@ -1,8 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; -import { BigNumber } from "ethers"; -import getContractAddress from "../deploy-helpers/getContractAddress"; -import { get } from "http"; +import { deployUpgradable } from "./utils/deployUpgradable"; +import { isSkipped } from "./utils"; enum HomeChains { ARBITRUM_ONE = 42161, @@ -11,9 +10,7 @@ enum HomeChains { } const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { - const { ethers, deployments, getNamedAccounts, getChainId } = hre; - const { deploy, execute } = deployments; - const { AddressZero } = hre.ethers.constants; + const { deployments, getNamedAccounts, getChainId } = hre; const RNG_LOOKAHEAD = 20; // fallback to hardhat node signers on local network @@ -22,41 +19,19 @@ const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeE console.log("Upgrading to %s with deployer %s", HomeChains[chainId], deployer); try { - const pnk = await deployments.get("PNK"); - - const dai = await deployments.get("DAI"); - - const weth = await deployments.get("WETH"); - const rng = await deployments.get("RandomizerRNG"); - const klerosCore = await deployments.get("KlerosCore"); - const KlerosCoreAddress = klerosCore.address; + const klerosCoreAddress = klerosCore.address; console.log("Upgrading the SortitionModule..."); - const sortitionModuleDeployment = await deploy("SortitionModule", { - from: deployer, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - checkProxyAdmin: false, - checkABIConflict: false, - execute: { - init: { - methodName: "initialize", - args: [deployer, KlerosCoreAddress, 1800, 1800, rng.address, RNG_LOOKAHEAD], // minStakingTime, maxFreezingTime - }, - // Workaround to bypass the current version of hardhat-deploy which fallback on `upgradeTo` when no updateMethod is defined - // To be replaced by `initialize` or any new function when upgrading while initializing again the proxy storage (reinitializer(uint version) modifier) - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - log: true, - args: [], - }); + await deployUpgradable(hre, deployer, "SortitionModule", [ + deployer, + klerosCoreAddress, + 1800, // minStakingTime + 1800, // maxFreezingTime + rng.address, + RNG_LOOKAHEAD, + ]); } catch (err) { console.error(err); throw err; @@ -64,9 +39,8 @@ const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeE }; deployUpgradeSortitionModule.tags = ["Upgrade", "SortitionModule"]; -deployUpgradeSortitionModule.skip = async ({ getChainId }) => { - const chainId = Number(await getChainId()); - return !HomeChains[chainId]; +deployUpgradeSortitionModule.skip = async ({ network }) => { + return isSkipped(network, !HomeChains[network.config.chainId ?? 0]); }; export default deployUpgradeSortitionModule; diff --git a/contracts/deploy/utils/deployUpgradable.ts b/contracts/deploy/utils/deployUpgradable.ts new file mode 100644 index 000000000..3402f18c2 --- /dev/null +++ b/contracts/deploy/utils/deployUpgradable.ts @@ -0,0 +1,31 @@ +import { DeployResult } from "hardhat-deploy/types"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +export function deployUpgradable( + hre: HardhatRuntimeEnvironment, + deployer: string, + contract: string, + params: any[] +): Promise { + const { deploy } = hre.deployments; + return deploy(contract, { + from: deployer, + proxy: { + proxyContract: "UUPSProxy", + proxyArgs: ["{implementation}", "{data}"], + checkProxyAdmin: false, + checkABIConflict: false, + execute: { + init: { + methodName: "initialize", + args: params, + }, + onUpgrade: { + methodName: "governor", + args: [], + }, + }, + }, + log: true, + }); +} diff --git a/contracts/deploy-helpers/getContractAddress.js b/contracts/deploy/utils/getContractAddress.js similarity index 100% rename from contracts/deploy-helpers/getContractAddress.js rename to contracts/deploy/utils/getContractAddress.js diff --git a/contracts/deploy/utils/index.ts b/contracts/deploy/utils/index.ts new file mode 100644 index 000000000..2c5cfdd8c --- /dev/null +++ b/contracts/deploy/utils/index.ts @@ -0,0 +1,29 @@ +import { Network } from "hardhat/types"; + +// TODO: derive this from hardhat.config and make it rely on viem/chains + +export enum HardhatChain { + HARDHAT = 31337, +} + +export enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_GOERLI = 421613, + HARDHAT = HardhatChain.HARDHAT, +} + +export enum ForeignChains { + ETHEREUM_MAINNET = 1, + ETHEREUM_GOERLI = 5, + GNOSIS_MAINNET = 100, + GNOSIS_CHIADO = 10200, + HARDHAT = HardhatChain.HARDHAT, +} + +export const isSkipped = async (network: Network, skip: boolean) => { + if (skip) { + console.error(`Error: incompatible network ${network.name} for this deployment script`); + return true; + } + return false; +}; diff --git a/contracts/src/arbitration/dispute-kits/BaseDisputeKit.sol b/contracts/src/arbitration/dispute-kits/BaseDisputeKit.sol deleted file mode 100644 index 878cf99bf..000000000 --- a/contracts/src/arbitration/dispute-kits/BaseDisputeKit.sol +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: MIT - -/// @custom:authors: [@unknownunknown1, @jaybuidl] -/// @custom:reviewers: [] -/// @custom:auditors: [] -/// @custom:bounties: [] -/// @custom:deployments: [] - -pragma solidity 0.8.18; - -import "../interfaces/IDisputeKit.sol"; -import "../KlerosCore.sol"; - -/// @title BaseDisputeKit -/// Provides common basic behaviours to the Dispute Kit implementations. -abstract contract BaseDisputeKit is IDisputeKit { - // ************************************* // - // * Storage * // - // ************************************* // - - address public governor; // The governor of the contract. - KlerosCore public core; // The Kleros Core arbitrator - - // ************************************* // - // * Function Modifiers * // - // ************************************* // - - modifier onlyByGovernor() { - require(governor == msg.sender, "Access not allowed: Governor only."); - _; - } - - modifier onlyByCore() { - require(address(core) == msg.sender, "Access not allowed: KlerosCore only."); - _; - } - - /// @dev Constructor. - /// @param _governor The governor's address. - /// @param _core The KlerosCore arbitrator. - constructor(address _governor, KlerosCore _core) { - governor = _governor; - core = _core; - } - - // ************************ // - // * Governance * // - // ************************ // - - /// @dev Allows the governor to call anything on behalf of the contract. - /// @param _destination The destination of the call. - /// @param _amount The value sent with the call. - /// @param _data The data sent with the call. - function executeGovernorProposal( - address _destination, - uint256 _amount, - bytes memory _data - ) external onlyByGovernor { - (bool success, ) = _destination.call{value: _amount}(_data); - require(success, "Unsuccessful call"); - } - - /// @dev Checks that the chosen address satisfies certain conditions for being drawn. - /// @param _coreDisputeID ID of the dispute in the core contract. - /// @param _juror Chosen address. - /// @return Whether the address can be drawn or not. - function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal virtual returns (bool); -} diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol index cf4e927b3..28ed9bc95 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol @@ -8,8 +8,11 @@ pragma solidity 0.8.18; -import "./BaseDisputeKit.sol"; +import "../KlerosCore.sol"; +import "../interfaces/IDisputeKit.sol"; import "../interfaces/IEvidence.sol"; +import "../../proxy/UUPSProxiable.sol"; +import "../../proxy/Initializable.sol"; /// @title DisputeKitClassic /// Dispute kit implementation of the Kleros v1 features including: @@ -17,7 +20,7 @@ import "../interfaces/IEvidence.sol"; /// - a vote aggregation system: plurality, /// - an incentive system: equal split between coherent votes, /// - an appeal system: fund 2 choices only, vote on any choice. -contract DisputeKitClassic is BaseDisputeKit, IEvidence { +contract DisputeKitClassic is IDisputeKit, IEvidence, Initializable, UUPSProxiable { // ************************************* // // * Structs * // // ************************************* // @@ -61,6 +64,8 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period. uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling. + address public governor; // The governor of the contract. + KlerosCore public core; // The Kleros Core arbitrator Dispute[] public disputes; // Array of the locally created disputes. mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID. @@ -119,21 +124,63 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { // * Modifiers * // // ************************************* // + modifier onlyByGovernor() { + require(governor == msg.sender, "Access not allowed: Governor only."); + _; + } + + modifier onlyByCore() { + require(address(core) == msg.sender, "Access not allowed: KlerosCore only."); + _; + } + modifier notJumped(uint256 _coreDisputeID) { require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, "Dispute jumped to a parent DK!"); _; } - /** @dev Constructor. - * @param _governor The governor's address. - * @param _core The KlerosCore arbitrator. - */ - constructor(address _governor, KlerosCore _core) BaseDisputeKit(_governor, _core) {} + // ************************************* // + // * Constructor * // + // ************************************* // + + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer. + /// @param _governor The governor's address. + /// @param _core The KlerosCore arbitrator. + function initialize(address _governor, KlerosCore _core) external reinitializer(1) { + governor = _governor; + core = _core; + } // ************************ // // * Governance * // // ************************ // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + + /// @dev Allows the governor to call anything on behalf of the contract. + /// @param _destination The destination of the call. + /// @param _amount The value sent with the call. + /// @param _data The data sent with the call. + function executeGovernorProposal( + address _destination, + uint256 _amount, + bytes memory _data + ) external onlyByGovernor { + (bool success, ) = _destination.call{value: _amount}(_data); + require(success, "Unsuccessful call"); + } + /// @dev Changes the `governor` storage variable. /// @param _governor The new value for the `governor` storage variable. function changeGovernor(address payable _governor) external onlyByGovernor { @@ -559,8 +606,11 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { // * Internal * // // ************************************* // - /// @inheritdoc BaseDisputeKit - function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) { + /// @dev Checks that the chosen address satisfies certain conditions for being drawn. + /// @param _coreDisputeID ID of the dispute in the core contract. + /// @param _juror Chosen address. + /// @return Whether the address can be drawn or not. + function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view returns (bool) { (uint96 courtID, , , , ) = core.disputes(_coreDisputeID); uint256 lockedAmountPerJuror = core .getRoundInfo(_coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1) diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol index eb907c87e..a0fed2592 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol @@ -8,8 +8,11 @@ pragma solidity 0.8.18; -import "./BaseDisputeKit.sol"; -import "../interfaces//IEvidence.sol"; +import "../KlerosCore.sol"; +import "../interfaces/IDisputeKit.sol"; +import "../interfaces/IEvidence.sol"; +import "../../proxy/UUPSProxiable.sol"; +import "../../proxy/Initializable.sol"; interface IProofOfHumanity { /// @dev Return true if the submission is registered and not expired. @@ -24,7 +27,7 @@ interface IProofOfHumanity { /// - a vote aggregation system: plurality, /// - an incentive system: equal split between coherent votes, /// - an appeal system: fund 2 choices only, vote on any choice. -contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { +contract DisputeKitSybilResistant is IDisputeKit, IEvidence, Initializable, UUPSProxiable { // ************************************* // // * Structs * // // ************************************* // @@ -69,10 +72,11 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period. uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling. - IProofOfHumanity public poh; // The Proof of Humanity registry - + address public governor; // The governor of the contract. + KlerosCore public core; // The Kleros Core arbitrator Dispute[] public disputes; // Array of the locally created disputes. mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID. + IProofOfHumanity public poh; // The Proof of Humanity registry // ************************************* // // * Events * // @@ -129,17 +133,36 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { // * Modifiers * // // ************************************* // + modifier onlyByGovernor() { + require(governor == msg.sender, "Access not allowed: Governor only."); + _; + } + + modifier onlyByCore() { + require(address(core) == msg.sender, "Access not allowed: KlerosCore only."); + _; + } + modifier notJumped(uint256 _coreDisputeID) { require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, "Dispute jumped to a parent DK!"); _; } - /** @dev Constructor. - * @param _governor The governor's address. - * @param _core The KlerosCore arbitrator. - * @param _poh ProofOfHumanity contract. - */ - constructor(address _governor, KlerosCore _core, IProofOfHumanity _poh) BaseDisputeKit(_governor, _core) { + // ************************************* // + // * Constructor * // + // ************************************* // + + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer. + /// @param _governor The governor's address. + /// @param _core The KlerosCore arbitrator. + function initialize(address _governor, KlerosCore _core, IProofOfHumanity _poh) external reinitializer(1) { + governor = _governor; + core = _core; poh = _poh; } @@ -147,6 +170,27 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { // * Governance * // // ************************ // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + + /// @dev Allows the governor to call anything on behalf of the contract. + /// @param _destination The destination of the call. + /// @param _amount The value sent with the call. + /// @param _data The data sent with the call. + function executeGovernorProposal( + address _destination, + uint256 _amount, + bytes memory _data + ) external onlyByGovernor { + (bool success, ) = _destination.call{value: _amount}(_data); + require(success, "Unsuccessful call"); + } + /// @dev Changes the `governor` storage variable. /// @param _governor The new value for the `governor` storage variable. function changeGovernor(address payable _governor) external onlyByGovernor { @@ -583,7 +627,7 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { /// @param _coreDisputeID ID of the dispute in the core contract. /// @param _juror Chosen address. /// @return Whether the address can be drawn or not. - function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) { + function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view returns (bool) { (uint96 courtID, , , , ) = core.disputes(_coreDisputeID); uint256 lockedAmountPerJuror = core .getRoundInfo(_coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1) diff --git a/contracts/src/rng/RandomizerRNG.sol b/contracts/src/rng/RandomizerRNG.sol index 34361cb07..30fef82f5 100644 --- a/contracts/src/rng/RandomizerRNG.sol +++ b/contracts/src/rng/RandomizerRNG.sol @@ -4,10 +4,12 @@ pragma solidity 0.8.18; import "./RNG.sol"; import "./IRandomizer.sol"; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; /// @title Random Number Generator that uses Randomizer.ai /// https://randomizer.ai/ -contract RandomizerRNG is RNG { +contract RandomizerRNG is RNG, UUPSProxiable, Initializable { address public governor; // The address that can withdraw funds. uint256 public callbackGasLimit = 50000; // Gas limit for the randomizer callback @@ -24,10 +26,15 @@ contract RandomizerRNG is RNG { _; } - /// @dev Constructor. + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer /// @param _randomizer Randomizer contract. /// @param _governor Governor of the contract. - constructor(IRandomizer _randomizer, address _governor) { + function initialize(IRandomizer _randomizer, address _governor) external reinitializer(1) { randomizer = _randomizer; governor = _governor; } @@ -36,6 +43,12 @@ contract RandomizerRNG is RNG { // * Governance * // // ************************ // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor {} + /// @dev Changes the governor of the contract. /// @param _governor The new governor. function changeGovernor(address _governor) external onlyByGovernor { diff --git a/contracts/test/arbitration/index.ts b/contracts/test/arbitration/index.ts index 8bf65831b..f3530437b 100644 --- a/contracts/test/arbitration/index.ts +++ b/contracts/test/arbitration/index.ts @@ -1,13 +1,7 @@ import { expect } from "chai"; import { deployments, ethers } from "hardhat"; import { BigNumber } from "ethers"; -import getContractAddress from "../../deploy-helpers/getContractAddress"; - -const ONE_ETH = BigNumber.from(10).pow(18); -const WINNER_STAKE_MULTIPLIER = 3000; -const LOSER_STAKE_MULTIPLIER = 7000; -const MULTIPLIER_DENOMINATOR = 10000; -const LOOKAHEAD = 20; +import { KlerosCore, DisputeKitClassic } from "../../typechain-types"; describe("DisputeKitClassic", async () => { // eslint-disable-next-line no-unused-vars @@ -32,16 +26,11 @@ describe("DisputeKitClassic", async () => { expect(events[0].args._courtID).to.equal(1); expect(events[0].args._parent).to.equal(0); expect(events[0].args._hiddenVotes).to.equal(false); - expect(events[0].args._minStake).to.equal(200); + expect(events[0].args._minStake).to.equal(ethers.utils.parseUnits("200", 18)); expect(events[0].args._alpha).to.equal(10000); - expect(events[0].args._feeForJuror).to.equal(100); - expect(events[0].args._jurorsForCourtJump).to.equal(3); - expect(events[0].args._timesPerPeriod).to.deep.equal([ - ethers.constants.Zero, - ethers.constants.Zero, - ethers.constants.Zero, - ethers.constants.Zero, - ]); + expect(events[0].args._feeForJuror).to.equal(ethers.utils.parseUnits("0.1", 18)); + expect(events[0].args._jurorsForCourtJump).to.equal(256); + expect(events[0].args._timesPerPeriod).to.deep.equal([0, 0, 0, 10]); expect(events[0].args._supportedDisputeKits).to.deep.equal([]); events = await core.queryFilter(core.filters.DisputeKitEnabled()); @@ -56,7 +45,9 @@ describe("DisputeKitClassic", async () => { "Access not allowed: KlerosCore only." ); - const tx = await core.connect(deployer).functions["createDispute(uint256,bytes)"](2, "0x00", { value: 1000 }); + const tx = await core + .connect(deployer) + .functions["createDispute(uint256,bytes)"](2, "0x00", { value: ethers.utils.parseEther("0.3") }); expect(tx).to.emit(core, "DisputeCreation").withArgs(0, deployer.address); expect(tx).to.emit(disputeKit, "DisputeCreation").withArgs(0, 2, "0x00"); @@ -71,79 +62,11 @@ describe("DisputeKitClassic", async () => { }); async function deployContracts(deployer) { - const rngFactory = await ethers.getContractFactory("BlockHashRNG", deployer); - const rng = await rngFactory.deploy(); - await rng.deployed(); - - const disputeKitFactory = await ethers.getContractFactory("DisputeKitClassic", deployer); - const disputeKit = await disputeKitFactory.deploy( - deployer.address, - ethers.constants.AddressZero // KlerosCore is set later once it is deployed - ); - await disputeKit.deployed(); - let nonce; - nonce = await deployer.getTransactionCount(); - nonce += 3; // SortitionModule is upgradeable, it deploys an implementation and a proxy - const KlerosCoreAddress = getContractAddress(deployer.address, nonce); - - const sortitionModuleDeployment = await deployments.deploy("SortitionModule_DisputeKitClassic", { - contract: "SortitionModule", - from: deployer.address, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - execute: { - init: { - methodName: "initialize", - args: [deployer.address, KlerosCoreAddress, 120, 120, rng.address, LOOKAHEAD], // minStakingTime, maxFreezingTime - }, - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - log: true, - args: [], - }); - - const sortitionModule = await ethers.getContractAt("SortitionModule", sortitionModuleDeployment.address); - - const coreDeployment = await deployments.deploy("KlerosCore_DisputeKitClassic", { - contract: "KlerosCore", - from: deployer.address, - proxy: { - proxyContract: "UUPSProxy", - proxyArgs: ["{implementation}", "{data}"], - checkProxyAdmin: false, - checkABIConflict: false, - execute: { - init: { - methodName: "initialize", - args: [ - deployer.address, - ethers.constants.AddressZero, // should be an ERC20 - ethers.constants.AddressZero, // should be a Juror Prosecution module - disputeKit.address, - false, - [200, 10000, 100, 3], - [0, 0, 0, 0], - "0xfa", - sortitionModule.address, - ], - }, - onUpgrade: { - methodName: "governor", - args: [], - }, - }, - }, - args: [], - log: true, + await deployments.fixture(["Arbitration", "VeaMock"], { + fallbackToGlobal: true, + keepExistingDeployments: false, }); - const core = await ethers.getContractAt("KlerosCore", coreDeployment.address); - - await disputeKit.changeCore(core.address); - + const disputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic; + const core = (await ethers.getContract("KlerosCore")) as KlerosCore; return [core, disputeKit]; } diff --git a/cspell.json b/cspell.json index 1aa319e95..44aec852d 100644 --- a/cspell.json +++ b/cspell.json @@ -29,6 +29,7 @@ "ipfs", "kleros", "linguo", + "Numberish", "Pinakion", "Realitio", "repartitions", @@ -37,6 +38,7 @@ "uncommify", "Unslashed", "unstake", + "UUPS", "viem", "wagmi" ], From 44679271319bbe0d2a779a1ab42832d33e111403 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 13:39:40 +0100 Subject: [PATCH 11/16] feat: made more contracts upgradable, fixed state variable init, nonce arithmetics in deploy scripts --- contracts/deploy/00-home-chain-arbitrable.ts | 7 +-- contracts/deploy/00-home-chain-arbitration.ts | 14 ++--- .../deploy/01-foreign-gateway-on-ethereum.ts | 24 ++++---- .../deploy/01-foreign-gateway-on-gnosis.ts | 25 ++++---- .../deploy/02-home-gateway-to-ethereum.ts | 14 +++-- contracts/deploy/02-home-gateway-to-gnosis.ts | 14 +++-- contracts/deploy/03-vea-mock.ts | 48 +++++++++------- contracts/deploy/utils/deployUpgradable.ts | 6 +- .../arbitration/DisputeTemplateRegistry.sol | 57 ++++++++++++++++++- contracts/src/arbitration/KlerosCore.sol | 1 - contracts/src/arbitration/PolicyRegistry.sol | 20 ++++++- contracts/src/arbitration/SortitionModule.sol | 8 ++- contracts/src/gateway/ForeignGateway.sol | 31 ++++++++-- contracts/src/gateway/HomeGateway.sol | 50 +++++++++++----- contracts/src/rng/RandomizerRNG.sol | 16 +++++- contracts/test/integration/index.ts | 21 +++++-- 16 files changed, 251 insertions(+), 105 deletions(-) diff --git a/contracts/deploy/00-home-chain-arbitrable.ts b/contracts/deploy/00-home-chain-arbitrable.ts index 6370302b4..609cc4a6f 100644 --- a/contracts/deploy/00-home-chain-arbitrable.ts +++ b/contracts/deploy/00-home-chain-arbitrable.ts @@ -2,6 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; import { HomeChains, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { deployments, getNamedAccounts, getChainId } = hre; @@ -17,11 +18,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; // General court, 3 jurors const weth = await deployments.get("WETH"); - const disputeTemplateRegistry = await deploy("DisputeTemplateRegistry", { - from: deployer, - args: [], - log: true, - }); + const disputeTemplateRegistry = await deployUpgradable(hre, deployer, "DisputeTemplateRegistry", [deployer]); await deploy("ArbitrableExample", { from: deployer, diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index 2983d9f52..dbfa6f3a8 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -52,11 +52,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) randomizerByChain.set(HomeChains[HomeChains[chainId]], randomizerMock.address); } - await deploy("PolicyRegistry", { - from: deployer, - args: [deployer], - log: true, - }); + await deployUpgradable(hre, deployer, "PolicyRegistry", [deployer]); const randomizer = randomizerByChain.get(Number(await getChainId())) ?? AddressZero; const rng = await deployUpgradable(hre, deployer, "RandomizerRNG", [randomizer, deployer]); @@ -66,8 +62,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) let klerosCoreAddress = await deployments.getOrNull("KlerosCore").then((deployment) => deployment?.address); if (!klerosCoreAddress) { const nonce = await ethers.provider.getTransactionCount(deployer); - klerosCoreAddress = getContractAddress(deployer, nonce + 3); // Deploying an upgradeable version of SortitionModule requires 2 transactions instead of 1 (implementation then proxy) - console.log("calculated future KlerosCore address for nonce %d: %s", nonce, klerosCoreAddress); + klerosCoreAddress = getContractAddress(deployer, nonce + 3); // deployed on the 4th tx (nonce+3): SortitionModule Impl tx, SortitionModule Proxy tx, KlerosCore Impl tx, KlerosCore Proxy tx + console.log("calculated future KlerosCore address for nonce %d: %s", nonce + 3, klerosCoreAddress); } const sortitionModule = await deployUpgradable(hre, deployer, "SortitionModule", [ @@ -77,7 +73,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) 1800, // maxFreezingTime rng.address, RNG_LOOKAHEAD, - ]); + ]); // nonce (implementation), nonce+1 (proxy) const pnk = pnkByChain.get(chainId) ?? AddressZero; const dai = daiByChain.get(chainId) ?? AddressZero; @@ -95,7 +91,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K sortitionModule.address, - ]); + ]); // nonce+2 (implementation), nonce+3 (proxy) // execute DisputeKitClassic.changeCore() only if necessary const currentCore = await hre.ethers.getContractAt("DisputeKitClassic", disputeKit.address).then((dk) => dk.core()); diff --git a/contracts/deploy/01-foreign-gateway-on-ethereum.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts index 16a67ccb0..ad1a7b935 100644 --- a/contracts/deploy/01-foreign-gateway-on-ethereum.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -2,7 +2,8 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; -import { ForeignChains, HardhatChain, isSkipped } from "./utils"; +import { ForeignChains, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { ethers, deployments, getNamedAccounts, getChainId, config } = hre; @@ -24,7 +25,7 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme // TODO: use deterministic deployments const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); let nonce = await homeChainProvider.getTransactionCount(deployer); - nonce += 2; // HomeGatewayToEthereum deploy tx will the third tx after this on its home network, so we add two to the current nonce. + nonce += 1; // HomeGatewayToEthereum Proxy deploy tx will be the 2nd tx after this on its home network, so we add 1 to the current nonce. const homeGatewayAddress = getContractAddress(deployer, nonce); console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); @@ -33,13 +34,16 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const homeChainId = (await homeChainProvider.getNetwork()).chainId; const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); - await deploy("ForeignGatewayOnEthereum", { - from: deployer, - contract: "ForeignGateway", - args: [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], - gasLimit: 4000000, - log: true, - }); + await deployUpgradable( + hre, + deployer, + "ForeignGatewayOnEthereum", + [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], + { + contract: "ForeignGateway", + gasLimit: 4000000, + } + ); // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); @@ -47,7 +51,7 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme // TODO: set up the correct fees for the FORKING_COURT const courtId = await core.GENERAL_COURT(); const fee = (await core.courts(courtId)).feeForJuror; - await execute("ForeignGatewayOnGnosis", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); + await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); // TODO: set up the correct fees for the lower courts }; diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts index ec57be903..3d0e505f0 100644 --- a/contracts/deploy/01-foreign-gateway-on-gnosis.ts +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -4,6 +4,7 @@ import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; import { ForeignChains, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; const ONE_GWEI = parseUnits("1", "gwei"); @@ -26,9 +27,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme // Hack to predict the deployment address on the home chain. // TODO: use deterministic deployments const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); - const nonce = await homeChainProvider.getTransactionCount(deployer); - - // FIXME: this computed address is wrong for deploys to testnets, okay on Hardhat + let nonce = await homeChainProvider.getTransactionCount(deployer); + nonce += 1; // HomeGatewayToEthereum Proxy deploy tx will be the 2nd tx after this on its home network, so we add 1 to the current nonce. const homeGatewayAddress = getContractAddress(deployer, nonce); // HomeGateway deploy tx will be the next tx home network console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); @@ -37,14 +37,17 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const homeChainId = (await homeChainProvider.getNetwork()).chainId; const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); - await deploy("ForeignGatewayOnGnosis", { - from: deployer, - contract: "ForeignGateway", - args: [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], - log: true, - maxFeePerGas: ONE_GWEI, - maxPriorityFeePerGas: ONE_GWEI, - }); + await deployUpgradable( + hre, + deployer, + "ForeignGatewayOnGnosis", + [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], + { + contract: "ForeignGateway", + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + } + ); // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); diff --git a/contracts/deploy/02-home-gateway-to-ethereum.ts b/contracts/deploy/02-home-gateway-to-ethereum.ts index 596b3e1c6..a87c330a4 100644 --- a/contracts/deploy/02-home-gateway-to-ethereum.ts +++ b/contracts/deploy/02-home-gateway-to-ethereum.ts @@ -2,6 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { ethers } from "hardhat"; import { HardhatChain, HomeChains, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; // TODO: use deterministic deployments @@ -22,10 +23,11 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const foreignChainName = await hre.companionNetworks.foreignGoerli.deployments.getNetworkName(); console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); - await deploy("HomeGatewayToEthereum", { - from: deployer, - contract: "HomeGateway", - args: [ + await deployUpgradable( + hre, + deployer, + "HomeGatewayToEthereum", + [ deployer, klerosCore.address, veaInbox.address, @@ -33,8 +35,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) foreignGateway.address, ethers.constants.AddressZero, // feeToken is ETH ], - log: true, - }); // nonce+0 + { contract: "HomeGateway" } + ); // nonce+0 }; deployHomeGateway.tags = ["HomeGatewayToEthereum"]; diff --git a/contracts/deploy/02-home-gateway-to-gnosis.ts b/contracts/deploy/02-home-gateway-to-gnosis.ts index 5184007b5..b0bb70598 100644 --- a/contracts/deploy/02-home-gateway-to-gnosis.ts +++ b/contracts/deploy/02-home-gateway-to-gnosis.ts @@ -1,6 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { HardhatChain, HomeChains, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; // TODO: use deterministic deployments @@ -22,12 +23,13 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const foreignChainName = await hre.companionNetworks.foreignChiado.deployments.getNetworkName(); console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); - await deploy("HomeGatewayToGnosis", { - from: deployer, - contract: "HomeGateway", - args: [deployer, klerosCore.address, veaInbox.address, foreignChainId, foreignGateway.address, dai.address], - log: true, - }); // nonce+0 + await deployUpgradable( + hre, + deployer, + "HomeGatewayToGnosis", + [deployer, klerosCore.address, veaInbox.address, foreignChainId, foreignGateway.address, dai.address], + { contract: "HomeGateway" } + ); // nonce+0 }; deployHomeGateway.tags = ["HomeGatewayToGnosis"]; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index aef1fb400..1d652fdcf 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -4,6 +4,7 @@ import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; import { HardhatChain, isSkipped } from "./utils"; +import { deployUpgradable } from "./utils/deployUpgradable"; // TODO: use deterministic deployments @@ -23,23 +24,29 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) log: true, }); - const nonce = await ethers.provider.getTransactionCount(deployer); - const homeGatewayAddress = getContractAddress(deployer, nonce + 1); + let nonce = await ethers.provider.getTransactionCount(deployer); + nonce += 3; // deployed on the 4th tx (nonce+3): SortitionModule Impl tx, SortitionModule Proxy tx, KlerosCore Impl tx, KlerosCore Proxy tx + const homeGatewayAddress = getContractAddress(deployer, nonce); console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); const homeChainIdAsBytes32 = hexZeroPad(hexlify(HardhatChain.HARDHAT), 32); - const foreignGateway = await deploy("ForeignGatewayOnEthereum", { - from: deployer, - contract: "ForeignGateway", - args: [deployer, vea.address, homeChainIdAsBytes32, homeGatewayAddress], - gasLimit: 4000000, - log: true, - }); // nonce+0 + const foreignGateway = await deployUpgradable( + hre, + deployer, + "ForeignGatewayOnEthereum", + [deployer, vea.address, homeChainIdAsBytes32, homeGatewayAddress], + { + contract: "ForeignGateway", + gasLimit: 4000000, + } + ); // nonce (implementation), nonce+1 (proxy) + console.log("foreignGateway.address: ", foreignGateway.address); - await deploy("HomeGatewayToEthereum", { - from: deployer, - contract: "HomeGateway", - args: [ + await deployUpgradable( + hre, + deployer, + "HomeGatewayToEthereum", + [ deployer, klerosCore.address, vea.address, @@ -47,9 +54,12 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) foreignGateway.address, ethers.constants.AddressZero, // feeToken ], - gasLimit: 4000000, - log: true, - }); // nonce+1 + { + contract: "HomeGateway", + gasLimit: 4000000, + log: true, + } + ); // nonce+2 (implementation), nonce+3 (proxy) // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const signer = (await hre.ethers.getSigners())[0]; @@ -60,11 +70,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); // TODO: set up the correct fees for the lower courts - const disputeTemplateRegistry = await deploy("DisputeTemplateRegistry", { - from: deployer, - args: [], - log: true, - }); + const disputeTemplateRegistry = await deployUpgradable(hre, deployer, "DisputeTemplateRegistry", [deployer]); // TODO: debug why this extraData fails but "0x00" works // const extraData = diff --git a/contracts/deploy/utils/deployUpgradable.ts b/contracts/deploy/utils/deployUpgradable.ts index 3402f18c2..f2e391f71 100644 --- a/contracts/deploy/utils/deployUpgradable.ts +++ b/contracts/deploy/utils/deployUpgradable.ts @@ -1,11 +1,12 @@ -import { DeployResult } from "hardhat-deploy/types"; +import { DeployResult, DeployOptions } from "hardhat-deploy/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; export function deployUpgradable( hre: HardhatRuntimeEnvironment, deployer: string, contract: string, - params: any[] + params: any[], + deployOptions?: Omit ): Promise { const { deploy } = hre.deployments; return deploy(contract, { @@ -27,5 +28,6 @@ export function deployUpgradable( }, }, log: true, + ...deployOptions, }); } diff --git a/contracts/src/arbitration/DisputeTemplateRegistry.sol b/contracts/src/arbitration/DisputeTemplateRegistry.sol index 269449cbb..0d2b9d16f 100644 --- a/contracts/src/arbitration/DisputeTemplateRegistry.sol +++ b/contracts/src/arbitration/DisputeTemplateRegistry.sol @@ -1,17 +1,70 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.18; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; import "./interfaces/IDisputeTemplateRegistry.sol"; /// @title Dispute Template Registry /// @dev A contract to maintain a registry of dispute templates. -contract DisputeTemplateRegistry is IDisputeTemplateRegistry { - uint256 public templates; +contract DisputeTemplateRegistry is IDisputeTemplateRegistry, UUPSProxiable, Initializable { + // ************************************* // + // * Storage * // + // ************************************* // + + address public governor; // The address that can withdraw funds. + uint256 public templates; // The number of templates. + + // ************************************* // + // * Function Modifiers * // + // ************************************* // + + modifier onlyByGovernor() { + require(governor == msg.sender, "Governor only"); + _; + } + + // ************************************* // + // * Constructor * // + // ************************************* // + + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Initializer + /// @param _governor Governor of the contract. + function initialize(address _governor) external reinitializer(1) { + governor = _governor; + } + + // ************************ // + // * Governance * // + // ************************ // + + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + + /// @dev Changes the governor of the contract. + /// @param _governor The new governor. + function changeGovernor(address _governor) external onlyByGovernor { + governor = _governor; + } // ************************************* // // * State Modifiers * // // ************************************* // + /// @dev Registers a new dispute template. + /// @param _templateTag The tag of the template (optional). + /// @param _templateData The data of the template. + /// @param _templateDataMappings The data mappings of the template. function setDisputeTemplate( string memory _templateTag, string memory _templateData, diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 76e46913d..6db9c45b7 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -116,7 +116,6 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { address public governor; // The governor of the contract. IERC20 public pinakion; // The Pinakion token contract. - // TODO: interactions with jurorProsecutionModule. address public jurorProsecutionModule; // The module for juror's prosecution. ISortitionModule public sortitionModule; // Sortition module for drawing. Court[] public courts; // The courts. diff --git a/contracts/src/arbitration/PolicyRegistry.sol b/contracts/src/arbitration/PolicyRegistry.sol index c5521e3b5..6271f200e 100644 --- a/contracts/src/arbitration/PolicyRegistry.sol +++ b/contracts/src/arbitration/PolicyRegistry.sol @@ -1,9 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.18; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; + /// @title PolicyRegistry /// @dev A contract to maintain a policy for each court. -contract PolicyRegistry { +contract PolicyRegistry is UUPSProxiable, Initializable { // ************************************* // // * Events * // // ************************************* // @@ -35,9 +38,14 @@ contract PolicyRegistry { // * Constructor * // // ************************************* // + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + /// @dev Constructs the `PolicyRegistry` contract. /// @param _governor The governor's address. - constructor(address _governor) { + function initialize(address _governor) external reinitializer(1) { governor = _governor; } @@ -45,6 +53,14 @@ contract PolicyRegistry { // * Governance * // // ************************************* // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + /// @dev Changes the `governor` storage variable. /// @param _governor The new value for the `governor` storage variable. function changeGovernor(address _governor) external onlyByGovernor { diff --git a/contracts/src/arbitration/SortitionModule.sol b/contracts/src/arbitration/SortitionModule.sol index 53e5bb179..d7c411855 100644 --- a/contracts/src/arbitration/SortitionModule.sol +++ b/contracts/src/arbitration/SortitionModule.sol @@ -59,7 +59,7 @@ contract SortitionModule is ISortitionModule, UUPSProxiable, Initializable { uint256 public randomNumber; // Random number returned by RNG. uint256 public rngLookahead; // Minimal block distance between requesting and obtaining a random number. uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped. - uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped. + uint256 public delayedStakeReadIndex; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped. mapping(bytes32 => SortitionSumTree) sortitionSumTrees; // The mapping trees by keys. mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Drawing phase, to update them when the phase is switched to Staking. @@ -107,6 +107,7 @@ contract SortitionModule is ISortitionModule, UUPSProxiable, Initializable { lastPhaseChange = block.timestamp; rng = _rng; rngLookahead = _rngLookahead; + delayedStakeReadIndex = 1; } // ************************************* // @@ -117,8 +118,9 @@ contract SortitionModule is ISortitionModule, UUPSProxiable, Initializable { * @dev Access Control to perform implementation upgrades (UUPS Proxiable) * @dev Only the governor can perform upgrades (`onlyByGovernor`) */ - - function _authorizeUpgrade(address) internal view override onlyByGovernor {} + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } /// @dev Changes the `minStakingTime` storage variable. /// @param _minStakingTime The new value for the `minStakingTime` storage variable. diff --git a/contracts/src/gateway/ForeignGateway.sol b/contracts/src/gateway/ForeignGateway.sol index eca0aef52..6e121b330 100644 --- a/contracts/src/gateway/ForeignGateway.sol +++ b/contracts/src/gateway/ForeignGateway.sol @@ -9,10 +9,12 @@ pragma solidity 0.8.18; import "./interfaces/IForeignGateway.sol"; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; /// Foreign Gateway /// Counterpart of `HomeGateway` -contract ForeignGateway is IForeignGateway { +contract ForeignGateway is IForeignGateway, UUPSProxiable, Initializable { // ************************************* // // * Enums / Structs * // // ************************************* // @@ -36,11 +38,11 @@ contract ForeignGateway is IForeignGateway { // ************************************* // uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute. - uint256 internal localDisputeID = 1; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero. + uint256 internal localDisputeID; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero. mapping(uint96 => uint256) public feeForJuror; // feeForJuror[v2CourtID], it mirrors the value on KlerosCore. address public governor; address public veaOutbox; - uint256 public immutable override homeChainID; + uint256 public override homeChainID; address public override homeGateway; address public deprecatedVeaOutbox; uint256 public deprecatedVeaOutboxExpiration; @@ -69,17 +71,38 @@ contract ForeignGateway is IForeignGateway { // * Constructor * // // ************************************* // - constructor(address _governor, address _veaOutbox, uint256 _homeChainID, address _homeGateway) { + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Constructs the `PolicyRegistry` contract. + /// @param _governor The governor's address. + function initialize( + address _governor, + address _veaOutbox, + uint256 _homeChainID, + address _homeGateway + ) external reinitializer(1) { governor = _governor; veaOutbox = _veaOutbox; homeChainID = _homeChainID; homeGateway = _homeGateway; + localDisputeID = 1; } // ************************************* // // * Governance * // // ************************************* // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + /// @dev Changes the governor. /// @param _governor The address of the new governor. function changeGovernor(address _governor) external { diff --git a/contracts/src/gateway/HomeGateway.sol b/contracts/src/gateway/HomeGateway.sol index 53b31f491..86ef0d58c 100644 --- a/contracts/src/gateway/HomeGateway.sol +++ b/contracts/src/gateway/HomeGateway.sol @@ -11,10 +11,12 @@ pragma solidity 0.8.18; import "./interfaces/IForeignGateway.sol"; import "./interfaces/IHomeGateway.sol"; import "../libraries/SafeERC20.sol"; +import "../proxy/UUPSProxiable.sol"; +import "../proxy/Initializable.sol"; /// Home Gateway /// Counterpart of `ForeignGateway` -contract HomeGateway is IHomeGateway { +contract HomeGateway is IHomeGateway, UUPSProxiable, Initializable { using SafeERC20 for IERC20; // ************************************* // @@ -34,25 +36,42 @@ contract HomeGateway is IHomeGateway { address public governor; IArbitratorV2 public arbitrator; IVeaInbox public veaInbox; - uint256 public immutable override foreignChainID; + uint256 public override foreignChainID; address public override foreignGateway; IERC20 public feeToken; mapping(uint256 => bytes32) public disputeIDtoHash; mapping(bytes32 => uint256) public disputeHashtoID; mapping(bytes32 => RelayedData) public disputeHashtoRelayedData; + // ************************************* // + // * Function Modifiers * // + // ************************************* // + + /// @dev Requires that the sender is the governor. + modifier onlyByGovernor() { + require(governor == msg.sender, "No allowed: governor only"); + _; + } + // ************************************* // // * Constructor * // // ************************************* // - constructor( + /// @dev Constructor, initializing the implementation to reduce attack surface. + constructor() { + _disableInitializers(); + } + + /// @dev Constructs the `PolicyRegistry` contract. + /// @param _governor The governor's address. + function initialize( address _governor, IArbitratorV2 _arbitrator, IVeaInbox _veaInbox, uint256 _foreignChainID, address _foreignGateway, IERC20 _feeToken - ) { + ) external reinitializer(1) { governor = _governor; arbitrator = _arbitrator; veaInbox = _veaInbox; @@ -65,38 +84,41 @@ contract HomeGateway is IHomeGateway { // * Governance * // // ************************************* // + /** + * @dev Access Control to perform implementation upgrades (UUPS Proxiable) + * @dev Only the governor can perform upgrades (`onlyByGovernor`) + */ + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + /// @dev Changes the governor. /// @param _governor The address of the new governor. - function changeGovernor(address _governor) external { - require(governor == msg.sender, "Access not allowed: Governor only."); + function changeGovernor(address _governor) external onlyByGovernor { governor = _governor; } /// @dev Changes the arbitrator. /// @param _arbitrator The address of the new arbitrator. - function changeArbitrator(IArbitratorV2 _arbitrator) external { - require(governor == msg.sender, "Access not allowed: Governor only."); + function changeArbitrator(IArbitratorV2 _arbitrator) external onlyByGovernor { arbitrator = _arbitrator; } /// @dev Changes the vea inbox, useful to increase the claim deposit. /// @param _veaInbox The address of the new vea inbox. - function changeVea(IVeaInbox _veaInbox) external { - require(governor == msg.sender, "Access not allowed: Governor only."); + function changeVea(IVeaInbox _veaInbox) external onlyByGovernor { veaInbox = _veaInbox; } /// @dev Changes the foreign gateway. /// @param _foreignGateway The address of the new foreign gateway. - function changeForeignGateway(address _foreignGateway) external { - require(governor == msg.sender, "Access not allowed: Governor only."); + function changeForeignGateway(address _foreignGateway) external onlyByGovernor { foreignGateway = _foreignGateway; } /// @dev Changes the fee token. /// @param _feeToken The address of the new fee token. - function changeFeeToken(IERC20 _feeToken) external { - require(governor == msg.sender, "Access not allowed: Governor only."); + function changeFeeToken(IERC20 _feeToken) external onlyByGovernor { feeToken = _feeToken; } diff --git a/contracts/src/rng/RandomizerRNG.sol b/contracts/src/rng/RandomizerRNG.sol index 30fef82f5..41dc072f7 100644 --- a/contracts/src/rng/RandomizerRNG.sol +++ b/contracts/src/rng/RandomizerRNG.sol @@ -10,9 +10,12 @@ import "../proxy/Initializable.sol"; /// @title Random Number Generator that uses Randomizer.ai /// https://randomizer.ai/ contract RandomizerRNG is RNG, UUPSProxiable, Initializable { - address public governor; // The address that can withdraw funds. - uint256 public callbackGasLimit = 50000; // Gas limit for the randomizer callback + // ************************************* // + // * Storage * // + // ************************************* // + address public governor; // The address that can withdraw funds. + uint256 public callbackGasLimit; // Gas limit for the randomizer callback IRandomizer public randomizer; // Randomizer address. mapping(uint256 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise. mapping(address => uint256) public requesterToID; // Maps the requester to his latest request ID. @@ -26,6 +29,10 @@ contract RandomizerRNG is RNG, UUPSProxiable, Initializable { _; } + // ************************************* // + // * Constructor * // + // ************************************* // + /// @dev Constructor, initializing the implementation to reduce attack surface. constructor() { _disableInitializers(); @@ -37,6 +44,7 @@ contract RandomizerRNG is RNG, UUPSProxiable, Initializable { function initialize(IRandomizer _randomizer, address _governor) external reinitializer(1) { randomizer = _randomizer; governor = _governor; + callbackGasLimit = 50000; } // ************************ // @@ -47,7 +55,9 @@ contract RandomizerRNG is RNG, UUPSProxiable, Initializable { * @dev Access Control to perform implementation upgrades (UUPS Proxiable) * @dev Only the governor can perform upgrades (`onlyByGovernor`) */ - function _authorizeUpgrade(address) internal view override onlyByGovernor {} + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } /// @dev Changes the governor of the contract. /// @param _governor The new governor. diff --git a/contracts/test/integration/index.ts b/contracts/test/integration/index.ts index e04d39fa5..fecfe54f2 100644 --- a/contracts/test/integration/index.ts +++ b/contracts/test/integration/index.ts @@ -1,3 +1,4 @@ +import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs"; import { expect } from "chai"; import { deployments, ethers, getNamedAccounts, network } from "hardhat"; import { BigNumber } from "ethers"; @@ -13,7 +14,6 @@ import { RandomizerMock, SortitionModule, } from "../../typechain-types"; -import { keccak256 } from "ethers/lib/utils"; /* eslint-disable no-unused-vars */ /* eslint-disable no-unused-expressions */ // https://github.com/standard/standard/issues/690#issuecomment-278533482 @@ -97,17 +97,26 @@ describe("Integration tests", async () => { }); const trace = await network.provider.send("debug_traceTransaction", [tx.hash]); const [disputeId] = ethers.utils.defaultAbiCoder.decode(["uint"], `0x${trace.returnValue}`); // get returned value from createDispute() - console.log("Dispute Created"); - expect(tx).to.emit(foreignGateway, "DisputeCreation"); - expect(tx).to.emit(foreignGateway, "OutgoingDispute"); - console.log(`disputeId: ${disputeId}`); + console.log("Dispute Created with disputeId: %d", disputeId); + await expect(tx) + .to.emit(foreignGateway, "CrossChainDisputeOutgoing") + .withArgs(anyValue, arbitrable.address, 1, 2, "0x00"); + await expect(tx) + .to.emit(arbitrable, "DisputeRequest") + .withArgs( + foreignGateway.address, + 1, + BigNumber.from("46619385602526556702049273755915206310773794210139929511467397410441395547901"), + 0, + "" + ); const lastBlock = await ethers.provider.getBlock(tx.blockNumber - 1); const disputeHash = ethers.utils.solidityKeccak256( ["bytes", "bytes32", "uint256", "address", "uint256", "uint256", "bytes"], [ethers.utils.toUtf8Bytes("createDispute"), lastBlock.hash, 31337, arbitrable.address, disputeId, 2, "0x00"] ); - const events = (await tx.wait()).events; + console.log("dispute hash: ", disputeHash); // Relayer tx const tx2 = await homeGateway From c5104cb149b298512825c5408c259bf36bae09c4 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 14:02:38 +0100 Subject: [PATCH 12/16] refactor: made deployUpgradable() signature consistent with deploy() --- contracts/deploy/00-home-chain-arbitrable.ts | 6 +- contracts/deploy/00-home-chain-arbitration.ts | 56 +++++++++++-------- .../deploy/01-foreign-gateway-on-ethereum.ts | 17 +++--- .../deploy/01-foreign-gateway-on-gnosis.ts | 19 +++---- .../deploy/02-home-gateway-to-ethereum.ts | 13 ++--- contracts/deploy/02-home-gateway-to-gnosis.ts | 13 ++--- contracts/deploy/03-vea-mock.ts | 41 +++++++------- contracts/deploy/upgrade-kleros-core.ts | 25 +++++---- contracts/deploy/upgrade-sortition-module.ts | 19 ++++--- contracts/deploy/utils/deployUpgradable.ts | 11 ++-- 10 files changed, 114 insertions(+), 106 deletions(-) diff --git a/contracts/deploy/00-home-chain-arbitrable.ts b/contracts/deploy/00-home-chain-arbitrable.ts index 609cc4a6f..25f44f8ca 100644 --- a/contracts/deploy/00-home-chain-arbitrable.ts +++ b/contracts/deploy/00-home-chain-arbitrable.ts @@ -18,7 +18,11 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; // General court, 3 jurors const weth = await deployments.get("WETH"); - const disputeTemplateRegistry = await deployUpgradable(hre, deployer, "DisputeTemplateRegistry", [deployer]); + const disputeTemplateRegistry = await deployUpgradable(hre, "DisputeTemplateRegistry", { + from: deployer, + args: [deployer], + log: true, + }); await deploy("ArbitrableExample", { from: deployer, diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index dbfa6f3a8..97053d463 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -52,12 +52,16 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) randomizerByChain.set(HomeChains[HomeChains[chainId]], randomizerMock.address); } - await deployUpgradable(hre, deployer, "PolicyRegistry", [deployer]); + await deployUpgradable(hre, "PolicyRegistry", { from: deployer, args: [deployer], log: true }); const randomizer = randomizerByChain.get(Number(await getChainId())) ?? AddressZero; - const rng = await deployUpgradable(hre, deployer, "RandomizerRNG", [randomizer, deployer]); + const rng = await deployUpgradable(hre, "RandomizerRNG", { from: deployer, args: [randomizer, deployer], log: true }); - const disputeKit = await deployUpgradable(hre, deployer, "DisputeKitClassic", [deployer, AddressZero]); + const disputeKit = await deployUpgradable(hre, "DisputeKitClassic", { + from: deployer, + args: [deployer, AddressZero], + log: true, + }); let klerosCoreAddress = await deployments.getOrNull("KlerosCore").then((deployment) => deployment?.address); if (!klerosCoreAddress) { @@ -66,14 +70,18 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.log("calculated future KlerosCore address for nonce %d: %s", nonce + 3, klerosCoreAddress); } - const sortitionModule = await deployUpgradable(hre, deployer, "SortitionModule", [ - deployer, - klerosCoreAddress, - 1800, // minStakingTime - 1800, // maxFreezingTime - rng.address, - RNG_LOOKAHEAD, - ]); // nonce (implementation), nonce+1 (proxy) + const sortitionModule = await deployUpgradable(hre, "SortitionModule", { + from: deployer, + args: [ + deployer, + klerosCoreAddress, + 1800, // minStakingTime + 1800, // maxFreezingTime + rng.address, + RNG_LOOKAHEAD, + ], + log: true, + }); // nonce (implementation), nonce+1 (proxy) const pnk = pnkByChain.get(chainId) ?? AddressZero; const dai = daiByChain.get(chainId) ?? AddressZero; @@ -81,17 +89,21 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const minStake = BigNumber.from(10).pow(20).mul(2); const alpha = 10000; const feeForJuror = BigNumber.from(10).pow(17); - const klerosCore = await deployUpgradable(hre, deployer, "KlerosCore", [ - deployer, - pnk, - AddressZero, - disputeKit.address, - false, - [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump - [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K - sortitionModule.address, - ]); // nonce+2 (implementation), nonce+3 (proxy) + const klerosCore = await deployUpgradable(hre, "KlerosCore", { + from: deployer, + args: [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModule.address, + ], + log: true, + }); // nonce+2 (implementation), nonce+3 (proxy) // execute DisputeKitClassic.changeCore() only if necessary const currentCore = await hre.ethers.getContractAt("DisputeKitClassic", disputeKit.address).then((dk) => dk.core()); diff --git a/contracts/deploy/01-foreign-gateway-on-ethereum.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts index ad1a7b935..6f8d8a812 100644 --- a/contracts/deploy/01-foreign-gateway-on-ethereum.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -34,16 +34,13 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const homeChainId = (await homeChainProvider.getNetwork()).chainId; const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); - await deployUpgradable( - hre, - deployer, - "ForeignGatewayOnEthereum", - [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], - { - contract: "ForeignGateway", - gasLimit: 4000000, - } - ); + await deployUpgradable(hre, "ForeignGatewayOnEthereum", { + from: deployer, + contract: "ForeignGateway", + args: [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], + gasLimit: 4000000, + log: true, + }); // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts index 3d0e505f0..0765eea98 100644 --- a/contracts/deploy/01-foreign-gateway-on-gnosis.ts +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -37,17 +37,14 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const homeChainId = (await homeChainProvider.getNetwork()).chainId; const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); - await deployUpgradable( - hre, - deployer, - "ForeignGatewayOnGnosis", - [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], - { - contract: "ForeignGateway", - maxFeePerGas: ONE_GWEI, - maxPriorityFeePerGas: ONE_GWEI, - } - ); + await deployUpgradable(hre, "ForeignGatewayOnGnosis", { + from: deployer, + contract: "ForeignGateway", + args: [deployer, veaOutbox.address, homeChainIdAsBytes32, homeGatewayAddress], + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + log: true, + }); // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); diff --git a/contracts/deploy/02-home-gateway-to-ethereum.ts b/contracts/deploy/02-home-gateway-to-ethereum.ts index a87c330a4..6a9bd57b3 100644 --- a/contracts/deploy/02-home-gateway-to-ethereum.ts +++ b/contracts/deploy/02-home-gateway-to-ethereum.ts @@ -23,11 +23,10 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const foreignChainName = await hre.companionNetworks.foreignGoerli.deployments.getNetworkName(); console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); - await deployUpgradable( - hre, - deployer, - "HomeGatewayToEthereum", - [ + await deployUpgradable(hre, "HomeGatewayToEthereum", { + from: deployer, + contract: "HomeGateway", + args: [ deployer, klerosCore.address, veaInbox.address, @@ -35,8 +34,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) foreignGateway.address, ethers.constants.AddressZero, // feeToken is ETH ], - { contract: "HomeGateway" } - ); // nonce+0 + log: true, + }); // nonce+0 }; deployHomeGateway.tags = ["HomeGatewayToEthereum"]; diff --git a/contracts/deploy/02-home-gateway-to-gnosis.ts b/contracts/deploy/02-home-gateway-to-gnosis.ts index b0bb70598..b6d89108e 100644 --- a/contracts/deploy/02-home-gateway-to-gnosis.ts +++ b/contracts/deploy/02-home-gateway-to-gnosis.ts @@ -23,13 +23,12 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const foreignChainName = await hre.companionNetworks.foreignChiado.deployments.getNetworkName(); console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); - await deployUpgradable( - hre, - deployer, - "HomeGatewayToGnosis", - [deployer, klerosCore.address, veaInbox.address, foreignChainId, foreignGateway.address, dai.address], - { contract: "HomeGateway" } - ); // nonce+0 + await deployUpgradable(hre, "HomeGatewayToGnosis", { + from: deployer, + contract: "HomeGateway", + args: [deployer, klerosCore.address, veaInbox.address, foreignChainId, foreignGateway.address, dai.address], + log: true, + }); // nonce+0 }; deployHomeGateway.tags = ["HomeGatewayToGnosis"]; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index 1d652fdcf..7e2e439ec 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -30,23 +30,19 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); const homeChainIdAsBytes32 = hexZeroPad(hexlify(HardhatChain.HARDHAT), 32); - const foreignGateway = await deployUpgradable( - hre, - deployer, - "ForeignGatewayOnEthereum", - [deployer, vea.address, homeChainIdAsBytes32, homeGatewayAddress], - { - contract: "ForeignGateway", - gasLimit: 4000000, - } - ); // nonce (implementation), nonce+1 (proxy) + const foreignGateway = await deployUpgradable(hre, "ForeignGatewayOnEthereum", { + from: deployer, + contract: "ForeignGateway", + args: [deployer, vea.address, homeChainIdAsBytes32, homeGatewayAddress], + gasLimit: 4000000, + log: true, + }); // nonce (implementation), nonce+1 (proxy) console.log("foreignGateway.address: ", foreignGateway.address); - await deployUpgradable( - hre, - deployer, - "HomeGatewayToEthereum", - [ + await deployUpgradable(hre, "HomeGatewayToEthereum", { + from: deployer, + contract: "HomeGateway", + args: [ deployer, klerosCore.address, vea.address, @@ -54,12 +50,9 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) foreignGateway.address, ethers.constants.AddressZero, // feeToken ], - { - contract: "HomeGateway", - gasLimit: 4000000, - log: true, - } - ); // nonce+2 (implementation), nonce+3 (proxy) + gasLimit: 4000000, + log: true, + }); // nonce+2 (implementation), nonce+3 (proxy) // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. const signer = (await hre.ethers.getSigners())[0]; @@ -70,7 +63,11 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); // TODO: set up the correct fees for the lower courts - const disputeTemplateRegistry = await deployUpgradable(hre, deployer, "DisputeTemplateRegistry", [deployer]); + const disputeTemplateRegistry = await deployUpgradable(hre, "DisputeTemplateRegistry", { + from: deployer, + args: [deployer], + log: true, + }); // TODO: debug why this extraData fails but "0x00" works // const extraData = diff --git a/contracts/deploy/upgrade-kleros-core.ts b/contracts/deploy/upgrade-kleros-core.ts index bd1cc1259..ed8a3357a 100644 --- a/contracts/deploy/upgrade-kleros-core.ts +++ b/contracts/deploy/upgrade-kleros-core.ts @@ -28,17 +28,20 @@ const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnviro const sortitionModule = await deployments.get("SortitionModule"); console.log("Upgrading the KlerosCore..."); - await deployUpgradable(hre, deployer, "KlerosCore", [ - deployer, - pnk, - AddressZero, - disputeKit.address, - false, - [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump - [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K - sortitionModule.address, - ]); + await deployUpgradable(hre, "KlerosCore", { + from: deployer, + args: [ + deployer, + pnk, + AddressZero, + disputeKit.address, + false, + [minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + ethers.utils.hexlify(5), // Extra data for sortition module will return the default value of K + sortitionModule.address, + ], + }); } catch (err) { console.error(err); throw err; diff --git a/contracts/deploy/upgrade-sortition-module.ts b/contracts/deploy/upgrade-sortition-module.ts index e431b78f9..3e2498ac0 100644 --- a/contracts/deploy/upgrade-sortition-module.ts +++ b/contracts/deploy/upgrade-sortition-module.ts @@ -24,14 +24,17 @@ const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeE const klerosCoreAddress = klerosCore.address; console.log("Upgrading the SortitionModule..."); - await deployUpgradable(hre, deployer, "SortitionModule", [ - deployer, - klerosCoreAddress, - 1800, // minStakingTime - 1800, // maxFreezingTime - rng.address, - RNG_LOOKAHEAD, - ]); + await deployUpgradable(hre, "SortitionModule", { + from: deployer, + args: [ + deployer, + klerosCoreAddress, + 1800, // minStakingTime + 1800, // maxFreezingTime + rng.address, + RNG_LOOKAHEAD, + ], + }); } catch (err) { console.error(err); throw err; diff --git a/contracts/deploy/utils/deployUpgradable.ts b/contracts/deploy/utils/deployUpgradable.ts index f2e391f71..2a5f4ec92 100644 --- a/contracts/deploy/utils/deployUpgradable.ts +++ b/contracts/deploy/utils/deployUpgradable.ts @@ -3,14 +3,12 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; export function deployUpgradable( hre: HardhatRuntimeEnvironment, - deployer: string, contract: string, - params: any[], - deployOptions?: Omit + options: DeployOptions ): Promise { const { deploy } = hre.deployments; + const { args, ...otherOptions } = options; return deploy(contract, { - from: deployer, proxy: { proxyContract: "UUPSProxy", proxyArgs: ["{implementation}", "{data}"], @@ -19,7 +17,7 @@ export function deployUpgradable( execute: { init: { methodName: "initialize", - args: params, + args: args ?? [], }, onUpgrade: { methodName: "governor", @@ -27,7 +25,6 @@ export function deployUpgradable( }, }, }, - log: true, - ...deployOptions, + ...otherOptions, }); } From 0a1642ffe368b5c042432312f0a0a036aee9a6a6 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 15:17:08 +0100 Subject: [PATCH 13/16] chore: markdown generation for upgradable contracts --- contracts/scripts/generateDeploymentsMarkdown.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contracts/scripts/generateDeploymentsMarkdown.sh b/contracts/scripts/generateDeploymentsMarkdown.sh index e26b978db..7c73b0217 100755 --- a/contracts/scripts/generateDeploymentsMarkdown.sh +++ b/contracts/scripts/generateDeploymentsMarkdown.sh @@ -5,10 +5,16 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" function generate() { #deploymentDir #explorerUrl deploymentDir=$1 explorerUrl=$2 - for f in $(ls -1 $deploymentDir/*.json 2>/dev/null | grep -v "PNK.json\|MetaEvidence_*\|CREATE3Factory.json" | sort); do + for f in $(ls -1 $deploymentDir/*.json 2>/dev/null | grep -v "PNK.json\|MetaEvidence_*\|CREATE3Factory.json\|_Proxy.json\|_Implementation.json" | sort); do contractName=$(basename $f .json) address=$(cat $f | jq -r .address) - echo "- [$contractName]($explorerUrl$address)" + implementation=$(cat $f | jq -r .implementation) + + if [ "$implementation" != "null" ]; then + echo "- [$contractName: proxy]($explorerUrl$address), [implementation]($explorerUrl$implementation)" + else + echo "- [$contractName]($explorerUrl$address)" + fi done } From 76763b61d545ced7570765c668c8054407ac0cea Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 16:56:02 +0100 Subject: [PATCH 14/16] refactor: extracted some constants, tweaked contract size optimizations --- .../deploy/01-foreign-gateway-on-ethereum.ts | 7 +- .../deploy/01-foreign-gateway-on-gnosis.ts | 7 +- contracts/deploy/03-vea-mock.ts | 7 +- contracts/deploy/utils/index.ts | 5 + contracts/src/arbitration/KlerosCore.sol | 105 ++++++++---------- contracts/src/arbitration/SortitionModule.sol | 3 +- contracts/src/libraries/Constants.sol | 17 +++ contracts/test/arbitration/draw.ts | 6 +- 8 files changed, 82 insertions(+), 75 deletions(-) create mode 100644 contracts/src/libraries/Constants.sol diff --git a/contracts/deploy/01-foreign-gateway-on-ethereum.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts index 6f8d8a812..7c7e2ca7d 100644 --- a/contracts/deploy/01-foreign-gateway-on-ethereum.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; -import { ForeignChains, isSkipped } from "./utils"; +import { Courts, ForeignChains, isSkipped } from "./utils"; import { deployUpgradable } from "./utils/deployUpgradable"; const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { @@ -46,9 +46,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); const core = await KlerosCore__factory.connect(coreDeployment.address, homeChainProvider); // TODO: set up the correct fees for the FORKING_COURT - const courtId = await core.GENERAL_COURT(); - const fee = (await core.courts(courtId)).feeForJuror; - await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); + const fee = (await core.courts(Courts.GENERAL)).feeForJuror; + await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", Courts.GENERAL, fee); // TODO: set up the correct fees for the lower courts }; diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts index 0765eea98..5f52d7d54 100644 --- a/contracts/deploy/01-foreign-gateway-on-gnosis.ts +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -3,7 +3,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; -import { ForeignChains, isSkipped } from "./utils"; +import { Courts, ForeignChains, isSkipped } from "./utils"; import { deployUpgradable } from "./utils/deployUpgradable"; const ONE_GWEI = parseUnits("1", "gwei"); @@ -50,9 +50,8 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore"); const core = await KlerosCore__factory.connect(coreDeployment.address, homeChainProvider); // TODO: set up the correct fees for the FORKING_COURT - const courtId = await core.GENERAL_COURT(); - const fee = (await core.courts(courtId)).feeForJuror; - await execute("ForeignGatewayOnGnosis", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); + const fee = (await core.courts(Courts.GENERAL)).feeForJuror; + await execute("ForeignGatewayOnGnosis", { from: deployer, log: true }, "changeCourtJurorFee", Courts.GENERAL, fee); // TODO: set up the correct fees for the lower courts }; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index 7e2e439ec..0071cef6f 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -3,7 +3,7 @@ import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; import disputeTemplate from "../test/fixtures/DisputeTemplate.simple.json"; -import { HardhatChain, isSkipped } from "./utils"; +import { Courts, HardhatChain, isSkipped } from "./utils"; import { deployUpgradable } from "./utils/deployUpgradable"; // TODO: use deterministic deployments @@ -58,9 +58,8 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const signer = (await hre.ethers.getSigners())[0]; const core = await KlerosCore__factory.connect(klerosCore.address, signer); // TODO: set up the correct fees for the FORKING_COURT - const courtId = await core.GENERAL_COURT(); - const fee = (await core.courts(courtId)).feeForJuror; - await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); + const fee = (await core.courts(Courts.GENERAL)).feeForJuror; + await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", Courts.GENERAL, fee); // TODO: set up the correct fees for the lower courts const disputeTemplateRegistry = await deployUpgradable(hre, "DisputeTemplateRegistry", { diff --git a/contracts/deploy/utils/index.ts b/contracts/deploy/utils/index.ts index 2c5cfdd8c..1f08da3b3 100644 --- a/contracts/deploy/utils/index.ts +++ b/contracts/deploy/utils/index.ts @@ -20,6 +20,11 @@ export enum ForeignChains { HARDHAT = HardhatChain.HARDHAT, } +export enum Courts { + FORKING = 0, + GENERAL = 1, +} + export const isSkipped = async (network: Network, skip: boolean) => { if (skip) { console.error(`Error: incompatible network ${network.name} for this deployment script`); diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 6db9c45b7..3b9e12fe3 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -12,6 +12,7 @@ import {IArbitrableV2, IArbitratorV2} from "./interfaces/IArbitratorV2.sol"; import "./interfaces/IDisputeKit.sol"; import "./interfaces/ISortitionModule.sol"; import "../libraries/SafeERC20.sol"; +import "../libraries/Constants.sol"; import "../proxy/UUPSProxiable.sol"; import "../proxy/Initializable.sol"; @@ -104,11 +105,6 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { // * Storage * // // ************************************* // - uint96 private constant FORKING_COURT = 0; // Index of the forking court. - uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court. - uint256 private constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. - uint256 private constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped. - uint256 private constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute. uint256 private constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by. uint256 private constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH. uint256 private constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court. @@ -193,8 +189,9 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { // * Function Modifiers * // // ************************************* // - function onlyByGovernor() private view { + modifier onlyByGovernor() { if (governor != msg.sender) revert GovernorOnly(); + _; } // ************************************* // @@ -238,23 +235,23 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { // DISPUTE_KIT_CLASSIC disputeKitNodes.push( DisputeKitNode({ - parent: NULL_DISPUTE_KIT, + parent: Constants.NULL_DISPUTE_KIT, children: new uint256[](0), disputeKit: _disputeKit, depthLevel: 0, disabled: false }) ); - emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT); + emit DisputeKitCreated(Constants.DISPUTE_KIT_CLASSIC, _disputeKit, Constants.NULL_DISPUTE_KIT); // FORKING_COURT // TODO: Fill the properties for the Forking court, emit CourtCreated. courts.push(); - sortitionModule.createTree(bytes32(uint256(FORKING_COURT)), _sortitionExtraData); + sortitionModule.createTree(bytes32(uint256(Constants.FORKING_COURT)), _sortitionExtraData); // GENERAL_COURT Court storage court = courts.push(); - court.parent = FORKING_COURT; + court.parent = Constants.FORKING_COURT; court.children = new uint256[](0); court.hiddenVotes = _hiddenVotes; court.minStake = _courtParameters[0]; @@ -263,7 +260,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { court.jurorsForCourtJump = _courtParameters[3]; court.timesPerPeriod = _timesPerPeriod; - sortitionModule.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData); + sortitionModule.createTree(bytes32(uint256(Constants.GENERAL_COURT)), _sortitionExtraData); emit CourtCreated( 1, @@ -276,7 +273,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { _timesPerPeriod, new uint256[](0) ); - _enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true); + _enableDisputeKit(Constants.GENERAL_COURT, Constants.DISPUTE_KIT_CLASSIC, true); } // ************************************* // @@ -286,46 +283,45 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /* @dev Access Control to perform implementation upgrades (UUPS Proxiable) * @dev Only the governor can perform upgrades (`onlyByGovernor`) */ - function _authorizeUpgrade(address) internal view override { - onlyByGovernor(); + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP } /// @dev Allows the governor to call anything on behalf of the contract. /// @param _destination The destination of the call. /// @param _amount The value sent with the call. /// @param _data The data sent with the call. - function executeGovernorProposal(address _destination, uint256 _amount, bytes memory _data) external { - onlyByGovernor(); + function executeGovernorProposal( + address _destination, + uint256 _amount, + bytes memory _data + ) external onlyByGovernor { (bool success, ) = _destination.call{value: _amount}(_data); if (!success) revert UnsuccessfulCall(); } /// @dev Changes the `governor` storage variable. /// @param _governor The new value for the `governor` storage variable. - function changeGovernor(address payable _governor) external { - onlyByGovernor(); + function changeGovernor(address payable _governor) external onlyByGovernor { governor = _governor; } /// @dev Changes the `pinakion` storage variable. /// @param _pinakion The new value for the `pinakion` storage variable. - function changePinakion(IERC20 _pinakion) external { - onlyByGovernor(); + function changePinakion(IERC20 _pinakion) external onlyByGovernor { pinakion = _pinakion; } /// @dev Changes the `jurorProsecutionModule` storage variable. /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable. - function changeJurorProsecutionModule(address _jurorProsecutionModule) external { - onlyByGovernor(); + function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor { jurorProsecutionModule = _jurorProsecutionModule; } /// @dev Changes the `_sortitionModule` storage variable. /// Note that the new module should be initialized for all courts. /// @param _sortitionModule The new value for the `sortitionModule` storage variable. - function changeSortitionModule(ISortitionModule _sortitionModule) external { - onlyByGovernor(); + function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor { sortitionModule = _sortitionModule; } @@ -333,12 +329,11 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /// @param _disputeKitAddress The address of the dispute kit contract. /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created. /// Note that the root DK must be supported by the general court. - function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external { - onlyByGovernor(); + function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor { uint256 disputeKitID = disputeKitNodes.length; if (_parent >= disputeKitID) revert InvalidDisputKitParent(); uint256 depthLevel; - if (_parent != NULL_DISPUTE_KIT) { + if (_parent != Constants.NULL_DISPUTE_KIT) { depthLevel = disputeKitNodes[_parent].depthLevel + 1; // It should be always possible to reach the root from the leaf with the defined number of search iterations. if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax(); @@ -355,9 +350,9 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { disputeKitNodes[_parent].children.push(disputeKitID); emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent); - if (_parent == NULL_DISPUTE_KIT) { + if (_parent == Constants.NULL_DISPUTE_KIT) { // A new dispute kit tree root should always be supported by the General court. - _enableDisputeKit(GENERAL_COURT, disputeKitID, true); + _enableDisputeKit(Constants.GENERAL_COURT, disputeKitID, true); } } @@ -381,11 +376,10 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, uint256[] memory _supportedDisputeKits - ) external { - onlyByGovernor(); + ) external onlyByGovernor { if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt(); if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit(); - if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent(); + if (_parent == Constants.FORKING_COURT) revert InvalidForkingCourtAsParent(); uint256 courtID = courts.length; Court storage court = courts.push(); @@ -431,10 +425,9 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { uint256 _feeForJuror, uint256 _jurorsForCourtJump, uint256[4] memory _timesPerPeriod - ) external { - onlyByGovernor(); + ) external onlyByGovernor { Court storage court = courts[_courtID]; - if (_courtID != GENERAL_COURT && courts[court.parent].minStake > _minStake) { + if (_courtID != Constants.GENERAL_COURT && courts[court.parent].minStake > _minStake) { revert MinStakeLowerThanParentCourt(); } for (uint256 i = 0; i < court.children.length; i++) { @@ -463,8 +456,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /// @param _courtID The ID of the court. /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed. /// @param _enable Whether add or remove the dispute kits from the court. - function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external { - onlyByGovernor(); + function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor { for (uint256 i = 0; i < _disputeKitIDs.length; i++) { if (_enable) { if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) { @@ -472,7 +464,10 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { } _enableDisputeKit(_courtID, _disputeKitIDs[i], true); } else { - if (_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT) { + if ( + _courtID == Constants.GENERAL_COURT && + disputeKitNodes[_disputeKitIDs[i]].parent == Constants.NULL_DISPUTE_KIT + ) { revert CannotDisableRootDKInGeneral(); } _enableDisputeKit(_courtID, _disputeKitIDs[i], false); @@ -483,8 +478,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /// @dev Changes the supported fee tokens. /// @param _feeToken The fee token. /// @param _accepted Whether the token is supported or not as a method of fee payment. - function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external { - onlyByGovernor(); + function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor { currencyRates[_feeToken].feePaymentAccepted = _accepted; emit AcceptedFeeToken(_feeToken, _accepted); } @@ -493,9 +487,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /// @param _feeToken The fee token. /// @param _rateInEth The new rate of the fee token in ETH. /// @param _rateDecimals The new decimals of the fee token rate. - function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external { - onlyByGovernor(); - // CurrencyRate storage rate = currencyRates[_feeToken]; + function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor { currencyRates[_feeToken].rateInEth = _rateInEth; currencyRates[_feeToken].rateDecimals = _rateDecimals; emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals); @@ -678,7 +670,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) { if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) { break; - } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) { + } else if (disputeKitNodes[newDisputeKitID].parent != Constants.NULL_DISPUTE_KIT) { newDisputeKitID = disputeKitNodes[newDisputeKitID].parent; } else { // DK's parent has 0 index, that means we reached the root DK (0 depth level). @@ -690,7 +682,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court. // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default. if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) { - newCourtID = GENERAL_COURT; + newCourtID = Constants.GENERAL_COURT; } if (newCourtID != dispute.courtID) { @@ -712,7 +704,6 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { // Dispute kit was changed, so create a dispute in the new DK contract. if (extraRound.disputeKitID != round.disputeKitID) { - // IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit; emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID); disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute( _disputeID, @@ -963,7 +954,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { Court storage court = courts[dispute.courtID]; if (round.nbVotes >= court.jurorsForCourtJump) { // Jump to parent court. - if (dispute.courtID == GENERAL_COURT) { + if (dispute.courtID == Constants.GENERAL_COURT) { // TODO: Handle the forking when appealed in General court. cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court. } else { @@ -1036,7 +1027,6 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { /// @param _courtID The ID of the court to get the times from. /// @return timesPerPeriod The timesPerPeriod array for the given court. function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) { - // Court storage court = courts[_courtID]; timesPerPeriod = courts[_courtID].timesPerPeriod; } @@ -1115,7 +1105,7 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { uint96 _courtID, uint256 _newStake ) internal returns (bool succeeded) { - if (_courtID == FORKING_COURT || _courtID > courts.length) return false; + if (_courtID == Constants.FORKING_COURT || _courtID > courts.length) return false; Juror storage juror = jurors[_account]; uint256 currentStake = juror.stakedPnkByCourt[_courtID]; @@ -1202,19 +1192,19 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { minJurors := mload(add(_extraData, 0x40)) disputeKitID := mload(add(_extraData, 0x60)) } - if (courtID == FORKING_COURT || courtID >= courts.length) { - courtID = GENERAL_COURT; + if (courtID == Constants.FORKING_COURT || courtID >= courts.length) { + courtID = Constants.GENERAL_COURT; } if (minJurors == 0) { - minJurors = DEFAULT_NB_OF_JURORS; + minJurors = Constants.DEFAULT_NB_OF_JURORS; } - if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) { - disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used. + if (disputeKitID == Constants.NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) { + disputeKitID = Constants.DISPUTE_KIT_CLASSIC; // 0 index is not used. } } else { - courtID = GENERAL_COURT; - minJurors = DEFAULT_NB_OF_JURORS; - disputeKitID = DISPUTE_KIT_CLASSIC; + courtID = Constants.GENERAL_COURT; + minJurors = Constants.DEFAULT_NB_OF_JURORS; + disputeKitID = Constants.DISPUTE_KIT_CLASSIC; } } @@ -1249,6 +1239,5 @@ contract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable { error NotExecutionPeriod(); error RulingAlreadyExecuted(); error DisputePeriodIsFinal(); - /// Transfer failed error TransferFailed(); } diff --git a/contracts/src/arbitration/SortitionModule.sol b/contracts/src/arbitration/SortitionModule.sol index d7c411855..67c787aff 100644 --- a/contracts/src/arbitration/SortitionModule.sol +++ b/contracts/src/arbitration/SortitionModule.sol @@ -16,6 +16,7 @@ import "./interfaces/IDisputeKit.sol"; import "../rng/RNG.sol"; import "../proxy/UUPSProxiable.sol"; import "../proxy/Initializable.sol"; +import "../libraries/Constants.sol"; /// @title SortitionModule /// @dev A factory of trees that keeps track of staked values for sortition. @@ -254,7 +255,7 @@ contract SortitionModule is ISortitionModule, UUPSProxiable, Initializable { while (!finished) { // Tokens are also implicitly staked in parent courts through sortition module to increase the chance of being drawn. _set(bytes32(uint256(currenCourtID)), _value, stakePathID); - if (currenCourtID == core.GENERAL_COURT()) { + if (currenCourtID == Constants.GENERAL_COURT) { finished = true; } else { (currenCourtID, , , , , , ) = core.courts(currenCourtID); diff --git a/contracts/src/libraries/Constants.sol b/contracts/src/libraries/Constants.sol new file mode 100644 index 000000000..72788b3ec --- /dev/null +++ b/contracts/src/libraries/Constants.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.18; + +/// @title Constants +library Constants { + // Courts + uint96 public constant FORKING_COURT = 0; // Index of the forking court. + uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court. + + // Dispute Kits + uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. + uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped. + + // Defaults + uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute. +} diff --git a/contracts/test/arbitration/draw.ts b/contracts/test/arbitration/draw.ts index cb3bc2619..47be1689f 100644 --- a/contracts/test/arbitration/draw.ts +++ b/contracts/test/arbitration/draw.ts @@ -11,6 +11,7 @@ import { } from "../../typechain-types"; import { expect } from "chai"; import { DrawEvent } from "../../typechain-types/src/kleros-v1/kleros-liquid-xdai/XKlerosLiquidV2"; +import { Courts } from "../../deploy/utils"; /* eslint-disable no-unused-vars */ /* eslint-disable no-unused-expressions */ // https://github.com/standard/standard/issues/690#issuecomment-278533482 @@ -67,10 +68,7 @@ describe("Draw Benchmark", async () => { arbitrable = (await ethers.getContract("ArbitrableExample")) as ArbitrableExample; sortitionModule = (await ethers.getContract("SortitionModule")) as SortitionModule; - parentCourtMinStake = await core - .GENERAL_COURT() - .then((courtId) => core.courts(courtId)) - .then((court) => court.minStake); + parentCourtMinStake = await core.courts(Courts.GENERAL).then((court) => court.minStake); childCourtMinStake = BigNumber.from(10).pow(20).mul(3); // 300 PNK From 21722470506c492cafe006a7e041c4f3b48901cf Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 17:33:56 +0100 Subject: [PATCH 15/16] fix: deploy script issue for the devnet foreign gateway --- contracts/deploy/01-foreign-gateway-on-ethereum.ts | 12 ++++-------- contracts/deploy/01-foreign-gateway-on-gnosis.ts | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/contracts/deploy/01-foreign-gateway-on-ethereum.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts index 7c7e2ca7d..53f255851 100644 --- a/contracts/deploy/01-foreign-gateway-on-ethereum.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -1,4 +1,4 @@ -import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { HardhatRuntimeEnvironment, HttpNetworkConfig } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; @@ -15,15 +15,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const chainId = Number(await getChainId()); console.log("Deploying to chainId %s with deployer %s", chainId, deployer); - const homeNetworks = { - ETHEREUM_MAINNET: config.networks.arbitrum, - ETHEREUM_GOERLI: config.networks.arbitrumGoerli, - HARDHAT: config.networks.localhost, - }; - // Hack to predict the deployment address on the home chain. // TODO: use deterministic deployments - const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); + const network = config.networks[hre.network.name]; + const homeNetwork = config.networks[network.companionNetworks.home] as HttpNetworkConfig; + const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetwork.url); let nonce = await homeChainProvider.getTransactionCount(deployer); nonce += 1; // HomeGatewayToEthereum Proxy deploy tx will be the 2nd tx after this on its home network, so we add 1 to the current nonce. const homeGatewayAddress = getContractAddress(deployer, nonce); diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts index 5f52d7d54..8945e856d 100644 --- a/contracts/deploy/01-foreign-gateway-on-gnosis.ts +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -1,5 +1,5 @@ import { parseUnits } from "ethers/lib/utils"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { HardhatRuntimeEnvironment, HttpNetworkConfig } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "./utils/getContractAddress"; import { KlerosCore__factory } from "../typechain-types"; @@ -18,15 +18,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const chainId = Number(await getChainId()); console.log("Deploying to chainId %s with deployer %s", chainId, deployer); - const homeNetworks = { - GNOSIS_MAINNET: config.networks.arbitrum, - GNOSIS_CHIADO: config.networks.arbitrumGoerli, - HARDHAT: config.networks.localhost, - }; - // Hack to predict the deployment address on the home chain. // TODO: use deterministic deployments - const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); + const network = config.networks[hre.network.name]; + const homeNetwork = config.networks[network.companionNetworks.home] as HttpNetworkConfig; + const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetwork.url); let nonce = await homeChainProvider.getTransactionCount(deployer); nonce += 1; // HomeGatewayToEthereum Proxy deploy tx will be the 2nd tx after this on its home network, so we add 1 to the current nonce. const homeGatewayAddress = getContractAddress(deployer, nonce); // HomeGateway deploy tx will be the next tx home network From acb94e930c2c4bcd5209f309992e1c09713468ee Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Tue, 26 Sep 2023 18:30:55 +0100 Subject: [PATCH 16/16] =?UTF-8?q?chore:=20devnet=20redeployment=20with=20u?= =?UTF-8?q?pgradable=20contracts=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/README.md | 19 +- .../ArbitrableExample.json | 76 +- .../DisputeKitClassic.json | 720 ++--- .../DisputeKitClassic_Implementation.json | 1588 +++++++++ .../DisputeKitClassic_Proxy.json | 93 + .../arbitrumGoerliDevnet/DisputeResolver.json | 54 +- .../DisputeTemplateRegistry.json | 259 +- ...isputeTemplateRegistry_Implementation.json | 392 +++ .../DisputeTemplateRegistry_Proxy.json | 93 + .../HomeGatewayToGnosis.json | 845 ----- .../arbitrumGoerliDevnet/KlerosCore.json | 1316 ++------ .../KlerosCore_Implementation.json | 2860 +++++++++++++++++ .../KlerosCore_Proxy.json | 137 + .../arbitrumGoerliDevnet/PolicyRegistry.json | 265 +- .../PolicyRegistry_Implementation.json | 397 +++ .../PolicyRegistry_Proxy.json | 93 + .../arbitrumGoerliDevnet/RandomizerRNG.json | 316 +- .../RandomizerRNG_Implementation.json | 533 +++ .../RandomizerRNG_Proxy.json | 93 + .../arbitrumGoerliDevnet/SortitionModule.json | 595 ++-- .../SortitionModule_Implementation.json | 1065 ++++++ .../SortitionModule_Proxy.json | 93 + .../chiadoDevnet/ForeignGatewayOnGnosis.json | 526 ++- ...ForeignGatewayOnGnosis_Implementation.json | 1118 +++++++ .../ForeignGatewayOnGnosis_Proxy.json | 93 + contracts/package.json | 1 + contracts/scripts/verifyProxies.sh | 29 + 27 files changed, 10160 insertions(+), 3509 deletions(-) create mode 100644 contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Proxy.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Proxy.json delete mode 100644 contracts/deployments/arbitrumGoerliDevnet/HomeGatewayToGnosis.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Proxy.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Proxy.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Proxy.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Implementation.json create mode 100644 contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Proxy.json create mode 100644 contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Implementation.json create mode 100644 contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Proxy.json create mode 100755 contracts/scripts/verifyProxies.sh diff --git a/contracts/README.md b/contracts/README.md index 0e8eb951c..fcc8737eb 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -53,7 +53,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments - [ArbitrableExample](https://gnosis-chiado.blockscout.com/address/0xB56A23b396E0eae85414Ce5815da448ba529Cb4A) - [DisputeResolver](https://gnosis-chiado.blockscout.com/address/0x16f20604a51Ac1e68c9aAd1C0E53e951B62CC1Cb) - [DisputeTemplateRegistry](https://gnosis-chiado.blockscout.com/address/0x96E49552669ea81B8E9cE8694F7E4A55D8bFb957) -- [ForeignGatewayOnGnosis](https://gnosis-chiado.blockscout.com/address/0x83F393F2aE68FA6A6701D7c65CBbFf3225f3fDf9) +- [ForeignGatewayOnGnosis: proxy](https://gnosis-chiado.blockscout.com/address/0x078dAd05373d19d7fd6829735b765F12242a4300), [implementation](https://gnosis-chiado.blockscout.com/address/0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace) - [WETH](https://gnosis-chiado.blockscout.com/address/0x2DFC9c3141268e6eac04a7D6d98Fbf64BDe836a8) - [WETHFaucet](https://gnosis-chiado.blockscout.com/address/0x22CB016c4b57413ca4DF5F1AC44a0E0d3c69811F) - [WPNKFaucet](https://gnosis-chiado.blockscout.com/address/0x5898aeE045A25B276369914c3448B72a41758B2c) @@ -66,19 +66,18 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments #### Arbitrum Goerli - [PNK](https://goerli.arbiscan.io/token/0x3483FA1b87792cd5BE4100822C4eCEC8D3E531ee) -- [ArbitrableExample](https://goerli.arbiscan.io/address/0x6C346D9cDf0D71F71b36Fc1d7dB7c5e94696C146) +- [ArbitrableExample](https://goerli.arbiscan.io/address/0x5d96ede4D4Dd4c245d6879A4D790fF0AB1F476cC) - [DAI](https://goerli.arbiscan.io/address/0xB755843e26F2cD1c6A46659cEBb67CcFAE0f2EeE) - [DAIFaucet](https://goerli.arbiscan.io/address/0xCEBF1e0A5921767dd97b999ed14801A3770afAfd) -- [DisputeKitClassic](https://goerli.arbiscan.io/address/0x848DB6FBE64b06d58cD9D58820a4FB2F70537F2b) -- [DisputeResolver](https://goerli.arbiscan.io/address/0x66439ac54509892a5149efeF397DD36446281234) -- [DisputeTemplateRegistry](https://goerli.arbiscan.io/address/0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640) -- [HomeGatewayToGnosis](https://goerli.arbiscan.io/address/0x3DbB7993B8C2D7a1be58b8F2647ba1Cac60B6111) -- [KlerosCore](https://goerli.arbiscan.io/address/0xAbE6106f9f051af72eE2dB752061e2a0f081c10B) +- [DisputeKitClassic: proxy](https://goerli.arbiscan.io/address/0x6394A70cADD1376FdE5C38bA331761256DDd03E2), [implementation](https://goerli.arbiscan.io/address/0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb) +- [DisputeResolver](https://goerli.arbiscan.io/address/0xE4af4D800Ce12149199FA6f8870cD650cD8f3164) +- [DisputeTemplateRegistry: proxy](https://goerli.arbiscan.io/address/0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A), [implementation](https://goerli.arbiscan.io/address/0x93bf43132b6805E215d3c8305232ec3A174Ef146) +- [KlerosCore: proxy](https://goerli.arbiscan.io/address/0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE), [implementation](https://goerli.arbiscan.io/address/0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206) - [PNKFaucet](https://goerli.arbiscan.io/address/0x05648Ee14941630a649082e0dA5cb80D29cC9002) - [PinakionV2](https://goerli.arbiscan.io/address/0x3483FA1b87792cd5BE4100822C4eCEC8D3E531ee) -- [PolicyRegistry](https://goerli.arbiscan.io/address/0xa3556bF00c4f9ea235D6D4Bcb1B1c32121C0e935) -- [RandomizerRNG](https://goerli.arbiscan.io/address/0x0FE3869EA01Febb895Bc76DaB143858F84C67024) -- [SortitionModule](https://goerli.arbiscan.io/address/0x6f3b3c8d72Af21102088C8b3F07Ee97b166a21b2) +- [PolicyRegistry: proxy](https://goerli.arbiscan.io/address/0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529), [implementation](https://goerli.arbiscan.io/address/0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89) +- [RandomizerRNG: proxy](https://goerli.arbiscan.io/address/0xF67D956988cb11449db7aeA80E6339b95b160593), [implementation](https://goerli.arbiscan.io/address/0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE) +- [SortitionModule: proxy](https://goerli.arbiscan.io/address/0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E), [implementation](https://goerli.arbiscan.io/address/0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d) - [WETH](https://goerli.arbiscan.io/address/0xbB5839497dE7e6d4ddaFde093F69abA9be782E07) - [WETHFaucet](https://goerli.arbiscan.io/address/0xD2d862B060986b25996aaeDB54813002AB791013) diff --git a/contracts/deployments/arbitrumGoerliDevnet/ArbitrableExample.json b/contracts/deployments/arbitrumGoerliDevnet/ArbitrableExample.json index 70894c64a..160d6f133 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/ArbitrableExample.json +++ b/contracts/deployments/arbitrumGoerliDevnet/ArbitrableExample.json @@ -1,5 +1,5 @@ { - "address": "0x6C346D9cDf0D71F71b36Fc1d7dB7c5e94696C146", + "address": "0x5d96ede4D4Dd4c245d6879A4D790fF0AB1F476cC", "abi": [ { "inputs": [ @@ -357,39 +357,39 @@ "type": "function" } ], - "transactionHash": "0x60755828894e99b89fc879df8571bfe3440208979bd16cfd7e185c69ab33bd82", + "transactionHash": "0xfe10a0a22bfcb31aa1a67e1cb79911195df2e0104428881baa595f97de2a2f2c", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x6C346D9cDf0D71F71b36Fc1d7dB7c5e94696C146", - "transactionIndex": 2, - "gasUsed": "1330381", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000080000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000800000000000000000000000000000000000000000000000000800000000002000000400000000000100000000000000000000002000000000000000", - "blockHash": "0xe54d4a8cb69d0e854970a54b7c1cd8e2b5b830d02961c96a27fdff6069502d7a", - "transactionHash": "0x60755828894e99b89fc879df8571bfe3440208979bd16cfd7e185c69ab33bd82", + "contractAddress": "0x5d96ede4D4Dd4c245d6879A4D790fF0AB1F476cC", + "transactionIndex": 1, + "gasUsed": "1332621", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000020000000000000000000800080000000000000000000200000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000002000000400000000000100000000200000000000000000000000000000", + "blockHash": "0x72b8d811caffdfc7d5402d337854ffcb7a6940038893e33ff8b6dd7009b7e3b2", + "transactionHash": "0xfe10a0a22bfcb31aa1a67e1cb79911195df2e0104428881baa595f97de2a2f2c", "logs": [ { - "transactionIndex": 2, - "blockNumber": 43589426, - "transactionHash": "0x60755828894e99b89fc879df8571bfe3440208979bd16cfd7e185c69ab33bd82", - "address": "0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640", + "transactionIndex": 1, + "blockNumber": 43823911, + "transactionHash": "0xfe10a0a22bfcb31aa1a67e1cb79911195df2e0104428881baa595f97de2a2f2c", + "address": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", "topics": [ "0x00f7cd7255d1073b4e136dd477c38ea0020c051ab17110cc5bfab0c840ff9924", - "0x0000000000000000000000000000000000000000000000000000000000000032", + "0x0000000000000000000000000000000000000000000000000000000000000000", "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" ], "data": "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c6469737075746554656d706c6174654d617070696e673a20544f444f00000000", - "logIndex": 1, - "blockHash": "0xe54d4a8cb69d0e854970a54b7c1cd8e2b5b830d02961c96a27fdff6069502d7a" + "logIndex": 0, + "blockHash": "0x72b8d811caffdfc7d5402d337854ffcb7a6940038893e33ff8b6dd7009b7e3b2" } ], - "blockNumber": 43589426, - "cumulativeGasUsed": "1414040", + "blockNumber": 43823911, + "cumulativeGasUsed": "1332621", "status": 1, "byzantium": true }, "args": [ - "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", + "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", { "$schema": "../NewDisputeTemplate.schema.json", "title": "Let's do this", @@ -415,11 +415,11 @@ }, "disputeTemplateMapping: TODO", "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003", - "0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640", + "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", "0xbB5839497dE7e6d4ddaFde093F69abA9be782E07" ], - "numDeployments": 3, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"},{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"_templateRegistry\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"_action\",\"type\":\"string\"}],\"name\":\"Action\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_arbitrableDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateUri\",\"type\":\"string\"}],\"name\":\"DisputeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"arbitratorExtraData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"name\":\"changeArbitrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"}],\"name\":\"changeArbitratorExtraData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"}],\"name\":\"changeDisputeTemplate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"_templateRegistry\",\"type\":\"address\"}],\"name\":\"changeTemplateRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_action\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_feeInWeth\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_action\",\"type\":\"string\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isRuled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numberOfRulingOptions\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"externalIDtoLocalID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"templateId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"templateRegistry\",\"outputs\":[{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"DisputeRequest(address,uint256,uint256,uint256,string)\":{\"details\":\"To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\",\"params\":{\"_arbitrableDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\",\"_arbitrator\":\"The arbitrator of the contract.\",\"_externalDisputeID\":\"An identifier created outside Kleros by the protocol requesting arbitration.\",\"_templateId\":\"The identifier of the dispute template. Should not be used with _templateUri.\",\"_templateUri\":\"The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrator\":\"The arbitrator giving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor\",\"params\":{\"_arbitrator\":\"The arbitrator to rule on created disputes.\",\"_arbitratorExtraData\":\"The extra data for the arbitrator.\",\"_templateData\":\"The dispute template data.\",\"_templateDataMappings\":\"The dispute template data mappings.\",\"_templateRegistry\":\"The dispute template registry.\",\"_weth\":\"The WETH token.\"}},\"createDispute(string)\":{\"details\":\"Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_action\":\"The action that requires arbitration.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the dispute created.\"}},\"createDispute(string,uint256)\":{\"details\":\"Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_action\":\"The action that requires arbitration.\",\"_feeInWeth\":\"Amount of fees in WETH for the arbitrator.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the dispute created.\"}},\"rule(uint256,uint256)\":{\"details\":\"To be called by the arbitrator of the dispute, to declare the winning ruling.\",\"params\":{\"_externalDisputeID\":\"ID of the dispute in arbitrator contract.\",\"_ruling\":\"The ruling choice of the arbitration.\"}}},\"title\":\"ArbitrableExample An example of an arbitrable contract which connects to the arbitator that implements the updated interface.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/arbitrables/ArbitrableExample.sol\":\"ArbitrableExample\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/arbitrables/ArbitrableExample.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"../interfaces/IArbitrableV2.sol\\\";\\nimport \\\"../interfaces/IDisputeTemplateRegistry.sol\\\";\\nimport \\\"../../libraries/SafeERC20.sol\\\";\\n\\n/// @title ArbitrableExample\\n/// An example of an arbitrable contract which connects to the arbitator that implements the updated interface.\\ncontract ArbitrableExample is IArbitrableV2 {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeStruct {\\n bool isRuled; // Whether the dispute has been ruled or not.\\n uint256 ruling; // Ruling given by the arbitrator.\\n uint256 numberOfRulingOptions; // The number of choices the arbitrator can give.\\n }\\n\\n event Action(string indexed _action);\\n\\n address public immutable governor;\\n IArbitratorV2 public arbitrator; // Arbitrator is set in constructor.\\n IDisputeTemplateRegistry public templateRegistry; // The dispute template registry.\\n uint256 public templateId; // The current dispute template identifier.\\n bytes public arbitratorExtraData; // Extra data to set up the arbitration.\\n IERC20 public immutable weth; // The WETH token.\\n mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs.\\n DisputeStruct[] public disputes; // Stores the disputes' info. disputes[disputeID].\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(address(this) == msg.sender, \\\"Only the governor allowed.\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor\\n /// @param _arbitrator The arbitrator to rule on created disputes.\\n /// @param _templateData The dispute template data.\\n /// @param _templateDataMappings The dispute template data mappings.\\n /// @param _arbitratorExtraData The extra data for the arbitrator.\\n /// @param _templateRegistry The dispute template registry.\\n /// @param _weth The WETH token.\\n constructor(\\n IArbitratorV2 _arbitrator,\\n string memory _templateData,\\n string memory _templateDataMappings,\\n bytes memory _arbitratorExtraData,\\n IDisputeTemplateRegistry _templateRegistry,\\n IERC20 _weth\\n ) {\\n governor = msg.sender;\\n arbitrator = _arbitrator;\\n arbitratorExtraData = _arbitratorExtraData;\\n templateRegistry = _templateRegistry;\\n weth = _weth;\\n\\n templateId = templateRegistry.setDisputeTemplate(\\\"\\\", _templateData, _templateDataMappings);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n function changeArbitrator(IArbitratorV2 _arbitrator) external onlyByGovernor {\\n arbitrator = _arbitrator;\\n }\\n\\n function changeArbitratorExtraData(bytes calldata _arbitratorExtraData) external onlyByGovernor {\\n arbitratorExtraData = _arbitratorExtraData;\\n }\\n\\n function changeTemplateRegistry(IDisputeTemplateRegistry _templateRegistry) external onlyByGovernor {\\n templateRegistry = _templateRegistry;\\n }\\n\\n function changeDisputeTemplate(\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external onlyByGovernor {\\n templateId = templateRegistry.setDisputeTemplate(\\\"\\\", _templateData, _templateDataMappings);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Calls createDispute function of the specified arbitrator to create a dispute.\\n /// Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n /// @param _action The action that requires arbitration.\\n /// @return disputeID Dispute id (on arbitrator side) of the dispute created.\\n function createDispute(string calldata _action) external payable returns (uint256 disputeID) {\\n emit Action(_action);\\n\\n uint256 numberOfRulingOptions = 2;\\n uint256 localDisputeID = disputes.length;\\n disputes.push(DisputeStruct({isRuled: false, ruling: 0, numberOfRulingOptions: numberOfRulingOptions}));\\n\\n disputeID = arbitrator.createDispute{value: msg.value}(numberOfRulingOptions, arbitratorExtraData);\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n uint256 externalDisputeID = uint256(keccak256(abi.encodePacked(_action)));\\n emit DisputeRequest(arbitrator, disputeID, externalDisputeID, templateId, \\\"\\\");\\n }\\n\\n /// @dev Calls createDispute function of the specified arbitrator to create a dispute.\\n /// Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n /// @param _action The action that requires arbitration.\\n /// @param _feeInWeth Amount of fees in WETH for the arbitrator.\\n /// @return disputeID Dispute id (on arbitrator side) of the dispute created.\\n function createDispute(string calldata _action, uint256 _feeInWeth) external returns (uint256 disputeID) {\\n emit Action(_action);\\n\\n uint256 numberOfRulingOptions = 2;\\n uint256 localDisputeID = disputes.length;\\n disputes.push(DisputeStruct({isRuled: false, ruling: 0, numberOfRulingOptions: numberOfRulingOptions}));\\n\\n require(weth.safeTransferFrom(msg.sender, address(this), _feeInWeth), \\\"Transfer failed\\\");\\n require(weth.increaseAllowance(address(arbitrator), _feeInWeth), \\\"Allowance increase failed\\\");\\n\\n disputeID = arbitrator.createDispute(numberOfRulingOptions, arbitratorExtraData, weth, _feeInWeth);\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n uint256 externalDisputeID = uint256(keccak256(abi.encodePacked(_action)));\\n emit DisputeRequest(arbitrator, disputeID, externalDisputeID, templateId, \\\"\\\");\\n }\\n\\n /// @dev To be called by the arbitrator of the dispute, to declare the winning ruling.\\n /// @param _externalDisputeID ID of the dispute in arbitrator contract.\\n /// @param _ruling The ruling choice of the arbitration.\\n function rule(uint256 _externalDisputeID, uint256 _ruling) external override {\\n uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID];\\n DisputeStruct storage dispute = disputes[localDisputeID];\\n require(msg.sender == address(arbitrator), \\\"Only the arbitrator can execute this.\\\");\\n require(_ruling <= dispute.numberOfRulingOptions, \\\"Invalid ruling.\\\");\\n require(dispute.isRuled == false, \\\"This dispute has been ruled already.\\\");\\n\\n dispute.isRuled = true;\\n dispute.ruling = _ruling;\\n\\n emit Ruling(IArbitratorV2(msg.sender), _externalDisputeID, dispute.ruling);\\n }\\n}\\n\",\"keccak256\":\"0x19d38e04eed4156c108539f5ac7c98af87d1d457ef40b5d52bd1aa592c8b0df3\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeTemplate\\n/// @notice Dispute Template interface.\\ninterface IDisputeTemplateRegistry {\\n /// @dev To be emitted when a new dispute template is created.\\n /// @param _templateId The identifier of the dispute template.\\n /// @param _templateTag An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\\n /// @param _templateData The template data.\\n /// @param _templateDataMappings The data mappings.\\n event DisputeTemplate(\\n uint256 indexed _templateId,\\n string indexed _templateTag,\\n string _templateData,\\n string _templateDataMappings\\n );\\n\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId);\\n}\\n\",\"keccak256\":\"0x4b1b3f98d13e4a9a1c546dd45f98490f86e871cfc4b4be9a3fe4d29b3c99649c\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x60c06040523480156200001157600080fd5b506040516200191a3803806200191a83398101604081905262000034916200020f565b33608052600080546001600160a01b0319166001600160a01b03881617905560036200006184826200037e565b50600180546001600160a01b0319166001600160a01b0384811691821790925590821660a0526040516312a6505d60e21b8152634a99417490620000ac908890889060040162000478565b6020604051808303816000875af1158015620000cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f29190620004b8565b60025550620004d2945050505050565b6001600160a01b03811681146200011857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200014e57818101518382015260200162000134565b50506000910152565b60006001600160401b03808411156200017457620001746200011b565b604051601f8501601f19908116603f011681019082821181831017156200019f576200019f6200011b565b81604052809350858152868686011115620001b957600080fd5b620001c986602083018762000131565b5050509392505050565b600082601f830112620001e557600080fd5b620001f68383516020850162000157565b9392505050565b80516200020a8162000102565b919050565b60008060008060008060c087890312156200022957600080fd5b8651620002368162000102565b60208801519096506001600160401b03808211156200025457600080fd5b620002628a838b01620001d3565b965060408901519150808211156200027957600080fd5b620002878a838b01620001d3565b955060608901519150808211156200029e57600080fd5b508701601f81018913620002b157600080fd5b620002c28982516020840162000157565b935050620002d360808801620001fd565b9150620002e360a08801620001fd565b90509295509295509295565b600181811c908216806200030457607f821691505b6020821081036200032557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200037957600081815260208120601f850160051c81016020861015620003545750805b601f850160051c820191505b81811015620003755782815560010162000360565b5050505b505050565b81516001600160401b038111156200039a576200039a6200011b565b620003b281620003ab8454620002ef565b846200032b565b602080601f831160018114620003ea5760008415620003d15750858301515b600019600386901b1c1916600185901b17855562000375565b600085815260208120601f198616915b828110156200041b57888601518255948401946001909101908401620003fa565b50858210156200043a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081518084526200046481602086016020860162000131565b601f01601f19169290920160200192915050565b60608152600060608201526080602082015260006200049b60808301856200044a565b8281036040840152620004af81856200044a565b95945050505050565b600060208284031215620004cb57600080fd5b5051919050565b60805160a05161140e6200050c60003960008181610194015281816106e40152818161076301526108010152600060df015261140e6000f3fe6080604052600436106100c85760003560e01c8063654692871161007a578063654692871461021357806368175996146102415780636cc6cde1146102545780637aa77f2914610274578063a0af81f01461028a578063c21ae061146102aa578063c5d55288146102d7578063fc548f08146102f757600080fd5b80630c340a24146100cd5780630c7ac7b61461011e578063311a6c561461014057806334e2672d146101625780633fc8cef3146101825780634660ebbe146101b6578063564a565d146101d6575b600080fd5b3480156100d957600080fd5b506101017f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561012a57600080fd5b50610133610317565b6040516101159190610e3d565b34801561014c57600080fd5b5061016061015b366004610e57565b6103a5565b005b34801561016e57600080fd5b5061016061017d366004610ec2565b61053e565b34801561018e57600080fd5b506101017f000000000000000000000000000000000000000000000000000000000000000081565b3480156101c257600080fd5b506101606101d1366004610f1c565b61056f565b3480156101e257600080fd5b506101f66101f1366004610f39565b6105b0565b604080519315158452602084019290925290820152606001610115565b34801561021f57600080fd5b5061023361022e366004610f52565b6105e7565b604051908152602001610115565b61023361024f366004610ec2565b61091b565b34801561026057600080fd5b50600054610101906001600160a01b031681565b34801561028057600080fd5b5061023360025481565b34801561029657600080fd5b50600154610101906001600160a01b031681565b3480156102b657600080fd5b506102336102c5366004610f39565b60046020526000908152604090205481565b3480156102e357600080fd5b506101606102f2366004611041565b610b31565b34801561030357600080fd5b50610160610312366004610f1c565b610bcc565b60038054610324906110a5565b80601f0160208091040260200160405190810160405280929190818152602001828054610350906110a5565b801561039d5780601f106103725761010080835404028352916020019161039d565b820191906000526020600020905b81548152906001019060200180831161038057829003601f168201915b505050505081565b60008281526004602052604081205460058054919291839081106103cb576103cb6110df565b600091825260208220915460039190910290910191506001600160a01b0316331461044b5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600201548311156104915760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610442565b805460ff16156104ef5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610442565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b30331461055d5760405162461bcd60e51b8152600401610442906110f5565b600361056a82848361117a565b505050565b30331461058e5760405162461bcd60e51b8152600401610442906110f5565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600581815481106105c057600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b600083836040516105f992919061123b565b604051908190038120907f8b2c14fe955d044ef95ba32b88d2ceb87c6f73fcefdcebe906063a6d75690f2790600090a2600580546040805160608101825260008082526020820181815260029383018481526001860187559590915290517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db060038502908101805460ff19169215159290921790915590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db182015592517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db2909301929092556107147f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316333087610c0d565b6107525760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610442565b60005461078c906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911686610ce9565b6107d45760405162461bcd60e51b8152602060048201526019602482015278105b1b1bddd85b98d9481a5b98dc99585cd94819985a5b1959603a1b6044820152606401610442565b600054604051633d941b6d60e21b81526001600160a01b039091169063f6506db49061082b9085906003907f0000000000000000000000000000000000000000000000000000000000000000908a906004016112c8565b6020604051808303816000875af115801561084a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086e91906112fd565b600081815260046020908152604080832085905551929550909161089691899189910161123b565b60408051601f1981840301815290829052805160209091012060005460025491935086926001600160a01b03909116917f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e271869161090991868252602082015260606040820181905260009082015260800190565b60405180910390a35050509392505050565b6000828260405161092d92919061123b565b604051908190038120907f8b2c14fe955d044ef95ba32b88d2ceb87c6f73fcefdcebe906063a6d75690f2790600090a26005805460408051606081018252600080825260208201818152600283850181815260018701885596835292517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db06003808802918201805460ff19169315159390931790925591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db183015595517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db29091015554915163c13517e160e01b815290936001600160a01b039092169163c13517e1913491610a4291879190600401611316565b60206040518083038185885af1158015610a60573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8591906112fd565b6000818152600460209081526040808320859055519295509091610aad91889188910161123b565b60408051601f1981840301815290829052805160209091012060005460025491935086926001600160a01b03909116917f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e2718691610b2091868252602082015260606040820181905260009082015260800190565b60405180910390a350505092915050565b303314610b505760405162461bcd60e51b8152600401610442906110f5565b6001546040516312a6505d60e21b81526001600160a01b0390911690634a99417490610b829085908590600401611337565b6020604051808303816000875af1158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc591906112fd565b6002555050565b303314610beb5760405162461bcd60e51b8152600401610442906110f5565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610c729190611373565b6000604051808303816000865af19150503d8060008114610caf576040519150601f19603f3d011682016040523d82523d6000602084013e610cb4565b606091505b5091509150818015610cde575080511580610cde575080806020019051810190610cde919061138f565b979650505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063095ea7b39085908590849063dd62ed3e90604401602060405180830381865afa158015610d45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6991906112fd565b610d7391906113b1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de2919061138f565b506001949350505050565b60005b83811015610e08578181015183820152602001610df0565b50506000910152565b60008151808452610e29816020860160208601610ded565b601f01601f19169290920160200192915050565b602081526000610e506020830184610e11565b9392505050565b60008060408385031215610e6a57600080fd5b50508035926020909101359150565b60008083601f840112610e8b57600080fd5b50813567ffffffffffffffff811115610ea357600080fd5b602083019150836020828501011115610ebb57600080fd5b9250929050565b60008060208385031215610ed557600080fd5b823567ffffffffffffffff811115610eec57600080fd5b610ef885828601610e79565b90969095509350505050565b6001600160a01b0381168114610f1957600080fd5b50565b600060208284031215610f2e57600080fd5b8135610e5081610f04565b600060208284031215610f4b57600080fd5b5035919050565b600080600060408486031215610f6757600080fd5b833567ffffffffffffffff811115610f7e57600080fd5b610f8a86828701610e79565b909790965060209590950135949350505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610fc557600080fd5b813567ffffffffffffffff80821115610fe057610fe0610f9e565b604051601f8301601f19908116603f0116810190828211818310171561100857611008610f9e565b8160405283815286602085880101111561102157600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561105457600080fd5b823567ffffffffffffffff8082111561106c57600080fd5b61107886838701610fb4565b9350602085013591508082111561108e57600080fd5b5061109b85828601610fb4565b9150509250929050565b600181811c908216806110b957607f821691505b6020821081036110d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6020808252601a908201527f4f6e6c792074686520676f7665726e6f7220616c6c6f7765642e000000000000604082015260600190565b601f82111561056a57600081815260208120601f850160051c810160208610156111535750805b601f850160051c820191505b818110156111725782815560010161115f565b505050505050565b67ffffffffffffffff83111561119257611192610f9e565b6111a6836111a083546110a5565b8361112c565b6000601f8411600181146111da57600085156111c25750838201355b600019600387901b1c1916600186901b178355611234565b600083815260209020601f19861690835b8281101561120b57868501358255602094850194600190920191016111eb565b50868210156112285760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b8183823760009101908152919050565b60008154611258816110a5565b808552602060018381168015611275576001811461128f576112bd565b60ff1985168884015283151560051b8801830195506112bd565b866000528260002060005b858110156112b55781548a820186015290830190840161129a565b890184019650505b505050505092915050565b8481526080602082015260006112e1608083018661124b565b6001600160a01b03949094166040830152506060015292915050565b60006020828403121561130f57600080fd5b5051919050565b82815260406020820152600061132f604083018461124b565b949350505050565b60608152600060608201526080602082015260006113586080830185610e11565b828103604084015261136a8185610e11565b95945050505050565b60008251611385818460208701610ded565b9190910192915050565b6000602082840312156113a157600080fd5b81518015158114610e5057600080fd5b808201808211156113d257634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220c6a6daf2f56ede86acd165f440073734a6ccd3c00dadf35865db2d523df0840d64736f6c63430008120033", "deployedBytecode": "0x6080604052600436106100c85760003560e01c8063654692871161007a578063654692871461021357806368175996146102415780636cc6cde1146102545780637aa77f2914610274578063a0af81f01461028a578063c21ae061146102aa578063c5d55288146102d7578063fc548f08146102f757600080fd5b80630c340a24146100cd5780630c7ac7b61461011e578063311a6c561461014057806334e2672d146101625780633fc8cef3146101825780634660ebbe146101b6578063564a565d146101d6575b600080fd5b3480156100d957600080fd5b506101017f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561012a57600080fd5b50610133610317565b6040516101159190610e3d565b34801561014c57600080fd5b5061016061015b366004610e57565b6103a5565b005b34801561016e57600080fd5b5061016061017d366004610ec2565b61053e565b34801561018e57600080fd5b506101017f000000000000000000000000000000000000000000000000000000000000000081565b3480156101c257600080fd5b506101606101d1366004610f1c565b61056f565b3480156101e257600080fd5b506101f66101f1366004610f39565b6105b0565b604080519315158452602084019290925290820152606001610115565b34801561021f57600080fd5b5061023361022e366004610f52565b6105e7565b604051908152602001610115565b61023361024f366004610ec2565b61091b565b34801561026057600080fd5b50600054610101906001600160a01b031681565b34801561028057600080fd5b5061023360025481565b34801561029657600080fd5b50600154610101906001600160a01b031681565b3480156102b657600080fd5b506102336102c5366004610f39565b60046020526000908152604090205481565b3480156102e357600080fd5b506101606102f2366004611041565b610b31565b34801561030357600080fd5b50610160610312366004610f1c565b610bcc565b60038054610324906110a5565b80601f0160208091040260200160405190810160405280929190818152602001828054610350906110a5565b801561039d5780601f106103725761010080835404028352916020019161039d565b820191906000526020600020905b81548152906001019060200180831161038057829003601f168201915b505050505081565b60008281526004602052604081205460058054919291839081106103cb576103cb6110df565b600091825260208220915460039190910290910191506001600160a01b0316331461044b5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600201548311156104915760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610442565b805460ff16156104ef5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610442565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b30331461055d5760405162461bcd60e51b8152600401610442906110f5565b600361056a82848361117a565b505050565b30331461058e5760405162461bcd60e51b8152600401610442906110f5565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600581815481106105c057600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b600083836040516105f992919061123b565b604051908190038120907f8b2c14fe955d044ef95ba32b88d2ceb87c6f73fcefdcebe906063a6d75690f2790600090a2600580546040805160608101825260008082526020820181815260029383018481526001860187559590915290517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db060038502908101805460ff19169215159290921790915590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db182015592517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db2909301929092556107147f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316333087610c0d565b6107525760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610442565b60005461078c906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911686610ce9565b6107d45760405162461bcd60e51b8152602060048201526019602482015278105b1b1bddd85b98d9481a5b98dc99585cd94819985a5b1959603a1b6044820152606401610442565b600054604051633d941b6d60e21b81526001600160a01b039091169063f6506db49061082b9085906003907f0000000000000000000000000000000000000000000000000000000000000000908a906004016112c8565b6020604051808303816000875af115801561084a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086e91906112fd565b600081815260046020908152604080832085905551929550909161089691899189910161123b565b60408051601f1981840301815290829052805160209091012060005460025491935086926001600160a01b03909116917f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e271869161090991868252602082015260606040820181905260009082015260800190565b60405180910390a35050509392505050565b6000828260405161092d92919061123b565b604051908190038120907f8b2c14fe955d044ef95ba32b88d2ceb87c6f73fcefdcebe906063a6d75690f2790600090a26005805460408051606081018252600080825260208201818152600283850181815260018701885596835292517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db06003808802918201805460ff19169315159390931790925591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db183015595517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db29091015554915163c13517e160e01b815290936001600160a01b039092169163c13517e1913491610a4291879190600401611316565b60206040518083038185885af1158015610a60573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8591906112fd565b6000818152600460209081526040808320859055519295509091610aad91889188910161123b565b60408051601f1981840301815290829052805160209091012060005460025491935086926001600160a01b03909116917f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e2718691610b2091868252602082015260606040820181905260009082015260800190565b60405180910390a350505092915050565b303314610b505760405162461bcd60e51b8152600401610442906110f5565b6001546040516312a6505d60e21b81526001600160a01b0390911690634a99417490610b829085908590600401611337565b6020604051808303816000875af1158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc591906112fd565b6002555050565b303314610beb5760405162461bcd60e51b8152600401610442906110f5565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610c729190611373565b6000604051808303816000865af19150503d8060008114610caf576040519150601f19603f3d011682016040523d82523d6000602084013e610cb4565b606091505b5091509150818015610cde575080511580610cde575080806020019051810190610cde919061138f565b979650505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063095ea7b39085908590849063dd62ed3e90604401602060405180830381865afa158015610d45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6991906112fd565b610d7391906113b1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de2919061138f565b506001949350505050565b60005b83811015610e08578181015183820152602001610df0565b50506000910152565b60008151808452610e29816020860160208601610ded565b601f01601f19169290920160200192915050565b602081526000610e506020830184610e11565b9392505050565b60008060408385031215610e6a57600080fd5b50508035926020909101359150565b60008083601f840112610e8b57600080fd5b50813567ffffffffffffffff811115610ea357600080fd5b602083019150836020828501011115610ebb57600080fd5b9250929050565b60008060208385031215610ed557600080fd5b823567ffffffffffffffff811115610eec57600080fd5b610ef885828601610e79565b90969095509350505050565b6001600160a01b0381168114610f1957600080fd5b50565b600060208284031215610f2e57600080fd5b8135610e5081610f04565b600060208284031215610f4b57600080fd5b5035919050565b600080600060408486031215610f6757600080fd5b833567ffffffffffffffff811115610f7e57600080fd5b610f8a86828701610e79565b909790965060209590950135949350505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610fc557600080fd5b813567ffffffffffffffff80821115610fe057610fe0610f9e565b604051601f8301601f19908116603f0116810190828211818310171561100857611008610f9e565b8160405283815286602085880101111561102157600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561105457600080fd5b823567ffffffffffffffff8082111561106c57600080fd5b61107886838701610fb4565b9350602085013591508082111561108e57600080fd5b5061109b85828601610fb4565b9150509250929050565b600181811c908216806110b957607f821691505b6020821081036110d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6020808252601a908201527f4f6e6c792074686520676f7665726e6f7220616c6c6f7765642e000000000000604082015260600190565b601f82111561056a57600081815260208120601f850160051c810160208610156111535750805b601f850160051c820191505b818110156111725782815560010161115f565b505050505050565b67ffffffffffffffff83111561119257611192610f9e565b6111a6836111a083546110a5565b8361112c565b6000601f8411600181146111da57600085156111c25750838201355b600019600387901b1c1916600186901b178355611234565b600083815260209020601f19861690835b8281101561120b57868501358255602094850194600190920191016111eb565b50868210156112285760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b8183823760009101908152919050565b60008154611258816110a5565b808552602060018381168015611275576001811461128f576112bd565b60ff1985168884015283151560051b8801830195506112bd565b866000528260002060005b858110156112b55781548a820186015290830190840161129a565b890184019650505b505050505092915050565b8481526080602082015260006112e1608083018661124b565b6001600160a01b03949094166040830152506060015292915050565b60006020828403121561130f57600080fd5b5051919050565b82815260406020820152600061132f604083018461124b565b949350505050565b60608152600060608201526080602082015260006113586080830185610e11565b828103604084015261136a8185610e11565b95945050505050565b60008251611385818460208701610ded565b9190910192915050565b6000602082840312156113a157600080fd5b81518015158114610e5057600080fd5b808201808211156113d257634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220c6a6daf2f56ede86acd165f440073734a6ccd3c00dadf35865db2d523df0840d64736f6c63430008120033", @@ -495,23 +495,23 @@ "storageLayout": { "storage": [ { - "astId": 9415, + "astId": 9555, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "arbitrator", "offset": 0, "slot": "0", - "type": "t_contract(IArbitratorV2)15393" + "type": "t_contract(IArbitratorV2)15618" }, { - "astId": 9418, + "astId": 9558, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "templateRegistry", "offset": 0, "slot": "1", - "type": "t_contract(IDisputeTemplateRegistry)15561" + "type": "t_contract(IDisputeTemplateRegistry)15786" }, { - "astId": 9420, + "astId": 9560, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "templateId", "offset": 0, @@ -519,7 +519,7 @@ "type": "t_uint256" }, { - "astId": 9422, + "astId": 9562, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "arbitratorExtraData", "offset": 0, @@ -527,7 +527,7 @@ "type": "t_bytes_storage" }, { - "astId": 9429, + "astId": 9569, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "externalIDtoLocalID", "offset": 0, @@ -535,17 +535,17 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 9433, + "astId": 9573, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "disputes", "offset": 0, "slot": "5", - "type": "t_array(t_struct(DisputeStruct)9406_storage)dyn_storage" + "type": "t_array(t_struct(DisputeStruct)9546_storage)dyn_storage" } ], "types": { - "t_array(t_struct(DisputeStruct)9406_storage)dyn_storage": { - "base": "t_struct(DisputeStruct)9406_storage", + "t_array(t_struct(DisputeStruct)9546_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)9546_storage", "encoding": "dynamic_array", "label": "struct ArbitrableExample.DisputeStruct[]", "numberOfBytes": "32" @@ -560,12 +560,12 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(IArbitratorV2)15393": { + "t_contract(IArbitratorV2)15618": { "encoding": "inplace", "label": "contract IArbitratorV2", "numberOfBytes": "20" }, - "t_contract(IDisputeTemplateRegistry)15561": { + "t_contract(IDisputeTemplateRegistry)15786": { "encoding": "inplace", "label": "contract IDisputeTemplateRegistry", "numberOfBytes": "20" @@ -577,12 +577,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(DisputeStruct)9406_storage": { + "t_struct(DisputeStruct)9546_storage": { "encoding": "inplace", "label": "struct ArbitrableExample.DisputeStruct", "members": [ { - "astId": 9401, + "astId": 9541, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "isRuled", "offset": 0, @@ -590,7 +590,7 @@ "type": "t_bool" }, { - "astId": 9403, + "astId": 9543, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "ruling", "offset": 0, @@ -598,7 +598,7 @@ "type": "t_uint256" }, { - "astId": 9405, + "astId": 9545, "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "numberOfRulingOptions", "offset": 0, diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic.json index 0b540caa9..2389cda13 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic.json +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic.json @@ -1,21 +1,55 @@ { - "address": "0x848DB6FBE64b06d58cD9D58820a4FB2F70537F2b", + "address": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [ { "internalType": "address", - "name": "_governor", + "name": "implementation", "type": "address" - }, + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ { - "internalType": "contract KlerosCore", - "name": "_core", - "type": "address" + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" }, { "anonymous": false, @@ -160,6 +194,32 @@ "name": "Evidence", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -772,6 +832,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -801,6 +879,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -819,6 +910,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [ { @@ -852,254 +961,85 @@ ], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0x6228986e1c4c7c93fa4406c5f17dbe0279671890ff01cff1d8fd9cf92026149b", + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x848DB6FBE64b06d58cD9D58820a4FB2F70537F2b", + "contractAddress": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", "transactionIndex": 1, - "gasUsed": "3282675", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7d41196ab36e5898a40e0895358307f1338c7c11bc7d5c9c092fc60bcbff4b28", - "transactionHash": "0x6228986e1c4c7c93fa4406c5f17dbe0279671890ff01cff1d8fd9cf92026149b", - "logs": [], - "blockNumber": 43589317, - "cumulativeGasUsed": "3282675", + "gasUsed": "177891", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000820000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbb2fff5b1c43c879e9781fdc05359b894dfbcb222a639a0e80db713d5189dfcd", + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823737, + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", + "address": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0xbb2fff5b1c43c879e9781fdc05359b894dfbcb222a639a0e80db713d5189dfcd" + } + ], + "blockNumber": 43823737, + "cumulativeGasUsed": "177891", "status": 1, "byzantium": true }, "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0x0000000000000000000000000000000000000000" + "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", + "0x485cc955000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a30000000000000000000000000000000000000000000000000000000000000000" ], - "numDeployments": 2, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"CommitCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Contribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_party\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"Evidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"VoteCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOSER_APPEAL_PERIOD_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LOSER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ONE_BASIS_POINT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WINNER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areCommitsAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areVotesAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"castCommit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salt\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"castVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"changeCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"coreDisputeIDToLocal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_nbVotes\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"jumped\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"fundAppeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"}],\"name\":\"getCoherentCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getDegreeOfCoherence\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"getFundedChoices\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"fundedChoices\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"totalVoted\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCommited\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVoters\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"choiceCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getVoteInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"commit\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"choice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"voted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"isVoteActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"submitEvidence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_beneficiary\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"withdrawFeesAndRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"ChoiceFunded(uint256,uint256,uint256)\":{\"details\":\"To be emitted when a choice is fully funded for an appeal.\",\"params\":{\"_choice\":\"The choice that is being funded.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}},\"CommitCast(uint256,address,uint256[],bytes32)\":{\"details\":\"To be emitted when a vote commitment is cast.\",\"params\":{\"_commit\":\"The commitment of the juror.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_juror\":\"The address of the juror casting the vote commitment.\",\"_voteIDs\":\"The identifiers of the votes in the dispute.\"}},\"Contribution(uint256,uint256,uint256,address,uint256)\":{\"details\":\"To be emitted when a funding contribution is made.\",\"params\":{\"_amount\":\"The amount contributed.\",\"_choice\":\"The choice that is being funded.\",\"_contributor\":\"The address of the contributor.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}},\"DisputeCreation(uint256,uint256,bytes)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_extraData\":\"The extra data for the dispute.\",\"_numberOfChoices\":\"The number of choices available in the dispute.\"}},\"Evidence(uint256,address,string)\":{\"details\":\"To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\",\"_externalDisputeID\":\"Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.\",\"_party\":\"The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\"}},\"VoteCast(uint256,address,uint256[],uint256,string)\":{\"details\":\"Emitted when casting a vote to provide the justification of juror's choice.\",\"params\":{\"_choice\":\"The choice juror voted for.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_juror\":\"Address of the juror.\",\"_justification\":\"Justification of the choice.\",\"_voteIDs\":\"The identifiers of the votes in the dispute.\"}},\"Withdrawal(uint256,uint256,uint256,address,uint256)\":{\"details\":\"To be emitted when the contributed funds are withdrawn.\",\"params\":{\"_amount\":\"The amount withdrawn.\",\"_choice\":\"The choice that is being funded.\",\"_contributor\":\"The address of the contributor.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}}},\"kind\":\"dev\",\"methods\":{\"areCommitsAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their commits for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their commits for the last round.\"}},\"areVotesAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their votes for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their votes for the last round.\"}},\"castCommit(uint256,uint256[],bytes32)\":{\"details\":\"Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.\",\"params\":{\"_commit\":\"The commit. Note that justification string is a part of the commit.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"castVote(uint256,uint256[],uint256,uint256,string)\":{\"details\":\"Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.\",\"params\":{\"_choice\":\"The choice.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_justification\":\"Justification of the choice.\",\"_salt\":\"The salt for the commit if the votes were hidden.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"changeCore(address)\":{\"details\":\"Changes the `core` storage variable.\",\"params\":{\"_core\":\"The new value for the `core` storage variable.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\"}},\"createDispute(uint256,uint256,bytes,uint256)\":{\"details\":\"Creates a local dispute and maps it to the dispute ID in the Core contract. Note: Access restricted to Kleros Core only.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_extraData\":\"Additional info about the dispute, for possible use in future dispute kits.\",\"_nbVotes\":\"Number of votes for this dispute.\",\"_numberOfChoices\":\"Number of choices of the dispute\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. Note: Access restricted to Kleros Core only.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_nonce\":\"Nonce of the drawing iteration.\"},\"returns\":{\"drawnAddress\":\"The drawn address.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"fundAppeal(uint256,uint256)\":{\"details\":\"Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.\",\"params\":{\"_choice\":\"A choice that receives funding.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\"}},\"getCoherentCount(uint256,uint256)\":{\"details\":\"Gets the number of jurors who are eligible to a reward in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"_0\":\"The number of coherent jurors.\"}},\"getDegreeOfCoherence(uint256,uint256,uint256)\":{\"details\":\"Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the vote.\"},\"returns\":{\"_0\":\"The degree of coherence in basis points.\"}},\"isVoteActive(uint256,uint256,uint256)\":{\"details\":\"Returns true if the specified voter was active in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the voter.\"},\"returns\":{\"_0\":\"Whether the voter was active or not.\"}},\"submitEvidence(uint256,string)\":{\"details\":\"Submits evidence for a dispute.\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\",\"_externalDisputeID\":\"Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID.\"}},\"withdrawFeesAndRewards(uint256,address,uint256,uint256)\":{\"details\":\"Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\",\"params\":{\"_beneficiary\":\"The address whose rewards to withdraw.\",\"_choice\":\"The ruling option that the caller wants to withdraw from.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core contract.\",\"_coreRoundID\":\"The round in the Kleros Core contract the caller wants to withdraw from.\"},\"returns\":{\"amount\":\"The withdrawn amount.\"}}},\"title\":\"DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggregation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":\"DisputeKitClassic\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2 {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 public constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n /// @dev Constructor.\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n if (_courtID != GENERAL_COURT && courts[courts[_courtID].parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n if (courts[courts[_courtID].children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n courts[_courtID].minStake = _minStake;\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n courts[_courtID].alpha = _alpha;\\n courts[_courtID].feeForJuror = _feeForJuror;\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n CurrencyRate storage rate = currencyRates[_feeToken];\\n rate.rateInEth = _rateInEth;\\n rate.rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n require(_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount), \\\"Transfer failed\\\");\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit;\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKit.createDispute(_disputeID, _numberOfChoices, _extraData, extraRound.nbVotes);\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n CurrencyRate storage rate = currencyRates[_toToken];\\n return (_amountInEth * 10 ** rate.rateDecimals) / rate.rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == FORKING_COURT || courtID >= courts.length) {\\n courtID = GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = DEFAULT_NB_OF_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n}\\n\",\"keccak256\":\"0xc9f7a39d8996805b06b34b538277cd9250e56302bf9f259b4f16d1775f343bdd\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/BaseDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../interfaces/IDisputeKit.sol\\\";\\nimport \\\"../KlerosCore.sol\\\";\\n\\n/// @title BaseDisputeKit\\n/// Provides common basic behaviours to the Dispute Kit implementations.\\nabstract contract BaseDisputeKit is IDisputeKit {\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The Kleros Core arbitrator\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n /// @dev Constructor.\\n /// @param _governor The governor's address.\\n /// @param _core The KlerosCore arbitrator.\\n constructor(address _governor, KlerosCore _core) {\\n governor = _governor;\\n core = _core;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n require(success, \\\"Unsuccessful call\\\");\\n }\\n\\n /// @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n /// @param _coreDisputeID ID of the dispute in the core contract.\\n /// @param _juror Chosen address.\\n /// @return Whether the address can be drawn or not.\\n function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xa33f365553132a9cc4f0b5fdfe9e5be2337d13dfca71a65835450de17496b93f\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./BaseDisputeKit.sol\\\";\\nimport \\\"../interfaces/IEvidence.sol\\\";\\n\\n/// @title DisputeKitClassic\\n/// Dispute kit implementation of the Kleros v1 features including:\\n/// - a drawing system: proportional to staked PNK,\\n/// - a vote aggregation system: plurality,\\n/// - an incentive system: equal split between coherent votes,\\n/// - an appeal system: fund 2 choices only, vote on any choice.\\ncontract DisputeKitClassic is BaseDisputeKit, IEvidence {\\n // ************************************* //\\n // * Structs * //\\n // ************************************* //\\n\\n struct Dispute {\\n Round[] rounds; // Rounds of the dispute. 0 is the default round, and [1, ..n] are the appeal rounds.\\n uint256 numberOfChoices; // The number of choices jurors have when voting. This does not include choice `0` which is reserved for \\\"refuse to arbitrate\\\".\\n bool jumped; // True if dispute jumped to a parent dispute kit and won't be handled by this DK anymore.\\n mapping(uint256 => uint256) coreRoundIDToLocal; // Maps id of the round in the core contract to the index of the round of related local dispute.\\n bytes extraData; // Extradata for the dispute.\\n }\\n\\n struct Round {\\n Vote[] votes; // Former votes[_appeal][].\\n uint256 winningChoice; // The choice with the most votes. Note that in the case of a tie, it is the choice that reached the tied number of votes first.\\n mapping(uint256 => uint256) counts; // The sum of votes for each choice in the form `counts[choice]`.\\n bool tied; // True if there is a tie, false otherwise.\\n uint256 totalVoted; // Former uint[_appeal] votesInEachRound.\\n uint256 totalCommitted; // Former commitsInRound.\\n mapping(uint256 => uint256) paidFees; // Tracks the fees paid for each choice in this round.\\n mapping(uint256 => bool) hasPaid; // True if this choice was fully funded, false otherwise.\\n mapping(address => mapping(uint256 => uint256)) contributions; // Maps contributors to their contributions for each choice.\\n uint256 feeRewards; // Sum of reimbursable appeal fees available to the parties that made contributions to the ruling that ultimately wins a dispute.\\n uint256[] fundedChoices; // Stores the choices that are fully funded.\\n uint256 nbVotes; // Maximal number of votes this dispute can get.\\n }\\n\\n struct Vote {\\n address account; // The address of the juror.\\n bytes32 commit; // The commit of the juror. For courts with hidden votes.\\n uint256 choice; // The choice of the juror.\\n bool voted; // True if the vote has been cast.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant WINNER_STAKE_MULTIPLIER = 10000; // Multiplier of the appeal cost that the winner has to pay as fee stake for a round in basis points. Default is 1x of appeal fee.\\n uint256 public constant LOSER_STAKE_MULTIPLIER = 20000; // Multiplier of the appeal cost that the loser has to pay as fee stake for a round in basis points. Default is 2x of appeal fee.\\n uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period.\\n uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling.\\n\\n Dispute[] public disputes; // Array of the locally created disputes.\\n mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /// @dev To be emitted when a dispute is created.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _numberOfChoices The number of choices available in the dispute.\\n /// @param _extraData The extra data for the dispute.\\n event DisputeCreation(uint256 indexed _coreDisputeID, uint256 _numberOfChoices, bytes _extraData);\\n\\n /// @dev To be emitted when a vote commitment is cast.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror The address of the juror casting the vote commitment.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _commit The commitment of the juror.\\n event CommitCast(uint256 indexed _coreDisputeID, address indexed _juror, uint256[] _voteIDs, bytes32 _commit);\\n\\n /// @dev To be emitted when a funding contribution is made.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n /// @param _contributor The address of the contributor.\\n /// @param _amount The amount contributed.\\n event Contribution(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n /// @dev To be emitted when the contributed funds are withdrawn.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n /// @param _contributor The address of the contributor.\\n /// @param _amount The amount withdrawn.\\n event Withdrawal(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n /// @dev To be emitted when a choice is fully funded for an appeal.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n event ChoiceFunded(uint256 indexed _coreDisputeID, uint256 indexed _coreRoundID, uint256 indexed _choice);\\n\\n // ************************************* //\\n // * Modifiers * //\\n // ************************************* //\\n\\n modifier notJumped(uint256 _coreDisputeID) {\\n require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, \\\"Dispute jumped to a parent DK!\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _core The KlerosCore arbitrator.\\n */\\n constructor(address _governor, KlerosCore _core) BaseDisputeKit(_governor, _core) {}\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `core` storage variable.\\n /// @param _core The new value for the `core` storage variable.\\n function changeCore(address _core) external onlyByGovernor {\\n core = KlerosCore(_core);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n /// @param _nbVotes Number of votes for this dispute.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external override onlyByCore {\\n uint256 localDisputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.numberOfChoices = _numberOfChoices;\\n dispute.extraData = _extraData;\\n\\n // New round in the Core should be created before the dispute creation in DK.\\n dispute.coreRoundIDToLocal[core.getNumberOfRounds(_coreDisputeID) - 1] = dispute.rounds.length;\\n\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = _nbVotes;\\n round.tied = true;\\n\\n coreDisputeIDToLocal[_coreDisputeID] = localDisputeID;\\n emit DisputeCreation(_coreDisputeID, _numberOfChoices, _extraData);\\n }\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _nonce Nonce of the drawing iteration.\\n /// @return drawnAddress The drawn address.\\n function draw(\\n uint256 _coreDisputeID,\\n uint256 _nonce\\n ) external override onlyByCore notJumped(_coreDisputeID) returns (address drawnAddress) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n\\n ISortitionModule sortitionModule = core.sortitionModule();\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n bytes32 key = bytes32(uint256(courtID)); // Get the ID of the tree.\\n\\n // TODO: Handle the situation when no one has staked yet.\\n drawnAddress = sortitionModule.draw(key, _coreDisputeID, _nonce);\\n\\n if (_postDrawCheck(_coreDisputeID, drawnAddress)) {\\n round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false}));\\n } else {\\n drawnAddress = address(0);\\n }\\n }\\n\\n /// @dev Sets the caller's commit for the specified votes. It can be called multiple times during the\\n /// commit period, each call overrides the commits of the previous one.\\n /// `O(n)` where\\n /// `n` is the number of votes.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _voteIDs The IDs of the votes.\\n /// @param _commit The commit. Note that justification string is a part of the commit.\\n function castCommit(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.commit, \\\"The dispute should be in Commit period.\\\");\\n require(_commit != bytes32(0), \\\"Empty commit.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n round.votes[_voteIDs[i]].commit = _commit;\\n }\\n round.totalCommitted += _voteIDs.length;\\n emit CommitCast(_coreDisputeID, msg.sender, _voteIDs, _commit);\\n }\\n\\n /// @dev Sets the caller's choices for the specified votes.\\n /// `O(n)` where\\n /// `n` is the number of votes.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _voteIDs The IDs of the votes.\\n /// @param _choice The choice.\\n /// @param _salt The salt for the commit if the votes were hidden.\\n /// @param _justification Justification of the choice.\\n function castVote(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.vote, \\\"The dispute should be in Vote period.\\\");\\n require(_voteIDs.length > 0, \\\"No voteID provided\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"Choice out of bounds\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , , ) = core.courts(courtID);\\n\\n // Save the votes.\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n require(\\n !hiddenVotes ||\\n round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),\\n \\\"The commit must match the choice in courts with hidden votes.\\\"\\n );\\n require(!round.votes[_voteIDs[i]].voted, \\\"Vote already cast.\\\");\\n round.votes[_voteIDs[i]].choice = _choice;\\n round.votes[_voteIDs[i]].voted = true;\\n }\\n\\n round.totalVoted += _voteIDs.length;\\n\\n round.counts[_choice] += _voteIDs.length;\\n if (_choice == round.winningChoice) {\\n if (round.tied) round.tied = false;\\n } else {\\n // Voted for another choice.\\n if (round.counts[_choice] == round.counts[round.winningChoice]) {\\n // Tie.\\n if (!round.tied) round.tied = true;\\n } else if (round.counts[_choice] > round.counts[round.winningChoice]) {\\n // New winner.\\n round.winningChoice = _choice;\\n round.tied = false;\\n }\\n }\\n emit VoteCast(_coreDisputeID, msg.sender, _voteIDs, _choice, _justification);\\n }\\n\\n /// @dev Manages contributions, and appeals a dispute if at least two choices are fully funded.\\n /// Note that the surplus deposit will be reimbursed.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core.\\n /// @param _choice A choice that receives funding.\\n function fundAppeal(uint256 _coreDisputeID, uint256 _choice) external payable notJumped(_coreDisputeID) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"There is no such ruling to fund.\\\");\\n\\n (uint256 appealPeriodStart, uint256 appealPeriodEnd) = core.appealPeriod(_coreDisputeID);\\n require(block.timestamp >= appealPeriodStart && block.timestamp < appealPeriodEnd, \\\"Appeal period is over.\\\");\\n\\n uint256 multiplier;\\n (uint256 ruling, , ) = this.currentRuling(_coreDisputeID);\\n if (ruling == _choice) {\\n multiplier = WINNER_STAKE_MULTIPLIER;\\n } else {\\n require(\\n block.timestamp - appealPeriodStart <\\n ((appealPeriodEnd - appealPeriodStart) * LOSER_APPEAL_PERIOD_MULTIPLIER) / ONE_BASIS_POINT,\\n \\\"Appeal period is over for loser\\\"\\n );\\n multiplier = LOSER_STAKE_MULTIPLIER;\\n }\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n uint256 coreRoundID = core.getNumberOfRounds(_coreDisputeID) - 1;\\n\\n require(!round.hasPaid[_choice], \\\"Appeal fee is already paid.\\\");\\n uint256 appealCost = core.appealCost(_coreDisputeID);\\n uint256 totalCost = appealCost + (appealCost * multiplier) / ONE_BASIS_POINT;\\n\\n // Take up to the amount necessary to fund the current round at the current costs.\\n uint256 contribution;\\n if (totalCost > round.paidFees[_choice]) {\\n contribution = totalCost - round.paidFees[_choice] > msg.value // Overflows and underflows will be managed on the compiler level.\\n ? msg.value\\n : totalCost - round.paidFees[_choice];\\n emit Contribution(_coreDisputeID, coreRoundID, _choice, msg.sender, contribution);\\n }\\n\\n round.contributions[msg.sender][_choice] += contribution;\\n round.paidFees[_choice] += contribution;\\n if (round.paidFees[_choice] >= totalCost) {\\n round.feeRewards += round.paidFees[_choice];\\n round.fundedChoices.push(_choice);\\n round.hasPaid[_choice] = true;\\n emit ChoiceFunded(_coreDisputeID, coreRoundID, _choice);\\n }\\n\\n if (round.fundedChoices.length > 1) {\\n // At least two sides are fully funded.\\n round.feeRewards = round.feeRewards - appealCost;\\n\\n if (core.isDisputeKitJumping(_coreDisputeID)) {\\n // Don't create a new round in case of a jump, and remove local dispute from the flow.\\n dispute.jumped = true;\\n } else {\\n // Don't subtract 1 from length since both round arrays haven't been updated yet.\\n dispute.coreRoundIDToLocal[coreRoundID + 1] = dispute.rounds.length;\\n\\n Round storage newRound = dispute.rounds.push();\\n newRound.nbVotes = core.getNumberOfVotes(_coreDisputeID);\\n newRound.tied = true;\\n }\\n core.appeal{value: appealCost}(_coreDisputeID, dispute.numberOfChoices, dispute.extraData);\\n }\\n\\n if (msg.value > contribution) payable(msg.sender).send(msg.value - contribution);\\n }\\n\\n /// @dev Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core contract.\\n /// @param _beneficiary The address whose rewards to withdraw.\\n /// @param _coreRoundID The round in the Kleros Core contract the caller wants to withdraw from.\\n /// @param _choice The ruling option that the caller wants to withdraw from.\\n /// @return amount The withdrawn amount.\\n function withdrawFeesAndRewards(\\n uint256 _coreDisputeID,\\n address payable _beneficiary,\\n uint256 _coreRoundID,\\n uint256 _choice\\n ) external returns (uint256 amount) {\\n (, , , bool isRuled, ) = core.disputes(_coreDisputeID);\\n require(isRuled, \\\"Dispute should be resolved.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 finalRuling, , ) = core.currentRuling(_coreDisputeID);\\n\\n if (!round.hasPaid[_choice]) {\\n // Allow to reimburse if funding was unsuccessful for this ruling option.\\n amount = round.contributions[_beneficiary][_choice];\\n } else {\\n // Funding was successful for this ruling option.\\n if (_choice == finalRuling) {\\n // This ruling option is the ultimate winner.\\n amount = round.paidFees[_choice] > 0\\n ? (round.contributions[_beneficiary][_choice] * round.feeRewards) / round.paidFees[_choice]\\n : 0;\\n } else if (!round.hasPaid[finalRuling]) {\\n // The ultimate winner was not funded in this round. In this case funded ruling option(s) are reimbursed.\\n amount =\\n (round.contributions[_beneficiary][_choice] * round.feeRewards) /\\n (round.paidFees[round.fundedChoices[0]] + round.paidFees[round.fundedChoices[1]]);\\n }\\n }\\n round.contributions[_beneficiary][_choice] = 0;\\n\\n if (amount != 0) {\\n _beneficiary.send(amount); // Deliberate use of send to prevent reverting fallback. It's the user's responsibility to accept ETH.\\n emit Withdrawal(_coreDisputeID, _coreRoundID, _choice, _beneficiary, amount);\\n }\\n }\\n\\n /// @dev Submits evidence for a dispute.\\n /// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID.\\n /// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\\n function submitEvidence(uint256 _externalDisputeID, string calldata _evidence) external {\\n emit Evidence(_externalDisputeID, msg.sender, _evidence);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return lastRound.fundedChoices;\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(\\n uint256 _coreDisputeID\\n ) external view override returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n tied = round.tied;\\n ruling = tied ? 0 : round.winningChoice;\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n // Override the final ruling if only one side funded the appeals.\\n if (period == KlerosCore.Period.execution) {\\n uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);\\n if (fundedChoices.length == 1) {\\n ruling = fundedChoices[0];\\n tied = false;\\n overridden = true;\\n }\\n }\\n }\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (uint256) {\\n // In this contract this degree can be either 0 or 1, but in other dispute kits this value can be something in between.\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (vote.voted && (vote.choice == winningChoice || tied)) {\\n return ONE_BASIS_POINT;\\n } else {\\n return 0;\\n }\\n }\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view override returns (uint256) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage currentRound = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (currentRound.totalVoted == 0 || (!tied && currentRound.counts[winningChoice] == 0)) {\\n return 0;\\n } else if (tied) {\\n return currentRound.totalVoted;\\n } else {\\n return currentRound.counts[winningChoice];\\n }\\n }\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalCommitted == round.votes.length;\\n }\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalVoted == round.votes.length;\\n }\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n return vote.voted;\\n }\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n override\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n )\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n return (\\n round.winningChoice,\\n round.tied,\\n round.totalVoted,\\n round.totalCommitted,\\n round.votes.length,\\n round.counts[_choice]\\n );\\n }\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (address account, bytes32 commit, uint256 choice, bool voted) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n return (vote.account, vote.commit, vote.choice, vote.voted);\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @inheritdoc BaseDisputeKit\\n function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) {\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n uint256 lockedAmountPerJuror = core\\n .getRoundInfo(_coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1)\\n .pnkAtStakePerJuror;\\n (uint256 totalStaked, uint256 totalLocked, , ) = core.getJurorBalance(_juror, courtID);\\n return totalStaked >= totalLocked + lockedAmountPerJuror;\\n }\\n}\\n\",\"keccak256\":\"0xf21eb2d006bf25fc29b59118af4ed395d06d8ac6397c6dc53d3b1d8414e21dc3\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n/// @title IEvidence\\ninterface IEvidence {\\n /// @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\\n /// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.\\n /// @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\\n /// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\\n event Evidence(uint256 indexed _externalDisputeID, address indexed _party, string _evidence);\\n}\\n\",\"keccak256\":\"0x3350da62267a5dad4616dafd9916fe3bfa4cdabfce124709ac3b7d087361e8c4\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060405162003abc38038062003abc83398101604081905262000034916200007f565b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055620000be565b6001600160a01b03811681146200007c57600080fd5b50565b600080604083850312156200009357600080fd5b8251620000a08162000066565b6020840151909250620000b38162000066565b809150509250929050565b6139ee80620000ce6000396000f3fe60806040526004361061016c5760003560e01c8063796490f9116100cc578063ba66fde71161007a578063ba66fde7146104ac578063be467604146104cc578063d2b8035a146104e2578063da3beb8c14610502578063e349ad30146103b4578063e4c0aaf414610522578063f2f4eb261461054257600080fd5b8063796490f9146103b45780637c04034e146103ca5780638e426460146103ea578063a6a7f0eb1461040a578063a7cc08fe1461042a578063b34bfaa814610476578063b6ede5401461048c57600080fd5b80634fe264fb116101295780634fe264fb1461028b578063564a565d146102ab5780635c92e2f6146102da57806365540b96146102fa57806369f3f041146103275780636d4cd8ea14610374578063751accd01461039457600080fd5b80630baa64d1146101715780630c340a24146101a65780631200aabc146101de5780631c3db16d14610219578063362c3479146102565780634b2f0ea014610276575b600080fd5b34801561017d57600080fd5b5061019161018c366004612cbd565b610562565b60405190151581526020015b60405180910390f35b3480156101b257600080fd5b506000546101c6906001600160a01b031681565b6040516001600160a01b03909116815260200161019d565b3480156101ea57600080fd5b5061020b6101f9366004612cbd565b60036020526000908152604090205481565b60405190815260200161019d565b34801561022557600080fd5b50610239610234366004612cbd565b6105d9565b60408051938452911515602084015215159082015260600161019d565b34801561026257600080fd5b5061020b610271366004612cee565b610747565b610289610284366004612d2b565b610b1d565b005b34801561029757600080fd5b5061020b6102a6366004612d4d565b611384565b3480156102b757600080fd5b506102cb6102c6366004612cbd565b6114c7565b60405161019d93929190612dc9565b3480156102e657600080fd5b506102896102f5366004612e3e565b61158d565b34801561030657600080fd5b5061031a610315366004612cbd565b61189a565b60405161019d9190612e90565b34801561033357600080fd5b50610347610342366004612d4d565b61195e565b604080519687529415156020870152938501929092526060840152608083015260a082015260c00161019d565b34801561038057600080fd5b5061019161038f366004612cbd565b611a16565b3480156103a057600080fd5b506102896103af366004612f9a565b611a8d565b3480156103c057600080fd5b5061020b61271081565b3480156103d657600080fd5b506102896103e5366004613006565b611b5f565b3480156103f657600080fd5b5061028961040536600461309e565b61223b565b34801561041657600080fd5b506102896104253660046130fc565b612287565b34801561043657600080fd5b5061044a610445366004612d4d565b6122d0565b604080516001600160a01b0390951685526020850193909352918301521515606082015260800161019d565b34801561048257600080fd5b5061020b614e2081565b34801561049857600080fd5b506102896104a7366004613147565b612396565b3480156104b857600080fd5b506101916104c7366004612d4d565b61256b565b3480156104d857600080fd5b5061020b61138881565b3480156104ee57600080fd5b506101c66104fd366004612d2b565b612606565b34801561050e57600080fd5b5061020b61051d366004612d2b565b61290f565b34801561052e57600080fd5b5061028961053d36600461309e565b612a62565b34801561054e57600080fd5b506001546101c6906001600160a01b031681565b600081815260036020526040812054600280548392908110610586576105866131a1565b600091825260208220600590910201805490925082906105a8906001906131cd565b815481106105b8576105b86131a1565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806002600360008781526020019081526020016000205481548110610605576106056131a1565b60009182526020822060059091020180549092508290610627906001906131cd565b81548110610637576106376131a1565b60009182526020909120600c90910201600381015460ff169450905083610662578060010154610665565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d8919061320c565b50909350600492506106e8915050565b8160048111156106fa576106fa613273565b0361073d57600061070a8861189a565b9050805160010361073b5780600081518110610728576107286131a1565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b9919061320c565b509350505050806108115760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064015b60405180910390fd5b600086815260036020526040812054600280549091908110610835576108356131a1565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610869576108696131a1565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa1580156108c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e89190613289565b5050600087815260078401602052604090205490915060ff16610932576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610a77565b8086036109a75760008681526006830160205260409020546109555760006109a0565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461099691906132c5565b6109a091906132dc565b9450610a77565b600081815260078301602052604090205460ff16610a775781600601600083600a016001815481106109db576109db6131a1565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610a1157610a116131a1565b9060005260206000200154815260200190815260200160002054610a3591906132fe565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610a6a91906132c5565b610a7491906132dc565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610b11576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b600082815260036020526040902054600280548492908110610b4157610b416131a1565b600091825260209091206002600590920201015460ff1615610b755760405162461bcd60e51b815260040161080890613311565b600083815260036020526040812054600280549091908110610b9957610b996131a1565b906000526020600020906005020190508060010154831115610bfd5760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610808565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa158015610c4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6e9190613348565b91509150814210158015610c8157508042105b610cc65760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610808565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015610d07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2b9190613289565b50509050868103610d40576127109150610dc1565b612710611388610d5086866131cd565b610d5a91906132c5565b610d6491906132dc565b610d6e85426131cd565b10610dbb5760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610808565b614e2091505b84546000908690610dd4906001906131cd565b81548110610de457610de46131a1565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e67919061336c565b610e7191906131cd565b60008a815260078401602052604090205490915060ff1615610ed55760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610808565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa158015610f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f43919061336c565b90506000612710610f5487846132c5565b610f5e91906132dc565b610f6890836132fe565b60008c8152600686016020526040812054919250908211156110195760008c81526006860160205260409020543490610fa190846131cd565b11610fc65760008c8152600686016020526040902054610fc190836131cd565b610fc8565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611010929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906110459084906132fe565b909155505060008c81526006860160205260408120805483929061106a9084906132fe565b909155505060008c8152600686016020526040902054821161113c5760008c8152600686016020526040812054600987018054919290916110ac9084906132fe565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156113475782856009015461115991906131cd565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa1580156111a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cb9190613385565b156111e45760028a01805460ff191660011790556112c7565b895460038b0160006111f78760016132fe565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b815260040161127291815260200190565b602060405180830381865afa15801561128f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b3919061336c565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b8152600401611314939291906133da565b6000604051808303818588803b15801561132d57600080fd5b505af1158015611341573d6000803e3d6000fd5b50505050505b8034111561137557336108fc61135d83346131cd565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000838152600360205260408120546002805483929081106113a8576113a86131a1565b600091825260208083208784526003600590930201918201905260408220548154919350839181106113dc576113dc6131a1565b90600052602060002090600c020160000184815481106113fe576113fe6131a1565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa15801561145c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114809190613289565b506003850154919350915060ff1680156114a4575081836002015414806114a45750805b156114b7576127109450505050506114c0565b60009450505050505b9392505050565b600281815481106114d757600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161150a906133a0565b80601f0160208091040260200160405190810160405280929190818152602001828054611536906133a0565b80156115835780601f1061155857610100808354040283529160200191611583565b820191906000526020600020905b81548152906001019060200180831161156657829003601f168201915b5050505050905083565b6000848152600360205260409020546002805486929081106115b1576115b16131a1565b600091825260209091206002600590920201015460ff16156115e55760405162461bcd60e51b815260040161080890613311565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa15801561162f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611653919061320c565b5090935060019250611663915050565b81600481111561167557611675613273565b146116d25760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610808565b8261170f5760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610808565b600086815260036020526040812054600280549091908110611733576117336131a1565b60009182526020822060059091020180549092508290611755906001906131cd565b81548110611765576117656131a1565b90600052602060002090600c0201905060005b86811015611833573382898984818110611794576117946131a1565b90506020020135815481106117ab576117ab6131a1565b60009182526020909120600490910201546001600160a01b0316146117e25760405162461bcd60e51b815260040161080890613474565b85828989848181106117f6576117f66131a1565b905060200201358154811061180d5761180d6131a1565b60009182526020909120600160049092020101558061182b816134ab565b915050611778565b508686905081600501600082825461184b91906132fe565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890611888908b908b908b906134f6565b60405180910390a35050505050505050565b60008181526003602052604081205460028054606093929081106118c0576118c06131a1565b600091825260208220600590910201805490925082906118e2906001906131cd565b815481106118f2576118f26131a1565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561195057602002820191906000526020600020905b81548152602001906001019080831161193c575b505050505092505050919050565b60008060008060008060006002600360008c8152602001908152602001600020548154811061198f5761198f6131a1565b600091825260208083208c84526003600590930201918201905260408220548154919350839181106119c3576119c36131a1565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611a3a57611a3a6131a1565b60009182526020822060059091020180549092508290611a5c906001906131cd565b81548110611a6c57611a6c6131a1565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b03163314611ab75760405162461bcd60e51b81526004016108089061351a565b6000836001600160a01b03168383604051611ad2919061355c565b60006040518083038185875af1925050503d8060008114611b0f576040519150601f19603f3d011682016040523d82523d6000602084013e611b14565b606091505b5050905080611b595760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610808565b50505050565b600086815260036020526040902054600280548892908110611b8357611b836131a1565b600091825260209091206002600590920201015460ff1615611bb75760405162461bcd60e51b815260040161080890613311565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c25919061320c565b5090935060029250611c35915050565b816004811115611c4757611c47613273565b14611ca25760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610808565b85611ce45760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610808565b600088815260036020526040812054600280549091908110611d0857611d086131a1565b906000526020600020906005020190508060010154861115611d635760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610808565b80546000908290611d76906001906131cd565b81548110611d8657611d866131a1565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015611de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e05919061320c565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015611e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e849190613578565b505050505091505060005b8a8110156121015733848d8d84818110611eab57611eab6131a1565b9050602002013581548110611ec257611ec26131a1565b60009182526020909120600490910201546001600160a01b031614611ef95760405162461bcd60e51b815260040161080890613474565b811580611f6d575089888a604051602001611f16939291906135e2565b60405160208183030381529060405280519060200120846000018d8d84818110611f4257611f426131a1565b9050602002013581548110611f5957611f596131a1565b906000526020600020906004020160010154145b611fdf5760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610808565b838c8c83818110611ff257611ff26131a1565b9050602002013581548110612009576120096131a1565b600091825260209091206003600490920201015460ff16156120625760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610808565b89848d8d84818110612076576120766131a1565b905060200201358154811061208d5761208d6131a1565b60009182526020909120600260049092020101556001848d8d848181106120b6576120b66131a1565b90506020020135815481106120cd576120cd6131a1565b60009182526020909120600490910201600301805460ff1916911515919091179055806120f9816134ab565b915050611e8f565b508a8a905083600401600082825461211991906132fe565b90915550506000898152600284016020526040812080548c929061213e9084906132fe565b90915550506001830154890361216d57600383015460ff16156121685760038301805460ff191690555b6121e6565b60018301546000908152600284016020526040808220548b8352912054036121af57600383015460ff166121685760038301805460ff191660011790556121e6565b60018301546000908152600284016020526040808220548b835291205411156121e6576001830189905560038301805460ff191690555b88336001600160a01b03168d7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48e8e8c6040516122259392919061360f565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146122655760405162461bcd60e51b81526004016108089061351a565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce10699684846040516122c3929190613668565b60405180910390a3505050565b60008060008060006002600360008a815260200190815260200160002054815481106122fe576122fe6131a1565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612332576123326131a1565b90600052602060002090600c02016000018781548110612354576123546131a1565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146123c05760405162461bcd60e51b815260040161080890613684565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad20161244b858783613717565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa1580156124a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c6919061336c565b6124d091906131cd565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab5810890612559908a908a908a906137d7565b60405180910390a25050505050505050565b60008381526003602052604081205460028054839290811061258f5761258f6131a1565b600091825260208083208784526003600590930201918201905260408220548154919350839181106125c3576125c36131a1565b90600052602060002090600c020160000184815481106125e5576125e56131a1565b600091825260209091206004909102016003015460ff169695505050505050565b6001546000906001600160a01b031633146126335760405162461bcd60e51b815260040161080890613684565b600083815260036020526040902054600280548592908110612657576126576131a1565b600091825260209091206002600590920201015460ff161561268b5760405162461bcd60e51b815260040161080890613311565b6000848152600360205260408120546002805490919081106126af576126af6131a1565b600091825260208220600590910201805490925082906126d1906001906131cd565b815481106126e1576126e16131a1565b90600052602060002090600c020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276a91906137f1565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156127b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127dd919061320c565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa158015612841573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286591906137f1565b96506128718988612aae565b156128fe57604080516080810182526001600160a01b03898116825260006020808401828152948401828152606085018381528a5460018082018d558c8652939094209551600490940290950180546001600160a01b0319169390941692909217835593519382019390935591516002830155516003909101805460ff1916911515919091179055612903565b600096505b50505050505092915050565b600082815260036020526040812054600280548392908110612933576129336131a1565b60009182526020808320868452600360059093020191820190526040822054815491935083918110612967576129676131a1565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa1580156129c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ea9190613289565b5091509150826004015460001480612a19575080158015612a1957506000828152600284016020526040902054155b15612a2b576000945050505050612a5c565b8015612a40575050600401549150612a5c9050565b506000908152600290910160205260409020549150612a5c9050565b92915050565b6000546001600160a01b03163314612a8c5760405162461bcd60e51b81526004016108089061351a565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b20919061320c565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba3919061336c565b612bad91906131cd565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612bee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c1691908101906138a1565b60200151600154604051631a383be960e31b81526001600160a01b0387811660048301526001600160601b03861660248301529293506000928392169063d1c1df4890604401608060405180830381865afa158015612c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c9d9190613982565b5050915091508281612caf91906132fe565b909110159695505050505050565b600060208284031215612ccf57600080fd5b5035919050565b6001600160a01b0381168114612ceb57600080fd5b50565b60008060008060808587031215612d0457600080fd5b843593506020850135612d1681612cd6565b93969395505050506040820135916060013590565b60008060408385031215612d3e57600080fd5b50508035926020909101359150565b600080600060608486031215612d6257600080fd5b505081359360208301359350604090920135919050565b60005b83811015612d94578181015183820152602001612d7c565b50506000910152565b60008151808452612db5816020860160208601612d79565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000612dea6060830184612d9d565b95945050505050565b60008083601f840112612e0557600080fd5b5081356001600160401b03811115612e1c57600080fd5b6020830191508360208260051b8501011115612e3757600080fd5b9250929050565b60008060008060608587031215612e5457600080fd5b8435935060208501356001600160401b03811115612e7157600080fd5b612e7d87828801612df3565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015612ec857835183529284019291840191600101612eac565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b0381118282101715612f0d57612f0d612ed4565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612f3b57612f3b612ed4565b604052919050565b60006001600160401b03831115612f5c57612f5c612ed4565b612f6f601f8401601f1916602001612f13565b9050828152838383011115612f8357600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215612faf57600080fd5b8335612fba81612cd6565b92506020840135915060408401356001600160401b03811115612fdc57600080fd5b8401601f81018613612fed57600080fd5b612ffc86823560208401612f43565b9150509250925092565b60008060008060008060a0878903121561301f57600080fd5b8635955060208701356001600160401b038082111561303d57600080fd5b6130498a838b01612df3565b90975095506040890135945060608901359350608089013591508082111561307057600080fd5b508701601f8101891361308257600080fd5b61309189823560208401612f43565b9150509295509295509295565b6000602082840312156130b057600080fd5b81356114c081612cd6565b60008083601f8401126130cd57600080fd5b5081356001600160401b038111156130e457600080fd5b602083019150836020828501011115612e3757600080fd5b60008060006040848603121561311157600080fd5b8335925060208401356001600160401b0381111561312e57600080fd5b61313a868287016130bb565b9497909650939450505050565b60008060008060006080868803121561315f57600080fd5b853594506020860135935060408601356001600160401b0381111561318357600080fd5b61318f888289016130bb565b96999598509660600135949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115612a5c57612a5c6131b7565b80516001600160601b03811681146131f757600080fd5b919050565b805180151581146131f757600080fd5b600080600080600060a0868803121561322457600080fd5b61322d866131e0565b9450602086015161323d81612cd6565b60408701519094506005811061325257600080fd5b9250613260606087016131fc565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60008060006060848603121561329e57600080fd5b835192506132ae602085016131fc565b91506132bc604085016131fc565b90509250925092565b8082028115828204841417612a5c57612a5c6131b7565b6000826132f957634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612a5c57612a5c6131b7565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b6000806040838503121561335b57600080fd5b505080516020909101519092909150565b60006020828403121561337e57600080fd5b5051919050565b60006020828403121561339757600080fd5b6114c0826131fc565b600181811c908216806133b457607f821691505b6020821081036133d457634e487b7160e01b600052602260045260246000fd5b50919050565b83815260006020848184015260606040840152600084546133fa816133a0565b806060870152608060018084166000811461341c576001811461343657613464565b60ff1985168984015283151560051b890183019550613464565b896000528660002060005b8581101561345c5781548b8201860152908301908801613441565b8a0184019650505b50939a9950505050505050505050565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6000600182016134bd576134bd6131b7565b5060010190565b81835260006001600160fb1b038311156134dd57600080fd5b8260051b80836020870137939093016020019392505050565b60408152600061350a6040830185876134c4565b9050826020830152949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6000825161356e818460208701612d79565b9190910192915050565b600080600080600080600060e0888a03121561359357600080fd5b61359c886131e0565b96506135aa602089016131fc565b955060408801519450606088015193506080880151925060a088015191506135d460c089016131fc565b905092959891949750929550565b838152600083516135fa816020850160208801612d79565b60209201918201929092526040019392505050565b6040815260006136236040830185876134c4565b82810360208401526136358185612d9d565b9695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152600061367c60208301848661363f565b949350505050565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f82111561371257600081815260208120601f850160051c810160208610156136ef5750805b601f850160051c820191505b8181101561370e578281556001016136fb565b5050505b505050565b6001600160401b0383111561372e5761372e612ed4565b6137428361373c83546133a0565b836136c8565b6000601f841160018114613776576000851561375e5750838201355b600019600387901b1c1916600186901b1783556137d0565b600083815260209020601f19861690835b828110156137a75786850135825560209485019460019092019101613787565b50868210156137c45760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b838152604060208201526000612dea60408301848661363f565b60006020828403121561380357600080fd5b81516114c081612cd6565b600082601f83011261381f57600080fd5b815160206001600160401b0382111561383a5761383a612ed4565b8160051b613849828201612f13565b928352848101820192828101908785111561386357600080fd5b83870192505b8483101561388b57825161387c81612cd6565b82529183019190830190613869565b979650505050505050565b80516131f781612cd6565b6000602082840312156138b357600080fd5b81516001600160401b03808211156138ca57600080fd5b9083019061016082860312156138df57600080fd5b6138e7612eea565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c08301518281111561392f57600080fd5b61393b8782860161380e565b60c08301525060e0838101519082015261010080840151908201526101209150613966828401613896565b9181019190915261014091820151918101919091529392505050565b6000806000806080858703121561399857600080fd5b50508251602084015160408501516060909501519196909550909250905056fea2646970667358221220f038a011ed6599f97ebefd5fc379a24f22d334c34c2c7b6283848b77233ef58864736f6c63430008120033", - "deployedBytecode": "0x60806040526004361061016c5760003560e01c8063796490f9116100cc578063ba66fde71161007a578063ba66fde7146104ac578063be467604146104cc578063d2b8035a146104e2578063da3beb8c14610502578063e349ad30146103b4578063e4c0aaf414610522578063f2f4eb261461054257600080fd5b8063796490f9146103b45780637c04034e146103ca5780638e426460146103ea578063a6a7f0eb1461040a578063a7cc08fe1461042a578063b34bfaa814610476578063b6ede5401461048c57600080fd5b80634fe264fb116101295780634fe264fb1461028b578063564a565d146102ab5780635c92e2f6146102da57806365540b96146102fa57806369f3f041146103275780636d4cd8ea14610374578063751accd01461039457600080fd5b80630baa64d1146101715780630c340a24146101a65780631200aabc146101de5780631c3db16d14610219578063362c3479146102565780634b2f0ea014610276575b600080fd5b34801561017d57600080fd5b5061019161018c366004612cbd565b610562565b60405190151581526020015b60405180910390f35b3480156101b257600080fd5b506000546101c6906001600160a01b031681565b6040516001600160a01b03909116815260200161019d565b3480156101ea57600080fd5b5061020b6101f9366004612cbd565b60036020526000908152604090205481565b60405190815260200161019d565b34801561022557600080fd5b50610239610234366004612cbd565b6105d9565b60408051938452911515602084015215159082015260600161019d565b34801561026257600080fd5b5061020b610271366004612cee565b610747565b610289610284366004612d2b565b610b1d565b005b34801561029757600080fd5b5061020b6102a6366004612d4d565b611384565b3480156102b757600080fd5b506102cb6102c6366004612cbd565b6114c7565b60405161019d93929190612dc9565b3480156102e657600080fd5b506102896102f5366004612e3e565b61158d565b34801561030657600080fd5b5061031a610315366004612cbd565b61189a565b60405161019d9190612e90565b34801561033357600080fd5b50610347610342366004612d4d565b61195e565b604080519687529415156020870152938501929092526060840152608083015260a082015260c00161019d565b34801561038057600080fd5b5061019161038f366004612cbd565b611a16565b3480156103a057600080fd5b506102896103af366004612f9a565b611a8d565b3480156103c057600080fd5b5061020b61271081565b3480156103d657600080fd5b506102896103e5366004613006565b611b5f565b3480156103f657600080fd5b5061028961040536600461309e565b61223b565b34801561041657600080fd5b506102896104253660046130fc565b612287565b34801561043657600080fd5b5061044a610445366004612d4d565b6122d0565b604080516001600160a01b0390951685526020850193909352918301521515606082015260800161019d565b34801561048257600080fd5b5061020b614e2081565b34801561049857600080fd5b506102896104a7366004613147565b612396565b3480156104b857600080fd5b506101916104c7366004612d4d565b61256b565b3480156104d857600080fd5b5061020b61138881565b3480156104ee57600080fd5b506101c66104fd366004612d2b565b612606565b34801561050e57600080fd5b5061020b61051d366004612d2b565b61290f565b34801561052e57600080fd5b5061028961053d36600461309e565b612a62565b34801561054e57600080fd5b506001546101c6906001600160a01b031681565b600081815260036020526040812054600280548392908110610586576105866131a1565b600091825260208220600590910201805490925082906105a8906001906131cd565b815481106105b8576105b86131a1565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806002600360008781526020019081526020016000205481548110610605576106056131a1565b60009182526020822060059091020180549092508290610627906001906131cd565b81548110610637576106376131a1565b60009182526020909120600c90910201600381015460ff169450905083610662578060010154610665565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d8919061320c565b50909350600492506106e8915050565b8160048111156106fa576106fa613273565b0361073d57600061070a8861189a565b9050805160010361073b5780600081518110610728576107286131a1565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b9919061320c565b509350505050806108115760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064015b60405180910390fd5b600086815260036020526040812054600280549091908110610835576108356131a1565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610869576108696131a1565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa1580156108c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e89190613289565b5050600087815260078401602052604090205490915060ff16610932576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610a77565b8086036109a75760008681526006830160205260409020546109555760006109a0565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461099691906132c5565b6109a091906132dc565b9450610a77565b600081815260078301602052604090205460ff16610a775781600601600083600a016001815481106109db576109db6131a1565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610a1157610a116131a1565b9060005260206000200154815260200190815260200160002054610a3591906132fe565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610a6a91906132c5565b610a7491906132dc565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610b11576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b600082815260036020526040902054600280548492908110610b4157610b416131a1565b600091825260209091206002600590920201015460ff1615610b755760405162461bcd60e51b815260040161080890613311565b600083815260036020526040812054600280549091908110610b9957610b996131a1565b906000526020600020906005020190508060010154831115610bfd5760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610808565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa158015610c4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6e9190613348565b91509150814210158015610c8157508042105b610cc65760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610808565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015610d07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2b9190613289565b50509050868103610d40576127109150610dc1565b612710611388610d5086866131cd565b610d5a91906132c5565b610d6491906132dc565b610d6e85426131cd565b10610dbb5760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610808565b614e2091505b84546000908690610dd4906001906131cd565b81548110610de457610de46131a1565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e67919061336c565b610e7191906131cd565b60008a815260078401602052604090205490915060ff1615610ed55760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610808565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa158015610f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f43919061336c565b90506000612710610f5487846132c5565b610f5e91906132dc565b610f6890836132fe565b60008c8152600686016020526040812054919250908211156110195760008c81526006860160205260409020543490610fa190846131cd565b11610fc65760008c8152600686016020526040902054610fc190836131cd565b610fc8565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611010929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906110459084906132fe565b909155505060008c81526006860160205260408120805483929061106a9084906132fe565b909155505060008c8152600686016020526040902054821161113c5760008c8152600686016020526040812054600987018054919290916110ac9084906132fe565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156113475782856009015461115991906131cd565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa1580156111a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cb9190613385565b156111e45760028a01805460ff191660011790556112c7565b895460038b0160006111f78760016132fe565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b815260040161127291815260200190565b602060405180830381865afa15801561128f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b3919061336c565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b8152600401611314939291906133da565b6000604051808303818588803b15801561132d57600080fd5b505af1158015611341573d6000803e3d6000fd5b50505050505b8034111561137557336108fc61135d83346131cd565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000838152600360205260408120546002805483929081106113a8576113a86131a1565b600091825260208083208784526003600590930201918201905260408220548154919350839181106113dc576113dc6131a1565b90600052602060002090600c020160000184815481106113fe576113fe6131a1565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa15801561145c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114809190613289565b506003850154919350915060ff1680156114a4575081836002015414806114a45750805b156114b7576127109450505050506114c0565b60009450505050505b9392505050565b600281815481106114d757600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161150a906133a0565b80601f0160208091040260200160405190810160405280929190818152602001828054611536906133a0565b80156115835780601f1061155857610100808354040283529160200191611583565b820191906000526020600020905b81548152906001019060200180831161156657829003601f168201915b5050505050905083565b6000848152600360205260409020546002805486929081106115b1576115b16131a1565b600091825260209091206002600590920201015460ff16156115e55760405162461bcd60e51b815260040161080890613311565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa15801561162f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611653919061320c565b5090935060019250611663915050565b81600481111561167557611675613273565b146116d25760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610808565b8261170f5760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610808565b600086815260036020526040812054600280549091908110611733576117336131a1565b60009182526020822060059091020180549092508290611755906001906131cd565b81548110611765576117656131a1565b90600052602060002090600c0201905060005b86811015611833573382898984818110611794576117946131a1565b90506020020135815481106117ab576117ab6131a1565b60009182526020909120600490910201546001600160a01b0316146117e25760405162461bcd60e51b815260040161080890613474565b85828989848181106117f6576117f66131a1565b905060200201358154811061180d5761180d6131a1565b60009182526020909120600160049092020101558061182b816134ab565b915050611778565b508686905081600501600082825461184b91906132fe565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890611888908b908b908b906134f6565b60405180910390a35050505050505050565b60008181526003602052604081205460028054606093929081106118c0576118c06131a1565b600091825260208220600590910201805490925082906118e2906001906131cd565b815481106118f2576118f26131a1565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561195057602002820191906000526020600020905b81548152602001906001019080831161193c575b505050505092505050919050565b60008060008060008060006002600360008c8152602001908152602001600020548154811061198f5761198f6131a1565b600091825260208083208c84526003600590930201918201905260408220548154919350839181106119c3576119c36131a1565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611a3a57611a3a6131a1565b60009182526020822060059091020180549092508290611a5c906001906131cd565b81548110611a6c57611a6c6131a1565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b03163314611ab75760405162461bcd60e51b81526004016108089061351a565b6000836001600160a01b03168383604051611ad2919061355c565b60006040518083038185875af1925050503d8060008114611b0f576040519150601f19603f3d011682016040523d82523d6000602084013e611b14565b606091505b5050905080611b595760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610808565b50505050565b600086815260036020526040902054600280548892908110611b8357611b836131a1565b600091825260209091206002600590920201015460ff1615611bb75760405162461bcd60e51b815260040161080890613311565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c25919061320c565b5090935060029250611c35915050565b816004811115611c4757611c47613273565b14611ca25760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610808565b85611ce45760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610808565b600088815260036020526040812054600280549091908110611d0857611d086131a1565b906000526020600020906005020190508060010154861115611d635760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610808565b80546000908290611d76906001906131cd565b81548110611d8657611d866131a1565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015611de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e05919061320c565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015611e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e849190613578565b505050505091505060005b8a8110156121015733848d8d84818110611eab57611eab6131a1565b9050602002013581548110611ec257611ec26131a1565b60009182526020909120600490910201546001600160a01b031614611ef95760405162461bcd60e51b815260040161080890613474565b811580611f6d575089888a604051602001611f16939291906135e2565b60405160208183030381529060405280519060200120846000018d8d84818110611f4257611f426131a1565b9050602002013581548110611f5957611f596131a1565b906000526020600020906004020160010154145b611fdf5760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610808565b838c8c83818110611ff257611ff26131a1565b9050602002013581548110612009576120096131a1565b600091825260209091206003600490920201015460ff16156120625760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610808565b89848d8d84818110612076576120766131a1565b905060200201358154811061208d5761208d6131a1565b60009182526020909120600260049092020101556001848d8d848181106120b6576120b66131a1565b90506020020135815481106120cd576120cd6131a1565b60009182526020909120600490910201600301805460ff1916911515919091179055806120f9816134ab565b915050611e8f565b508a8a905083600401600082825461211991906132fe565b90915550506000898152600284016020526040812080548c929061213e9084906132fe565b90915550506001830154890361216d57600383015460ff16156121685760038301805460ff191690555b6121e6565b60018301546000908152600284016020526040808220548b8352912054036121af57600383015460ff166121685760038301805460ff191660011790556121e6565b60018301546000908152600284016020526040808220548b835291205411156121e6576001830189905560038301805460ff191690555b88336001600160a01b03168d7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48e8e8c6040516122259392919061360f565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146122655760405162461bcd60e51b81526004016108089061351a565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce10699684846040516122c3929190613668565b60405180910390a3505050565b60008060008060006002600360008a815260200190815260200160002054815481106122fe576122fe6131a1565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612332576123326131a1565b90600052602060002090600c02016000018781548110612354576123546131a1565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146123c05760405162461bcd60e51b815260040161080890613684565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad20161244b858783613717565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa1580156124a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c6919061336c565b6124d091906131cd565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab5810890612559908a908a908a906137d7565b60405180910390a25050505050505050565b60008381526003602052604081205460028054839290811061258f5761258f6131a1565b600091825260208083208784526003600590930201918201905260408220548154919350839181106125c3576125c36131a1565b90600052602060002090600c020160000184815481106125e5576125e56131a1565b600091825260209091206004909102016003015460ff169695505050505050565b6001546000906001600160a01b031633146126335760405162461bcd60e51b815260040161080890613684565b600083815260036020526040902054600280548592908110612657576126576131a1565b600091825260209091206002600590920201015460ff161561268b5760405162461bcd60e51b815260040161080890613311565b6000848152600360205260408120546002805490919081106126af576126af6131a1565b600091825260208220600590910201805490925082906126d1906001906131cd565b815481106126e1576126e16131a1565b90600052602060002090600c020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276a91906137f1565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156127b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127dd919061320c565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa158015612841573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286591906137f1565b96506128718988612aae565b156128fe57604080516080810182526001600160a01b03898116825260006020808401828152948401828152606085018381528a5460018082018d558c8652939094209551600490940290950180546001600160a01b0319169390941692909217835593519382019390935591516002830155516003909101805460ff1916911515919091179055612903565b600096505b50505050505092915050565b600082815260036020526040812054600280548392908110612933576129336131a1565b60009182526020808320868452600360059093020191820190526040822054815491935083918110612967576129676131a1565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa1580156129c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ea9190613289565b5091509150826004015460001480612a19575080158015612a1957506000828152600284016020526040902054155b15612a2b576000945050505050612a5c565b8015612a40575050600401549150612a5c9050565b506000908152600290910160205260409020549150612a5c9050565b92915050565b6000546001600160a01b03163314612a8c5760405162461bcd60e51b81526004016108089061351a565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b20919061320c565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba3919061336c565b612bad91906131cd565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612bee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c1691908101906138a1565b60200151600154604051631a383be960e31b81526001600160a01b0387811660048301526001600160601b03861660248301529293506000928392169063d1c1df4890604401608060405180830381865afa158015612c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c9d9190613982565b5050915091508281612caf91906132fe565b909110159695505050505050565b600060208284031215612ccf57600080fd5b5035919050565b6001600160a01b0381168114612ceb57600080fd5b50565b60008060008060808587031215612d0457600080fd5b843593506020850135612d1681612cd6565b93969395505050506040820135916060013590565b60008060408385031215612d3e57600080fd5b50508035926020909101359150565b600080600060608486031215612d6257600080fd5b505081359360208301359350604090920135919050565b60005b83811015612d94578181015183820152602001612d7c565b50506000910152565b60008151808452612db5816020860160208601612d79565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000612dea6060830184612d9d565b95945050505050565b60008083601f840112612e0557600080fd5b5081356001600160401b03811115612e1c57600080fd5b6020830191508360208260051b8501011115612e3757600080fd5b9250929050565b60008060008060608587031215612e5457600080fd5b8435935060208501356001600160401b03811115612e7157600080fd5b612e7d87828801612df3565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015612ec857835183529284019291840191600101612eac565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b0381118282101715612f0d57612f0d612ed4565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612f3b57612f3b612ed4565b604052919050565b60006001600160401b03831115612f5c57612f5c612ed4565b612f6f601f8401601f1916602001612f13565b9050828152838383011115612f8357600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215612faf57600080fd5b8335612fba81612cd6565b92506020840135915060408401356001600160401b03811115612fdc57600080fd5b8401601f81018613612fed57600080fd5b612ffc86823560208401612f43565b9150509250925092565b60008060008060008060a0878903121561301f57600080fd5b8635955060208701356001600160401b038082111561303d57600080fd5b6130498a838b01612df3565b90975095506040890135945060608901359350608089013591508082111561307057600080fd5b508701601f8101891361308257600080fd5b61309189823560208401612f43565b9150509295509295509295565b6000602082840312156130b057600080fd5b81356114c081612cd6565b60008083601f8401126130cd57600080fd5b5081356001600160401b038111156130e457600080fd5b602083019150836020828501011115612e3757600080fd5b60008060006040848603121561311157600080fd5b8335925060208401356001600160401b0381111561312e57600080fd5b61313a868287016130bb565b9497909650939450505050565b60008060008060006080868803121561315f57600080fd5b853594506020860135935060408601356001600160401b0381111561318357600080fd5b61318f888289016130bb565b96999598509660600135949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115612a5c57612a5c6131b7565b80516001600160601b03811681146131f757600080fd5b919050565b805180151581146131f757600080fd5b600080600080600060a0868803121561322457600080fd5b61322d866131e0565b9450602086015161323d81612cd6565b60408701519094506005811061325257600080fd5b9250613260606087016131fc565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60008060006060848603121561329e57600080fd5b835192506132ae602085016131fc565b91506132bc604085016131fc565b90509250925092565b8082028115828204841417612a5c57612a5c6131b7565b6000826132f957634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612a5c57612a5c6131b7565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b6000806040838503121561335b57600080fd5b505080516020909101519092909150565b60006020828403121561337e57600080fd5b5051919050565b60006020828403121561339757600080fd5b6114c0826131fc565b600181811c908216806133b457607f821691505b6020821081036133d457634e487b7160e01b600052602260045260246000fd5b50919050565b83815260006020848184015260606040840152600084546133fa816133a0565b806060870152608060018084166000811461341c576001811461343657613464565b60ff1985168984015283151560051b890183019550613464565b896000528660002060005b8581101561345c5781548b8201860152908301908801613441565b8a0184019650505b50939a9950505050505050505050565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6000600182016134bd576134bd6131b7565b5060010190565b81835260006001600160fb1b038311156134dd57600080fd5b8260051b80836020870137939093016020019392505050565b60408152600061350a6040830185876134c4565b9050826020830152949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6000825161356e818460208701612d79565b9190910192915050565b600080600080600080600060e0888a03121561359357600080fd5b61359c886131e0565b96506135aa602089016131fc565b955060408801519450606088015193506080880151925060a088015191506135d460c089016131fc565b905092959891949750929550565b838152600083516135fa816020850160208801612d79565b60209201918201929092526040019392505050565b6040815260006136236040830185876134c4565b82810360208401526136358185612d9d565b9695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152600061367c60208301848661363f565b949350505050565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f82111561371257600081815260208120601f850160051c810160208610156136ef5750805b601f850160051c820191505b8181101561370e578281556001016136fb565b5050505b505050565b6001600160401b0383111561372e5761372e612ed4565b6137428361373c83546133a0565b836136c8565b6000601f841160018114613776576000851561375e5750838201355b600019600387901b1c1916600186901b1783556137d0565b600083815260209020601f19861690835b828110156137a75786850135825560209485019460019092019101613787565b50868210156137c45760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b838152604060208201526000612dea60408301848661363f565b60006020828403121561380357600080fd5b81516114c081612cd6565b600082601f83011261381f57600080fd5b815160206001600160401b0382111561383a5761383a612ed4565b8160051b613849828201612f13565b928352848101820192828101908785111561386357600080fd5b83870192505b8483101561388b57825161387c81612cd6565b82529183019190830190613869565b979650505050505050565b80516131f781612cd6565b6000602082840312156138b357600080fd5b81516001600160401b03808211156138ca57600080fd5b9083019061016082860312156138df57600080fd5b6138e7612eea565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c08301518281111561392f57600080fd5b61393b8782860161380e565b60c08301525060e0838101519082015261010080840151908201526101209150613966828401613896565b9181019190915261014091820151918101919091529392505050565b6000806000806080858703121561399857600080fd5b50508251602084015160408501516060909501519196909550909250905056fea2646970667358221220f038a011ed6599f97ebefd5fc379a24f22d334c34c2c7b6283848b77233ef58864736f6c63430008120033", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x0000000000000000000000000000000000000000" + ] + }, + "implementation": "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", "devdoc": { - "events": { - "ChoiceFunded(uint256,uint256,uint256)": { - "details": "To be emitted when a choice is fully funded for an appeal.", - "params": { - "_choice": "The choice that is being funded.", - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_coreRoundID": "The identifier of the round in the Arbitrator contract." - } - }, - "CommitCast(uint256,address,uint256[],bytes32)": { - "details": "To be emitted when a vote commitment is cast.", - "params": { - "_commit": "The commitment of the juror.", - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_juror": "The address of the juror casting the vote commitment.", - "_voteIDs": "The identifiers of the votes in the dispute." - } - }, - "Contribution(uint256,uint256,uint256,address,uint256)": { - "details": "To be emitted when a funding contribution is made.", - "params": { - "_amount": "The amount contributed.", - "_choice": "The choice that is being funded.", - "_contributor": "The address of the contributor.", - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_coreRoundID": "The identifier of the round in the Arbitrator contract." - } - }, - "DisputeCreation(uint256,uint256,bytes)": { - "details": "To be emitted when a dispute is created.", - "params": { - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_extraData": "The extra data for the dispute.", - "_numberOfChoices": "The number of choices available in the dispute." - } - }, - "Evidence(uint256,address,string)": { - "details": "To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).", - "params": { - "_evidence": "IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'", - "_externalDisputeID": "Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.", - "_party": "The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party." - } - }, - "VoteCast(uint256,address,uint256[],uint256,string)": { - "details": "Emitted when casting a vote to provide the justification of juror's choice.", - "params": { - "_choice": "The choice juror voted for.", - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_juror": "Address of the juror.", - "_justification": "Justification of the choice.", - "_voteIDs": "The identifiers of the votes in the dispute." - } - }, - "Withdrawal(uint256,uint256,uint256,address,uint256)": { - "details": "To be emitted when the contributed funds are withdrawn.", - "params": { - "_amount": "The amount withdrawn.", - "_choice": "The choice that is being funded.", - "_contributor": "The address of the contributor.", - "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_coreRoundID": "The identifier of the round in the Arbitrator contract." - } - } - }, + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "areCommitsAllCast(uint256)": { - "details": "Returns true if all of the jurors have cast their commits for the last round.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core." - }, - "returns": { - "_0": "Whether all of the jurors have cast their commits for the last round." - } - }, - "areVotesAllCast(uint256)": { - "details": "Returns true if all of the jurors have cast their votes for the last round.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core." - }, - "returns": { - "_0": "Whether all of the jurors have cast their votes for the last round." - } - }, - "castCommit(uint256,uint256[],bytes32)": { - "details": "Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.", - "params": { - "_commit": "The commit. Note that justification string is a part of the commit.", - "_coreDisputeID": "The ID of the dispute in Kleros Core.", - "_voteIDs": "The IDs of the votes." - } - }, - "castVote(uint256,uint256[],uint256,uint256,string)": { - "details": "Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.", - "params": { - "_choice": "The choice.", - "_coreDisputeID": "The ID of the dispute in Kleros Core.", - "_justification": "Justification of the choice.", - "_salt": "The salt for the commit if the votes were hidden.", - "_voteIDs": "The IDs of the votes." - } - }, - "changeCore(address)": { - "details": "Changes the `core` storage variable.", - "params": { - "_core": "The new value for the `core` storage variable." - } - }, - "changeGovernor(address)": { - "details": "Changes the `governor` storage variable.", - "params": { - "_governor": "The new value for the `governor` storage variable." - } - }, "constructor": { - "details": "Constructor.", - "params": { - "_core": "The KlerosCore arbitrator.", - "_governor": "The governor's address." - } - }, - "createDispute(uint256,uint256,bytes,uint256)": { - "details": "Creates a local dispute and maps it to the dispute ID in the Core contract. Note: Access restricted to Kleros Core only.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core.", - "_extraData": "Additional info about the dispute, for possible use in future dispute kits.", - "_nbVotes": "Number of votes for this dispute.", - "_numberOfChoices": "Number of choices of the dispute" - } - }, - "currentRuling(uint256)": { - "details": "Gets the current ruling of a specified dispute.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core." - }, - "returns": { - "overridden": "Whether the ruling was overridden by appeal funding or not.", - "ruling": "The current ruling.", - "tied": "Whether it's a tie or not." - } - }, - "draw(uint256,uint256)": { - "details": "Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. Note: Access restricted to Kleros Core only.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core.", - "_nonce": "Nonce of the drawing iteration." - }, - "returns": { - "drawnAddress": "The drawn address." - } - }, - "executeGovernorProposal(address,uint256,bytes)": { - "details": "Allows the governor to call anything on behalf of the contract.", - "params": { - "_amount": "The value sent with the call.", - "_data": "The data sent with the call.", - "_destination": "The destination of the call." - } - }, - "fundAppeal(uint256,uint256)": { - "details": "Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.", - "params": { - "_choice": "A choice that receives funding.", - "_coreDisputeID": "Index of the dispute in Kleros Core." - } - }, - "getCoherentCount(uint256,uint256)": { - "details": "Gets the number of jurors who are eligible to a reward in this round.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", - "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit." - }, - "returns": { - "_0": "The number of coherent jurors." - } - }, - "getDegreeOfCoherence(uint256,uint256,uint256)": { - "details": "Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", - "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit.", - "_voteID": "The ID of the vote." - }, - "returns": { - "_0": "The degree of coherence in basis points." - } - }, - "isVoteActive(uint256,uint256,uint256)": { - "details": "Returns true if the specified voter was active in this round.", - "params": { - "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", - "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit.", - "_voteID": "The ID of the voter." - }, - "returns": { - "_0": "Whether the voter was active or not." - } - }, - "submitEvidence(uint256,string)": { - "details": "Submits evidence for a dispute.", - "params": { - "_evidence": "IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.", - "_externalDisputeID": "Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID." - } - }, - "withdrawFeesAndRewards(uint256,address,uint256,uint256)": { - "details": "Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.", - "params": { - "_beneficiary": "The address whose rewards to withdraw.", - "_choice": "The ruling option that the caller wants to withdraw from.", - "_coreDisputeID": "Index of the dispute in Kleros Core contract.", - "_coreRoundID": "The round in the Kleros Core contract the caller wants to withdraw from." - }, - "returns": { - "amount": "The withdrawn amount." - } + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." } }, - "title": "DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggregation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.", + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -1108,305 +1048,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 10107, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 10110, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "core", - "offset": 0, - "slot": "1", - "type": "t_contract(KlerosCore)6744" - }, - { - "astId": 10280, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "disputes", - "offset": 0, - "slot": "2", - "type": "t_array(t_struct(Dispute)10217_storage)dyn_storage" - }, - { - "astId": 10284, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "coreDisputeIDToLocal", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_uint256,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_struct(Dispute)10217_storage)dyn_storage": { - "base": "t_struct(Dispute)10217_storage", - "encoding": "dynamic_array", - "label": "struct DisputeKitClassic.Dispute[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(Round)10255_storage)dyn_storage": { - "base": "t_struct(Round)10255_storage", - "encoding": "dynamic_array", - "label": "struct DisputeKitClassic.Round[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(Vote)10264_storage)dyn_storage": { - "base": "t_struct(Vote)10264_storage", - "encoding": "dynamic_array", - "label": "struct DisputeKitClassic.Vote[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)dyn_storage": { - "base": "t_uint256", - "encoding": "dynamic_array", - "label": "uint256[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_bytes_storage": { - "encoding": "bytes", - "label": "bytes", - "numberOfBytes": "32" - }, - "t_contract(KlerosCore)6744": { - "encoding": "inplace", - "label": "contract KlerosCore", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(uint256 => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_uint256)" - }, - "t_mapping(t_uint256,t_bool)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_uint256,t_uint256)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(Dispute)10217_storage": { - "encoding": "inplace", - "label": "struct DisputeKitClassic.Dispute", - "members": [ - { - "astId": 10206, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "rounds", - "offset": 0, - "slot": "0", - "type": "t_array(t_struct(Round)10255_storage)dyn_storage" - }, - { - "astId": 10208, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "numberOfChoices", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 10210, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "jumped", - "offset": 0, - "slot": "2", - "type": "t_bool" - }, - { - "astId": 10214, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "coreRoundIDToLocal", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_uint256,t_uint256)" - }, - { - "astId": 10216, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "extraData", - "offset": 0, - "slot": "4", - "type": "t_bytes_storage" - } - ], - "numberOfBytes": "160" - }, - "t_struct(Round)10255_storage": { - "encoding": "inplace", - "label": "struct DisputeKitClassic.Round", - "members": [ - { - "astId": 10221, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "votes", - "offset": 0, - "slot": "0", - "type": "t_array(t_struct(Vote)10264_storage)dyn_storage" - }, - { - "astId": 10223, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "winningChoice", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 10227, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "counts", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_uint256,t_uint256)" - }, - { - "astId": 10229, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "tied", - "offset": 0, - "slot": "3", - "type": "t_bool" - }, - { - "astId": 10231, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "totalVoted", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 10233, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "totalCommitted", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 10237, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "paidFees", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_uint256,t_uint256)" - }, - { - "astId": 10241, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "hasPaid", - "offset": 0, - "slot": "7", - "type": "t_mapping(t_uint256,t_bool)" - }, - { - "astId": 10247, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "contributions", - "offset": 0, - "slot": "8", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" - }, - { - "astId": 10249, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "feeRewards", - "offset": 0, - "slot": "9", - "type": "t_uint256" - }, - { - "astId": 10252, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "fundedChoices", - "offset": 0, - "slot": "10", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 10254, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "nbVotes", - "offset": 0, - "slot": "11", - "type": "t_uint256" - } - ], - "numberOfBytes": "384" - }, - "t_struct(Vote)10264_storage": { - "encoding": "inplace", - "label": "struct DisputeKitClassic.Vote", - "members": [ - { - "astId": 10257, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "account", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 10259, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "commit", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 10261, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "choice", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 10263, - "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", - "label": "voted", - "offset": 0, - "slot": "3", - "type": "t_bool" - } - ], - "numberOfBytes": "128" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Implementation.json new file mode 100644 index 000000000..efde303f1 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Implementation.json @@ -0,0 +1,1588 @@ +{ + "address": "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "ChoiceFunded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_juror", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "_voteIDs", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_commit", + "type": "bytes32" + } + ], + "name": "CommitCast", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_contributor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Contribution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_externalDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_party", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "_evidence", + "type": "string" + } + ], + "name": "Evidence", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_juror", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "_voteIDs", + "type": "uint256[]" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "_justification", + "type": "string" + } + ], + "name": "VoteCast", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_contributor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [], + "name": "LOSER_APPEAL_PERIOD_MULTIPLIER", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LOSER_STAKE_MULTIPLIER", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ONE_BASIS_POINT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WINNER_STAKE_MULTIPLIER", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "areCommitsAllCast", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "areVotesAllCast", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "_voteIDs", + "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "_commit", + "type": "bytes32" + } + ], + "name": "castCommit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "_voteIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_salt", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_justification", + "type": "string" + } + ], + "name": "castVote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + } + ], + "name": "changeCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract KlerosCore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "coreDisputeIDToLocal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_nbVotes", + "type": "uint256" + } + ], + "name": "createDispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "currentRuling", + "outputs": [ + { + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + }, + { + "internalType": "bool", + "name": "overridden", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "uint256", + "name": "numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "jumped", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "name": "draw", + "outputs": [ + { + "internalType": "address", + "name": "drawnAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_destination", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "executeGovernorProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "fundAppeal", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + } + ], + "name": "getCoherentCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "getDegreeOfCoherence", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "getFundedChoices", + "outputs": [ + { + "internalType": "uint256[]", + "name": "fundedChoices", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "getRoundInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "winningChoice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "totalVoted", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCommited", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nbVoters", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "choiceCount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "getVoteInfo", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "commit", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "choice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "voted", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "isVoteActive", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_externalDisputeID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_evidence", + "type": "string" + } + ], + "name": "submitEvidence", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_beneficiary", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "withdrawFeesAndRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xab96b643ce6386f1d3bff1a19637b2c82a2b4372ee1e3a3c6f875db306bed257", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", + "transactionIndex": 1, + "gasUsed": "3544155", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000204000000000000000000000000000000004000000000000000000000000000000000000000000000000000", + "blockHash": "0xbe8b60288f423a3f2f9c6e902ef5d3253db5ee82dba56b1fc506220046762527", + "transactionHash": "0xab96b643ce6386f1d3bff1a19637b2c82a2b4372ee1e3a3c6f875db306bed257", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823729, + "transactionHash": "0xab96b643ce6386f1d3bff1a19637b2c82a2b4372ee1e3a3c6f875db306bed257", + "address": "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 0, + "blockHash": "0xbe8b60288f423a3f2f9c6e902ef5d3253db5ee82dba56b1fc506220046762527" + } + ], + "blockNumber": 43823729, + "cumulativeGasUsed": "3544155", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "f16a94d75c83e5f4618a2f6097a17dcc", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"CommitCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Contribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_party\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"Evidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"VoteCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOSER_APPEAL_PERIOD_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LOSER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ONE_BASIS_POINT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WINNER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areCommitsAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areVotesAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"castCommit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salt\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"castVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"changeCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"coreDisputeIDToLocal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_nbVotes\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"jumped\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"fundAppeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"}],\"name\":\"getCoherentCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getDegreeOfCoherence\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"getFundedChoices\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"fundedChoices\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"totalVoted\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCommited\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVoters\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"choiceCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getVoteInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"commit\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"choice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"voted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"isVoteActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"submitEvidence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_beneficiary\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"withdrawFeesAndRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"ChoiceFunded(uint256,uint256,uint256)\":{\"details\":\"To be emitted when a choice is fully funded for an appeal.\",\"params\":{\"_choice\":\"The choice that is being funded.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}},\"CommitCast(uint256,address,uint256[],bytes32)\":{\"details\":\"To be emitted when a vote commitment is cast.\",\"params\":{\"_commit\":\"The commitment of the juror.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_juror\":\"The address of the juror casting the vote commitment.\",\"_voteIDs\":\"The identifiers of the votes in the dispute.\"}},\"Contribution(uint256,uint256,uint256,address,uint256)\":{\"details\":\"To be emitted when a funding contribution is made.\",\"params\":{\"_amount\":\"The amount contributed.\",\"_choice\":\"The choice that is being funded.\",\"_contributor\":\"The address of the contributor.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}},\"DisputeCreation(uint256,uint256,bytes)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_extraData\":\"The extra data for the dispute.\",\"_numberOfChoices\":\"The number of choices available in the dispute.\"}},\"Evidence(uint256,address,string)\":{\"details\":\"To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\",\"_externalDisputeID\":\"Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.\",\"_party\":\"The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\"}},\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}},\"VoteCast(uint256,address,uint256[],uint256,string)\":{\"details\":\"Emitted when casting a vote to provide the justification of juror's choice.\",\"params\":{\"_choice\":\"The choice juror voted for.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_juror\":\"Address of the juror.\",\"_justification\":\"Justification of the choice.\",\"_voteIDs\":\"The identifiers of the votes in the dispute.\"}},\"Withdrawal(uint256,uint256,uint256,address,uint256)\":{\"details\":\"To be emitted when the contributed funds are withdrawn.\",\"params\":{\"_amount\":\"The amount withdrawn.\",\"_choice\":\"The choice that is being funded.\",\"_contributor\":\"The address of the contributor.\",\"_coreDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_coreRoundID\":\"The identifier of the round in the Arbitrator contract.\"}}},\"kind\":\"dev\",\"methods\":{\"areCommitsAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their commits for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their commits for the last round.\"}},\"areVotesAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their votes for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their votes for the last round.\"}},\"castCommit(uint256,uint256[],bytes32)\":{\"details\":\"Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.\",\"params\":{\"_commit\":\"The commit. Note that justification string is a part of the commit.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"castVote(uint256,uint256[],uint256,uint256,string)\":{\"details\":\"Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.\",\"params\":{\"_choice\":\"The choice.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_justification\":\"Justification of the choice.\",\"_salt\":\"The salt for the commit if the votes were hidden.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"changeCore(address)\":{\"details\":\"Changes the `core` storage variable.\",\"params\":{\"_core\":\"The new value for the `core` storage variable.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"createDispute(uint256,uint256,bytes,uint256)\":{\"details\":\"Creates a local dispute and maps it to the dispute ID in the Core contract. Note: Access restricted to Kleros Core only.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_extraData\":\"Additional info about the dispute, for possible use in future dispute kits.\",\"_nbVotes\":\"Number of votes for this dispute.\",\"_numberOfChoices\":\"Number of choices of the dispute\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. Note: Access restricted to Kleros Core only.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_nonce\":\"Nonce of the drawing iteration.\"},\"returns\":{\"drawnAddress\":\"The drawn address.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"fundAppeal(uint256,uint256)\":{\"details\":\"Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.\",\"params\":{\"_choice\":\"A choice that receives funding.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\"}},\"getCoherentCount(uint256,uint256)\":{\"details\":\"Gets the number of jurors who are eligible to a reward in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"_0\":\"The number of coherent jurors.\"}},\"getDegreeOfCoherence(uint256,uint256,uint256)\":{\"details\":\"Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the vote.\"},\"returns\":{\"_0\":\"The degree of coherence in basis points.\"}},\"initialize(address,address)\":{\"details\":\"Initializer.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\"}},\"isVoteActive(uint256,uint256,uint256)\":{\"details\":\"Returns true if the specified voter was active in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the voter.\"},\"returns\":{\"_0\":\"Whether the voter was active or not.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"submitEvidence(uint256,string)\":{\"details\":\"Submits evidence for a dispute.\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\",\"_externalDisputeID\":\"Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID.\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}},\"withdrawFeesAndRewards(uint256,address,uint256,uint256)\":{\"details\":\"Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\",\"params\":{\"_beneficiary\":\"The address whose rewards to withdraw.\",\"_choice\":\"The ruling option that the caller wants to withdraw from.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core contract.\",\"_coreRoundID\":\"The round in the Kleros Core contract the caller wants to withdraw from.\"},\"returns\":{\"amount\":\"The withdrawn amount.\"}}},\"title\":\"DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggregation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":\"DisputeKitClassic\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\nimport \\\"../libraries/Constants.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 private constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 private constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 private constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 private constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer (constructor equivalent for upgradable contracts).\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n function initialize(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) external initializer {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: Constants.NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(Constants.DISPUTE_KIT_CLASSIC, _disputeKit, Constants.NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(Constants.FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = Constants.FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(Constants.GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(Constants.GENERAL_COURT, Constants.DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /* @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != Constants.NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == Constants.NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(Constants.GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == Constants.FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n if (_courtID != Constants.GENERAL_COURT && courts[court.parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < court.children.length; i++) {\\n if (courts[court.children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n court.minStake = _minStake;\\n court.hiddenVotes = _hiddenVotes;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (\\n _courtID == Constants.GENERAL_COURT &&\\n disputeKitNodes[_disputeKitIDs[i]].parent == Constants.NULL_DISPUTE_KIT\\n ) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n currencyRates[_feeToken].rateInEth = _rateInEth;\\n currencyRates[_feeToken].rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n if (!_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount)) revert TransferFailed();\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != Constants.NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = Constants.GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == Constants.GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n timesPerPeriod = courts[_courtID].timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n return (_amountInEth * 10 ** currencyRates[_toToken].rateDecimals) / currencyRates[_toToken].rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == Constants.FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == Constants.FORKING_COURT || courtID >= courts.length) {\\n courtID = Constants.GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == Constants.NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = Constants.GENERAL_COURT;\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n error TransferFailed();\\n}\\n\",\"keccak256\":\"0x48e2706b2e795f745b6abc247c2ac9c8a789031f6b3a1fc3e195d48a7a06ef78\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../KlerosCore.sol\\\";\\nimport \\\"../interfaces/IDisputeKit.sol\\\";\\nimport \\\"../interfaces/IEvidence.sol\\\";\\nimport \\\"../../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../../proxy/Initializable.sol\\\";\\n\\n/// @title DisputeKitClassic\\n/// Dispute kit implementation of the Kleros v1 features including:\\n/// - a drawing system: proportional to staked PNK,\\n/// - a vote aggregation system: plurality,\\n/// - an incentive system: equal split between coherent votes,\\n/// - an appeal system: fund 2 choices only, vote on any choice.\\ncontract DisputeKitClassic is IDisputeKit, IEvidence, Initializable, UUPSProxiable {\\n // ************************************* //\\n // * Structs * //\\n // ************************************* //\\n\\n struct Dispute {\\n Round[] rounds; // Rounds of the dispute. 0 is the default round, and [1, ..n] are the appeal rounds.\\n uint256 numberOfChoices; // The number of choices jurors have when voting. This does not include choice `0` which is reserved for \\\"refuse to arbitrate\\\".\\n bool jumped; // True if dispute jumped to a parent dispute kit and won't be handled by this DK anymore.\\n mapping(uint256 => uint256) coreRoundIDToLocal; // Maps id of the round in the core contract to the index of the round of related local dispute.\\n bytes extraData; // Extradata for the dispute.\\n }\\n\\n struct Round {\\n Vote[] votes; // Former votes[_appeal][].\\n uint256 winningChoice; // The choice with the most votes. Note that in the case of a tie, it is the choice that reached the tied number of votes first.\\n mapping(uint256 => uint256) counts; // The sum of votes for each choice in the form `counts[choice]`.\\n bool tied; // True if there is a tie, false otherwise.\\n uint256 totalVoted; // Former uint[_appeal] votesInEachRound.\\n uint256 totalCommitted; // Former commitsInRound.\\n mapping(uint256 => uint256) paidFees; // Tracks the fees paid for each choice in this round.\\n mapping(uint256 => bool) hasPaid; // True if this choice was fully funded, false otherwise.\\n mapping(address => mapping(uint256 => uint256)) contributions; // Maps contributors to their contributions for each choice.\\n uint256 feeRewards; // Sum of reimbursable appeal fees available to the parties that made contributions to the ruling that ultimately wins a dispute.\\n uint256[] fundedChoices; // Stores the choices that are fully funded.\\n uint256 nbVotes; // Maximal number of votes this dispute can get.\\n }\\n\\n struct Vote {\\n address account; // The address of the juror.\\n bytes32 commit; // The commit of the juror. For courts with hidden votes.\\n uint256 choice; // The choice of the juror.\\n bool voted; // True if the vote has been cast.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant WINNER_STAKE_MULTIPLIER = 10000; // Multiplier of the appeal cost that the winner has to pay as fee stake for a round in basis points. Default is 1x of appeal fee.\\n uint256 public constant LOSER_STAKE_MULTIPLIER = 20000; // Multiplier of the appeal cost that the loser has to pay as fee stake for a round in basis points. Default is 2x of appeal fee.\\n uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period.\\n uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling.\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The Kleros Core arbitrator\\n Dispute[] public disputes; // Array of the locally created disputes.\\n mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /// @dev To be emitted when a dispute is created.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _numberOfChoices The number of choices available in the dispute.\\n /// @param _extraData The extra data for the dispute.\\n event DisputeCreation(uint256 indexed _coreDisputeID, uint256 _numberOfChoices, bytes _extraData);\\n\\n /// @dev To be emitted when a vote commitment is cast.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror The address of the juror casting the vote commitment.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _commit The commitment of the juror.\\n event CommitCast(uint256 indexed _coreDisputeID, address indexed _juror, uint256[] _voteIDs, bytes32 _commit);\\n\\n /// @dev To be emitted when a funding contribution is made.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n /// @param _contributor The address of the contributor.\\n /// @param _amount The amount contributed.\\n event Contribution(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n /// @dev To be emitted when the contributed funds are withdrawn.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n /// @param _contributor The address of the contributor.\\n /// @param _amount The amount withdrawn.\\n event Withdrawal(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n /// @dev To be emitted when a choice is fully funded for an appeal.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _coreRoundID The identifier of the round in the Arbitrator contract.\\n /// @param _choice The choice that is being funded.\\n event ChoiceFunded(uint256 indexed _coreDisputeID, uint256 indexed _coreRoundID, uint256 indexed _choice);\\n\\n // ************************************* //\\n // * Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n modifier notJumped(uint256 _coreDisputeID) {\\n require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, \\\"Dispute jumped to a parent DK!\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer.\\n /// @param _governor The governor's address.\\n /// @param _core The KlerosCore arbitrator.\\n function initialize(address _governor, KlerosCore _core) external reinitializer(1) {\\n governor = _governor;\\n core = _core;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n require(success, \\\"Unsuccessful call\\\");\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `core` storage variable.\\n /// @param _core The new value for the `core` storage variable.\\n function changeCore(address _core) external onlyByGovernor {\\n core = KlerosCore(_core);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n /// @param _nbVotes Number of votes for this dispute.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external override onlyByCore {\\n uint256 localDisputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.numberOfChoices = _numberOfChoices;\\n dispute.extraData = _extraData;\\n\\n // New round in the Core should be created before the dispute creation in DK.\\n dispute.coreRoundIDToLocal[core.getNumberOfRounds(_coreDisputeID) - 1] = dispute.rounds.length;\\n\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = _nbVotes;\\n round.tied = true;\\n\\n coreDisputeIDToLocal[_coreDisputeID] = localDisputeID;\\n emit DisputeCreation(_coreDisputeID, _numberOfChoices, _extraData);\\n }\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _nonce Nonce of the drawing iteration.\\n /// @return drawnAddress The drawn address.\\n function draw(\\n uint256 _coreDisputeID,\\n uint256 _nonce\\n ) external override onlyByCore notJumped(_coreDisputeID) returns (address drawnAddress) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n\\n ISortitionModule sortitionModule = core.sortitionModule();\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n bytes32 key = bytes32(uint256(courtID)); // Get the ID of the tree.\\n\\n // TODO: Handle the situation when no one has staked yet.\\n drawnAddress = sortitionModule.draw(key, _coreDisputeID, _nonce);\\n\\n if (_postDrawCheck(_coreDisputeID, drawnAddress)) {\\n round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false}));\\n } else {\\n drawnAddress = address(0);\\n }\\n }\\n\\n /// @dev Sets the caller's commit for the specified votes. It can be called multiple times during the\\n /// commit period, each call overrides the commits of the previous one.\\n /// `O(n)` where\\n /// `n` is the number of votes.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _voteIDs The IDs of the votes.\\n /// @param _commit The commit. Note that justification string is a part of the commit.\\n function castCommit(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.commit, \\\"The dispute should be in Commit period.\\\");\\n require(_commit != bytes32(0), \\\"Empty commit.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n round.votes[_voteIDs[i]].commit = _commit;\\n }\\n round.totalCommitted += _voteIDs.length;\\n emit CommitCast(_coreDisputeID, msg.sender, _voteIDs, _commit);\\n }\\n\\n /// @dev Sets the caller's choices for the specified votes.\\n /// `O(n)` where\\n /// `n` is the number of votes.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @param _voteIDs The IDs of the votes.\\n /// @param _choice The choice.\\n /// @param _salt The salt for the commit if the votes were hidden.\\n /// @param _justification Justification of the choice.\\n function castVote(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.vote, \\\"The dispute should be in Vote period.\\\");\\n require(_voteIDs.length > 0, \\\"No voteID provided\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"Choice out of bounds\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , , ) = core.courts(courtID);\\n\\n // Save the votes.\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n require(\\n !hiddenVotes ||\\n round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),\\n \\\"The commit must match the choice in courts with hidden votes.\\\"\\n );\\n require(!round.votes[_voteIDs[i]].voted, \\\"Vote already cast.\\\");\\n round.votes[_voteIDs[i]].choice = _choice;\\n round.votes[_voteIDs[i]].voted = true;\\n }\\n\\n round.totalVoted += _voteIDs.length;\\n\\n round.counts[_choice] += _voteIDs.length;\\n if (_choice == round.winningChoice) {\\n if (round.tied) round.tied = false;\\n } else {\\n // Voted for another choice.\\n if (round.counts[_choice] == round.counts[round.winningChoice]) {\\n // Tie.\\n if (!round.tied) round.tied = true;\\n } else if (round.counts[_choice] > round.counts[round.winningChoice]) {\\n // New winner.\\n round.winningChoice = _choice;\\n round.tied = false;\\n }\\n }\\n emit VoteCast(_coreDisputeID, msg.sender, _voteIDs, _choice, _justification);\\n }\\n\\n /// @dev Manages contributions, and appeals a dispute if at least two choices are fully funded.\\n /// Note that the surplus deposit will be reimbursed.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core.\\n /// @param _choice A choice that receives funding.\\n function fundAppeal(uint256 _coreDisputeID, uint256 _choice) external payable notJumped(_coreDisputeID) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"There is no such ruling to fund.\\\");\\n\\n (uint256 appealPeriodStart, uint256 appealPeriodEnd) = core.appealPeriod(_coreDisputeID);\\n require(block.timestamp >= appealPeriodStart && block.timestamp < appealPeriodEnd, \\\"Appeal period is over.\\\");\\n\\n uint256 multiplier;\\n (uint256 ruling, , ) = this.currentRuling(_coreDisputeID);\\n if (ruling == _choice) {\\n multiplier = WINNER_STAKE_MULTIPLIER;\\n } else {\\n require(\\n block.timestamp - appealPeriodStart <\\n ((appealPeriodEnd - appealPeriodStart) * LOSER_APPEAL_PERIOD_MULTIPLIER) / ONE_BASIS_POINT,\\n \\\"Appeal period is over for loser\\\"\\n );\\n multiplier = LOSER_STAKE_MULTIPLIER;\\n }\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n uint256 coreRoundID = core.getNumberOfRounds(_coreDisputeID) - 1;\\n\\n require(!round.hasPaid[_choice], \\\"Appeal fee is already paid.\\\");\\n uint256 appealCost = core.appealCost(_coreDisputeID);\\n uint256 totalCost = appealCost + (appealCost * multiplier) / ONE_BASIS_POINT;\\n\\n // Take up to the amount necessary to fund the current round at the current costs.\\n uint256 contribution;\\n if (totalCost > round.paidFees[_choice]) {\\n contribution = totalCost - round.paidFees[_choice] > msg.value // Overflows and underflows will be managed on the compiler level.\\n ? msg.value\\n : totalCost - round.paidFees[_choice];\\n emit Contribution(_coreDisputeID, coreRoundID, _choice, msg.sender, contribution);\\n }\\n\\n round.contributions[msg.sender][_choice] += contribution;\\n round.paidFees[_choice] += contribution;\\n if (round.paidFees[_choice] >= totalCost) {\\n round.feeRewards += round.paidFees[_choice];\\n round.fundedChoices.push(_choice);\\n round.hasPaid[_choice] = true;\\n emit ChoiceFunded(_coreDisputeID, coreRoundID, _choice);\\n }\\n\\n if (round.fundedChoices.length > 1) {\\n // At least two sides are fully funded.\\n round.feeRewards = round.feeRewards - appealCost;\\n\\n if (core.isDisputeKitJumping(_coreDisputeID)) {\\n // Don't create a new round in case of a jump, and remove local dispute from the flow.\\n dispute.jumped = true;\\n } else {\\n // Don't subtract 1 from length since both round arrays haven't been updated yet.\\n dispute.coreRoundIDToLocal[coreRoundID + 1] = dispute.rounds.length;\\n\\n Round storage newRound = dispute.rounds.push();\\n newRound.nbVotes = core.getNumberOfVotes(_coreDisputeID);\\n newRound.tied = true;\\n }\\n core.appeal{value: appealCost}(_coreDisputeID, dispute.numberOfChoices, dispute.extraData);\\n }\\n\\n if (msg.value > contribution) payable(msg.sender).send(msg.value - contribution);\\n }\\n\\n /// @dev Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core contract.\\n /// @param _beneficiary The address whose rewards to withdraw.\\n /// @param _coreRoundID The round in the Kleros Core contract the caller wants to withdraw from.\\n /// @param _choice The ruling option that the caller wants to withdraw from.\\n /// @return amount The withdrawn amount.\\n function withdrawFeesAndRewards(\\n uint256 _coreDisputeID,\\n address payable _beneficiary,\\n uint256 _coreRoundID,\\n uint256 _choice\\n ) external returns (uint256 amount) {\\n (, , , bool isRuled, ) = core.disputes(_coreDisputeID);\\n require(isRuled, \\\"Dispute should be resolved.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 finalRuling, , ) = core.currentRuling(_coreDisputeID);\\n\\n if (!round.hasPaid[_choice]) {\\n // Allow to reimburse if funding was unsuccessful for this ruling option.\\n amount = round.contributions[_beneficiary][_choice];\\n } else {\\n // Funding was successful for this ruling option.\\n if (_choice == finalRuling) {\\n // This ruling option is the ultimate winner.\\n amount = round.paidFees[_choice] > 0\\n ? (round.contributions[_beneficiary][_choice] * round.feeRewards) / round.paidFees[_choice]\\n : 0;\\n } else if (!round.hasPaid[finalRuling]) {\\n // The ultimate winner was not funded in this round. In this case funded ruling option(s) are reimbursed.\\n amount =\\n (round.contributions[_beneficiary][_choice] * round.feeRewards) /\\n (round.paidFees[round.fundedChoices[0]] + round.paidFees[round.fundedChoices[1]]);\\n }\\n }\\n round.contributions[_beneficiary][_choice] = 0;\\n\\n if (amount != 0) {\\n _beneficiary.send(amount); // Deliberate use of send to prevent reverting fallback. It's the user's responsibility to accept ETH.\\n emit Withdrawal(_coreDisputeID, _coreRoundID, _choice, _beneficiary, amount);\\n }\\n }\\n\\n /// @dev Submits evidence for a dispute.\\n /// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID.\\n /// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\\n function submitEvidence(uint256 _externalDisputeID, string calldata _evidence) external {\\n emit Evidence(_externalDisputeID, msg.sender, _evidence);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return lastRound.fundedChoices;\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(\\n uint256 _coreDisputeID\\n ) external view override returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n tied = round.tied;\\n ruling = tied ? 0 : round.winningChoice;\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n // Override the final ruling if only one side funded the appeals.\\n if (period == KlerosCore.Period.execution) {\\n uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);\\n if (fundedChoices.length == 1) {\\n ruling = fundedChoices[0];\\n tied = false;\\n overridden = true;\\n }\\n }\\n }\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (uint256) {\\n // In this contract this degree can be either 0 or 1, but in other dispute kits this value can be something in between.\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (vote.voted && (vote.choice == winningChoice || tied)) {\\n return ONE_BASIS_POINT;\\n } else {\\n return 0;\\n }\\n }\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view override returns (uint256) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage currentRound = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (currentRound.totalVoted == 0 || (!tied && currentRound.counts[winningChoice] == 0)) {\\n return 0;\\n } else if (tied) {\\n return currentRound.totalVoted;\\n } else {\\n return currentRound.counts[winningChoice];\\n }\\n }\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalCommitted == round.votes.length;\\n }\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalVoted == round.votes.length;\\n }\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n return vote.voted;\\n }\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n override\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n )\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n return (\\n round.winningChoice,\\n round.tied,\\n round.totalVoted,\\n round.totalCommitted,\\n round.votes.length,\\n round.counts[_choice]\\n );\\n }\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (address account, bytes32 commit, uint256 choice, bool voted) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n return (vote.account, vote.commit, vote.choice, vote.voted);\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n /// @param _coreDisputeID ID of the dispute in the core contract.\\n /// @param _juror Chosen address.\\n /// @return Whether the address can be drawn or not.\\n function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view returns (bool) {\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n uint256 lockedAmountPerJuror = core\\n .getRoundInfo(_coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1)\\n .pnkAtStakePerJuror;\\n (uint256 totalStaked, uint256 totalLocked, , ) = core.getJurorBalance(_juror, courtID);\\n return totalStaked >= totalLocked + lockedAmountPerJuror;\\n }\\n}\\n\",\"keccak256\":\"0x2772deb0cc8f934c2af59b12c248a2226e5f3cfe937da7560d3c2fcc27c9be54\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n/// @title IEvidence\\ninterface IEvidence {\\n /// @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\\n /// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.\\n /// @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\\n /// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\\n event Evidence(uint256 indexed _externalDisputeID, address indexed _party, string _evidence);\\n}\\n\",\"keccak256\":\"0x3350da62267a5dad4616dafd9916fe3bfa4cdabfce124709ac3b7d087361e8c4\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n/// @title Constants\\nlibrary Constants {\\n // Courts\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n\\n // Dispute Kits\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n\\n // Defaults\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n}\\n\",\"keccak256\":\"0x0bc176ef4e0124e41a09f28f627a1b6458e06d17d65f4efa5f7de0d2f68ddc15\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000d9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff1615620000765760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b0390811614620000d65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051613eb162000103600039600081816114fe0152818161152701526118620152613eb16000f3fe60806040526004361061018d5760003560e01c8063751accd0116100d7578063b6ede54011610085578063b6ede540146104f5578063ba66fde714610515578063be46760414610535578063d2b8035a1461054b578063da3beb8c1461056b578063e349ad301461041d578063e4c0aaf41461058b578063f2f4eb26146105ab57600080fd5b8063751accd0146103fd578063796490f91461041d5780637c04034e146104335780638e42646014610453578063a6a7f0eb14610473578063a7cc08fe14610493578063b34bfaa8146104df57600080fd5b80634f1ef2861161013f5780634f1ef286146102cc5780634fe264fb146102df57806352d1902d146102ff578063564a565d146103145780635c92e2f61461034357806365540b961461036357806369f3f041146103905780636d4cd8ea146103dd57600080fd5b80630baa64d1146101925780630c340a24146101c75780631200aabc146101ff5780631c3db16d1461023a578063362c347914610277578063485cc955146102975780634b2f0ea0146102b9575b600080fd5b34801561019e57600080fd5b506101b26101ad3660046130d0565b6105cb565b60405190151581526020015b60405180910390f35b3480156101d357600080fd5b506000546101e7906001600160a01b031681565b6040516001600160a01b0390911681526020016101be565b34801561020b57600080fd5b5061022c61021a3660046130d0565b60036020526000908152604090205481565b6040519081526020016101be565b34801561024657600080fd5b5061025a6102553660046130d0565b610642565b6040805193845291151560208401521515908201526060016101be565b34801561028357600080fd5b5061022c6102923660046130fe565b6107b0565b3480156102a357600080fd5b506102b76102b236600461313b565b610b86565b005b6102b76102c7366004613174565b610c83565b6102b76102da36600461327c565b6114ea565b3480156102eb57600080fd5b5061022c6102fa3660046132cb565b611712565b34801561030b57600080fd5b5061022c611855565b34801561032057600080fd5b5061033461032f3660046130d0565b6118b3565b6040516101be93929190613347565b34801561034f57600080fd5b506102b761035e3660046133bc565b611979565b34801561036f57600080fd5b5061038361037e3660046130d0565b611c86565b6040516101be919061340e565b34801561039c57600080fd5b506103b06103ab3660046132cb565b611d4a565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101be565b3480156103e957600080fd5b506101b26103f83660046130d0565b611e02565b34801561040957600080fd5b506102b7610418366004613452565b611e79565b34801561042957600080fd5b5061022c61271081565b34801561043f57600080fd5b506102b761044e3660046134aa565b611f45565b34801561045f57600080fd5b506102b761046e366004613542565b612621565b34801561047f57600080fd5b506102b761048e3660046135a0565b61266d565b34801561049f57600080fd5b506104b36104ae3660046132cb565b6126b6565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101be565b3480156104eb57600080fd5b5061022c614e2081565b34801561050157600080fd5b506102b76105103660046135eb565b61277c565b34801561052157600080fd5b506101b26105303660046132cb565b612951565b34801561054157600080fd5b5061022c61138881565b34801561055757600080fd5b506101e7610566366004613174565b6129ec565b34801561057757600080fd5b5061022c610586366004613174565b612cf5565b34801561059757600080fd5b506102b76105a6366004613542565b612e48565b3480156105b757600080fd5b506001546101e7906001600160a01b031681565b6000818152600360205260408120546002805483929081106105ef576105ef613645565b6000918252602082206005909102018054909250829061061190600190613671565b8154811061062157610621613645565b60009182526020909120600c90910201805460059091015414949350505050565b600080600080600260036000878152602001908152602001600020548154811061066e5761066e613645565b6000918252602082206005909102018054909250829061069090600190613671565b815481106106a0576106a0613645565b60009182526020909120600c90910201600381015460ff1694509050836106cb5780600101546106ce565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa15801561071d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074191906136b0565b5090935060049250610751915050565b81600481111561076357610763613717565b036107a657600061077388611c86565b905080516001036107a4578060008151811061079157610791613645565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156107fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082291906136b0565b5093505050508061087a5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064015b60405180910390fd5b60008681526003602052604081205460028054909190811061089e5761089e613645565b600091825260208083208884526003600590930201918201905260408220548154919350839181106108d2576108d2613645565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa15801561092d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610951919061372d565b5050600087815260078401602052604090205490915060ff1661099b576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610ae0565b808603610a105760008681526006830160205260409020546109be576000610a09565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b86529093529220546109ff9190613769565b610a099190613780565b9450610ae0565b600081815260078301602052604090205460ff16610ae05781600601600083600a01600181548110610a4457610a44613645565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610a7a57610a7a613645565b9060005260206000200154815260200190815260200160002054610a9e91906137a2565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610ad39190613769565b610add9190613780565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610b7a576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680610bcf575080546001600160401b03808416911610155b15610bec5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600080546001600160a01b038781166001600160a01b0319928316179092556001805492871692909116919091179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b600082815260036020526040902054600280548492908110610ca757610ca7613645565b600091825260209091206002600590920201015460ff1615610cdb5760405162461bcd60e51b8152600401610871906137b5565b600083815260036020526040812054600280549091908110610cff57610cff613645565b906000526020600020906005020190508060010154831115610d635760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610871565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa158015610db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd491906137ec565b91509150814210158015610de757508042105b610e2c5760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610871565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015610e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e91919061372d565b50509050868103610ea6576127109150610f27565b612710611388610eb68686613671565b610ec09190613769565b610eca9190613780565b610ed48542613671565b10610f215760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610871565b614e2091505b84546000908690610f3a90600190613671565b81548110610f4a57610f4a613645565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015610fa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcd9190613810565b610fd79190613671565b60008a815260078401602052604090205490915060ff161561103b5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610871565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa158015611085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a99190613810565b905060006127106110ba8784613769565b6110c49190613780565b6110ce90836137a2565b60008c81526006860160205260408120549192509082111561117f5760008c815260068601602052604090205434906111079084613671565b1161112c5760008c81526006860160205260409020546111279083613671565b61112e565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611176929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906111ab9084906137a2565b909155505060008c8152600686016020526040812080548392906111d09084906137a2565b909155505060008c815260068601602052604090205482116112a25760008c8152600686016020526040812054600987018054919290916112129084906137a2565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156114ad578285600901546112bf9190613671565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa15801561130d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113319190613829565b1561134a5760028a01805460ff1916600117905561142d565b895460038b01600061135d8760016137a2565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b81526004016113d891815260200190565b602060405180830381865afa1580156113f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114199190613810565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161147a9392919061387e565b6000604051808303818588803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b50505050505b803411156114db57336108fc6114c38334613671565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6114f382612e94565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061157157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611565600080516020613e5c8339815191525490565b6001600160a01b031614155b1561158f5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156115e9575060408051601f3d908101601f191682019092526115e691810190613810565b60015b61161157604051630c76093760e01b81526001600160a01b0383166004820152602401610871565b600080516020613e5c833981519152811461164257604051632a87526960e21b815260048101829052602401610871565b600080516020613e5c8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561170d576000836001600160a01b0316836040516116a99190613918565b600060405180830381855af49150503d80600081146116e4576040519150601f19603f3d011682016040523d82523d6000602084013e6116e9565b606091505b505090508061170b576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b60008381526003602052604081205460028054839290811061173657611736613645565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061176a5761176a613645565b90600052602060002090600c0201600001848154811061178c5761178c613645565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa1580156117ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180e919061372d565b506003850154919350915060ff168015611832575081836002015414806118325750805b156118455761271094505050505061184e565b60009450505050505b9392505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118a05760405163703e46dd60e11b815260040160405180910390fd5b50600080516020613e5c83398151915290565b600281815481106118c357600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff90911692916118f690613844565b80601f016020809104026020016040519081016040528092919081815260200182805461192290613844565b801561196f5780601f106119445761010080835404028352916020019161196f565b820191906000526020600020905b81548152906001019060200180831161195257829003601f168201915b5050505050905083565b60008481526003602052604090205460028054869290811061199d5761199d613645565b600091825260209091206002600590920201015460ff16156119d15760405162461bcd60e51b8152600401610871906137b5565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3f91906136b0565b5090935060019250611a4f915050565b816004811115611a6157611a61613717565b14611abe5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610871565b82611afb5760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610871565b600086815260036020526040812054600280549091908110611b1f57611b1f613645565b60009182526020822060059091020180549092508290611b4190600190613671565b81548110611b5157611b51613645565b90600052602060002090600c0201905060005b86811015611c1f573382898984818110611b8057611b80613645565b9050602002013581548110611b9757611b97613645565b60009182526020909120600490910201546001600160a01b031614611bce5760405162461bcd60e51b815260040161087190613934565b8582898984818110611be257611be2613645565b9050602002013581548110611bf957611bf9613645565b600091825260209091206001600490920201015580611c178161396b565b915050611b64565b5086869050816005016000828254611c3791906137a2565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890611c74908b908b908b906139b6565b60405180910390a35050505050505050565b6000818152600360205260408120546002805460609392908110611cac57611cac613645565b60009182526020822060059091020180549092508290611cce90600190613671565b81548110611cde57611cde613645565b90600052602060002090600c0201905080600a01805480602002602001604051908101604052809291908181526020018280548015611d3c57602002820191906000526020600020905b815481526020019060010190808311611d28575b505050505092505050919050565b60008060008060008060006002600360008c81526020019081526020016000205481548110611d7b57611d7b613645565b600091825260208083208c8452600360059093020191820190526040822054815491935083918110611daf57611daf613645565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611e2657611e26613645565b60009182526020822060059091020180549092508290611e4890600190613671565b81548110611e5857611e58613645565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b03163314611ea35760405162461bcd60e51b8152600401610871906139da565b6000836001600160a01b03168383604051611ebe9190613918565b60006040518083038185875af1925050503d8060008114611efb576040519150601f19603f3d011682016040523d82523d6000602084013e611f00565b606091505b505090508061170b5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610871565b600086815260036020526040902054600280548892908110611f6957611f69613645565b600091825260209091206002600590920201015460ff1615611f9d5760405162461bcd60e51b8152600401610871906137b5565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906136b0565b509093506002925061201b915050565b81600481111561202d5761202d613717565b146120885760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610871565b856120ca5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610871565b6000888152600360205260408120546002805490919081106120ee576120ee613645565b9060005260206000209060050201905080600101548611156121495760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610871565b8054600090829061215c90600190613671565b8154811061216c5761216c613645565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa1580156121c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121eb91906136b0565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015612246573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226a9190613a1c565b505050505091505060005b8a8110156124e75733848d8d8481811061229157612291613645565b90506020020135815481106122a8576122a8613645565b60009182526020909120600490910201546001600160a01b0316146122df5760405162461bcd60e51b815260040161087190613934565b811580612353575089888a6040516020016122fc93929190613a86565b60405160208183030381529060405280519060200120846000018d8d8481811061232857612328613645565b905060200201358154811061233f5761233f613645565b906000526020600020906004020160010154145b6123c55760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610871565b838c8c838181106123d8576123d8613645565b90506020020135815481106123ef576123ef613645565b600091825260209091206003600490920201015460ff16156124485760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610871565b89848d8d8481811061245c5761245c613645565b905060200201358154811061247357612473613645565b60009182526020909120600260049092020101556001848d8d8481811061249c5761249c613645565b90506020020135815481106124b3576124b3613645565b60009182526020909120600490910201600301805460ff1916911515919091179055806124df8161396b565b915050612275565b508a8a90508360040160008282546124ff91906137a2565b90915550506000898152600284016020526040812080548c92906125249084906137a2565b90915550506001830154890361255357600383015460ff161561254e5760038301805460ff191690555b6125cc565b60018301546000908152600284016020526040808220548b83529120540361259557600383015460ff1661254e5760038301805460ff191660011790556125cc565b60018301546000908152600284016020526040808220548b835291205411156125cc576001830189905560038301805460ff191690555b88336001600160a01b03168d7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48e8e8c60405161260b93929190613ab3565b60405180910390a4505050505050505050505050565b6000546001600160a01b0316331461264b5760405162461bcd60e51b8152600401610871906139da565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce10699684846040516126a9929190613b0c565b60405180910390a3505050565b60008060008060006002600360008a815260200190815260200160002054815481106126e4576126e4613645565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061271857612718613645565b90600052602060002090600c0201600001878154811061273a5761273a613645565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146127a65760405162461bcd60e51b815260040161087190613b28565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad201612831858783613bba565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015612888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ac9190613810565b6128b69190613671565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581089061293f908a908a908a90613c7a565b60405180910390a25050505050505050565b60008381526003602052604081205460028054839290811061297557612975613645565b600091825260208083208784526003600590930201918201905260408220548154919350839181106129a9576129a9613645565b90600052602060002090600c020160000184815481106129cb576129cb613645565b600091825260209091206004909102016003015460ff169695505050505050565b6001546000906001600160a01b03163314612a195760405162461bcd60e51b815260040161087190613b28565b600083815260036020526040902054600280548592908110612a3d57612a3d613645565b600091825260209091206002600590920201015460ff1615612a715760405162461bcd60e51b8152600401610871906137b5565b600084815260036020526040812054600280549091908110612a9557612a95613645565b60009182526020822060059091020180549092508290612ab790600190613671565b81548110612ac757612ac7613645565b90600052602060002090600c020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b509190613c94565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc391906136b0565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa158015612c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4b9190613c94565b9650612c578988612ec1565b15612ce457604080516080810182526001600160a01b03898116825260006020808401828152948401828152606085018381528a5460018082018d558c8652939094209551600490940290950180546001600160a01b0319169390941692909217835593519382019390935591516002830155516003909101805460ff1916911515919091179055612ce9565b600096505b50505050505092915050565b600082815260036020526040812054600280548392908110612d1957612d19613645565b60009182526020808320868452600360059093020191820190526040822054815491935083918110612d4d57612d4d613645565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa158015612dac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dd0919061372d565b5091509150826004015460001480612dff575080158015612dff57506000828152600284016020526040902054155b15612e11576000945050505050612e42565b8015612e26575050600401549150612e429050565b506000908152600290910160205260409020549150612e429050565b92915050565b6000546001600160a01b03163314612e725760405162461bcd60e51b8152600401610871906139da565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314612ebe5760405162461bcd60e51b8152600401610871906139da565b50565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612f0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3391906136b0565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015612f92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb69190613810565b612fc09190613671565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015613001573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130299190810190613d44565b60200151600154604051631a383be960e31b81526001600160a01b0387811660048301526001600160601b03861660248301529293506000928392169063d1c1df4890604401608060405180830381865afa15801561308c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130b09190613e25565b50509150915082816130c291906137a2565b909110159695505050505050565b6000602082840312156130e257600080fd5b5035919050565b6001600160a01b0381168114612ebe57600080fd5b6000806000806080858703121561311457600080fd5b843593506020850135613126816130e9565b93969395505050506040820135916060013590565b6000806040838503121561314e57600080fd5b8235613159816130e9565b91506020830135613169816130e9565b809150509250929050565b6000806040838503121561318757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b03811182821017156131cf576131cf613196565b60405290565b604051601f8201601f191681016001600160401b03811182821017156131fd576131fd613196565b604052919050565b60006001600160401b0383111561321e5761321e613196565b613231601f8401601f19166020016131d5565b905082815283838301111561324557600080fd5b828260208301376000602084830101529392505050565b600082601f83011261326d57600080fd5b61184e83833560208501613205565b6000806040838503121561328f57600080fd5b823561329a816130e9565b915060208301356001600160401b038111156132b557600080fd5b6132c18582860161325c565b9150509250929050565b6000806000606084860312156132e057600080fd5b505081359360208301359350604090920135919050565b60005b838110156133125781810151838201526020016132fa565b50506000910152565b600081518084526133338160208601602086016132f7565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613368606083018461331b565b95945050505050565b60008083601f84011261338357600080fd5b5081356001600160401b0381111561339a57600080fd5b6020830191508360208260051b85010111156133b557600080fd5b9250929050565b600080600080606085870312156133d257600080fd5b8435935060208501356001600160401b038111156133ef57600080fd5b6133fb87828801613371565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156134465783518352928401929184019160010161342a565b50909695505050505050565b60008060006060848603121561346757600080fd5b8335613472816130e9565b92506020840135915060408401356001600160401b0381111561349457600080fd5b6134a08682870161325c565b9150509250925092565b60008060008060008060a087890312156134c357600080fd5b8635955060208701356001600160401b03808211156134e157600080fd5b6134ed8a838b01613371565b90975095506040890135945060608901359350608089013591508082111561351457600080fd5b508701601f8101891361352657600080fd5b61353589823560208401613205565b9150509295509295509295565b60006020828403121561355457600080fd5b813561184e816130e9565b60008083601f84011261357157600080fd5b5081356001600160401b0381111561358857600080fd5b6020830191508360208285010111156133b557600080fd5b6000806000604084860312156135b557600080fd5b8335925060208401356001600160401b038111156135d257600080fd5b6135de8682870161355f565b9497909650939450505050565b60008060008060006080868803121561360357600080fd5b853594506020860135935060408601356001600160401b0381111561362757600080fd5b6136338882890161355f565b96999598509660600135949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115612e4257612e4261365b565b80516001600160601b038116811461369b57600080fd5b919050565b8051801515811461369b57600080fd5b600080600080600060a086880312156136c857600080fd5b6136d186613684565b945060208601516136e1816130e9565b6040870151909450600581106136f657600080fd5b9250613704606087016136a0565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60008060006060848603121561374257600080fd5b83519250613752602085016136a0565b9150613760604085016136a0565b90509250925092565b8082028115828204841417612e4257612e4261365b565b60008261379d57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612e4257612e4261365b565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080604083850312156137ff57600080fd5b505080516020909101519092909150565b60006020828403121561382257600080fd5b5051919050565b60006020828403121561383b57600080fd5b61184e826136a0565b600181811c9082168061385857607f821691505b60208210810361387857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845461389e81613844565b80606087015260806001808416600081146138c057600181146138da57613908565b60ff1985168984015283151560051b890183019550613908565b896000528660002060005b858110156139005781548b82018601529083019088016138e5565b8a0184019650505b50939a9950505050505050505050565b6000825161392a8184602087016132f7565b9190910192915050565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b60006001820161397d5761397d61365b565b5060010190565b81835260006001600160fb1b0383111561399d57600080fd5b8260051b80836020870137939093016020019392505050565b6040815260006139ca604083018587613984565b9050826020830152949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600080600080600080600060e0888a031215613a3757600080fd5b613a4088613684565b9650613a4e602089016136a0565b955060408801519450606088015193506080880151925060a08801519150613a7860c089016136a0565b905092959891949750929550565b83815260008351613a9e8160208501602088016132f7565b60209201918201929092526040019392505050565b604081526000613ac7604083018587613984565b8281036020840152613ad9818561331b565b9695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000613b20602083018486613ae3565b949350505050565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f82111561170d57600081815260208120601f850160051c81016020861015613b935750805b601f850160051c820191505b81811015613bb257828155600101613b9f565b505050505050565b6001600160401b03831115613bd157613bd1613196565b613be583613bdf8354613844565b83613b6c565b6000601f841160018114613c195760008515613c015750838201355b600019600387901b1c1916600186901b178355613c73565b600083815260209020601f19861690835b82811015613c4a5786850135825560209485019460019092019101613c2a565b5086821015613c675760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b838152604060208201526000613368604083018486613ae3565b600060208284031215613ca657600080fd5b815161184e816130e9565b600082601f830112613cc257600080fd5b815160206001600160401b03821115613cdd57613cdd613196565b8160051b613cec8282016131d5565b9283528481018201928281019087851115613d0657600080fd5b83870192505b84831015613d2e578251613d1f816130e9565b82529183019190830190613d0c565b979650505050505050565b805161369b816130e9565b600060208284031215613d5657600080fd5b81516001600160401b0380821115613d6d57600080fd5b908301906101608286031215613d8257600080fd5b613d8a6131ac565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015182811115613dd257600080fd5b613dde87828601613cb1565b60c08301525060e0838101519082015261010080840151908201526101209150613e09828401613d39565b9181019190915261014091820151918101919091529392505050565b60008060008060808587031215613e3b57600080fd5b50508251602084015160408501516060909501519196909550909250905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca264697066735822122056557df8ae3687441a934036471e7ec15a7a35687881d7f4aa31efb5c64cd1cb64736f6c63430008120033", + "deployedBytecode": "0x60806040526004361061018d5760003560e01c8063751accd0116100d7578063b6ede54011610085578063b6ede540146104f5578063ba66fde714610515578063be46760414610535578063d2b8035a1461054b578063da3beb8c1461056b578063e349ad301461041d578063e4c0aaf41461058b578063f2f4eb26146105ab57600080fd5b8063751accd0146103fd578063796490f91461041d5780637c04034e146104335780638e42646014610453578063a6a7f0eb14610473578063a7cc08fe14610493578063b34bfaa8146104df57600080fd5b80634f1ef2861161013f5780634f1ef286146102cc5780634fe264fb146102df57806352d1902d146102ff578063564a565d146103145780635c92e2f61461034357806365540b961461036357806369f3f041146103905780636d4cd8ea146103dd57600080fd5b80630baa64d1146101925780630c340a24146101c75780631200aabc146101ff5780631c3db16d1461023a578063362c347914610277578063485cc955146102975780634b2f0ea0146102b9575b600080fd5b34801561019e57600080fd5b506101b26101ad3660046130d0565b6105cb565b60405190151581526020015b60405180910390f35b3480156101d357600080fd5b506000546101e7906001600160a01b031681565b6040516001600160a01b0390911681526020016101be565b34801561020b57600080fd5b5061022c61021a3660046130d0565b60036020526000908152604090205481565b6040519081526020016101be565b34801561024657600080fd5b5061025a6102553660046130d0565b610642565b6040805193845291151560208401521515908201526060016101be565b34801561028357600080fd5b5061022c6102923660046130fe565b6107b0565b3480156102a357600080fd5b506102b76102b236600461313b565b610b86565b005b6102b76102c7366004613174565b610c83565b6102b76102da36600461327c565b6114ea565b3480156102eb57600080fd5b5061022c6102fa3660046132cb565b611712565b34801561030b57600080fd5b5061022c611855565b34801561032057600080fd5b5061033461032f3660046130d0565b6118b3565b6040516101be93929190613347565b34801561034f57600080fd5b506102b761035e3660046133bc565b611979565b34801561036f57600080fd5b5061038361037e3660046130d0565b611c86565b6040516101be919061340e565b34801561039c57600080fd5b506103b06103ab3660046132cb565b611d4a565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101be565b3480156103e957600080fd5b506101b26103f83660046130d0565b611e02565b34801561040957600080fd5b506102b7610418366004613452565b611e79565b34801561042957600080fd5b5061022c61271081565b34801561043f57600080fd5b506102b761044e3660046134aa565b611f45565b34801561045f57600080fd5b506102b761046e366004613542565b612621565b34801561047f57600080fd5b506102b761048e3660046135a0565b61266d565b34801561049f57600080fd5b506104b36104ae3660046132cb565b6126b6565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101be565b3480156104eb57600080fd5b5061022c614e2081565b34801561050157600080fd5b506102b76105103660046135eb565b61277c565b34801561052157600080fd5b506101b26105303660046132cb565b612951565b34801561054157600080fd5b5061022c61138881565b34801561055757600080fd5b506101e7610566366004613174565b6129ec565b34801561057757600080fd5b5061022c610586366004613174565b612cf5565b34801561059757600080fd5b506102b76105a6366004613542565b612e48565b3480156105b757600080fd5b506001546101e7906001600160a01b031681565b6000818152600360205260408120546002805483929081106105ef576105ef613645565b6000918252602082206005909102018054909250829061061190600190613671565b8154811061062157610621613645565b60009182526020909120600c90910201805460059091015414949350505050565b600080600080600260036000878152602001908152602001600020548154811061066e5761066e613645565b6000918252602082206005909102018054909250829061069090600190613671565b815481106106a0576106a0613645565b60009182526020909120600c90910201600381015460ff1694509050836106cb5780600101546106ce565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa15801561071d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074191906136b0565b5090935060049250610751915050565b81600481111561076357610763613717565b036107a657600061077388611c86565b905080516001036107a4578060008151811061079157610791613645565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156107fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082291906136b0565b5093505050508061087a5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064015b60405180910390fd5b60008681526003602052604081205460028054909190811061089e5761089e613645565b600091825260208083208884526003600590930201918201905260408220548154919350839181106108d2576108d2613645565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa15801561092d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610951919061372d565b5050600087815260078401602052604090205490915060ff1661099b576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610ae0565b808603610a105760008681526006830160205260409020546109be576000610a09565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b86529093529220546109ff9190613769565b610a099190613780565b9450610ae0565b600081815260078301602052604090205460ff16610ae05781600601600083600a01600181548110610a4457610a44613645565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610a7a57610a7a613645565b9060005260206000200154815260200190815260200160002054610a9e91906137a2565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610ad39190613769565b610add9190613780565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610b7a576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680610bcf575080546001600160401b03808416911610155b15610bec5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600080546001600160a01b038781166001600160a01b0319928316179092556001805492871692909116919091179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b600082815260036020526040902054600280548492908110610ca757610ca7613645565b600091825260209091206002600590920201015460ff1615610cdb5760405162461bcd60e51b8152600401610871906137b5565b600083815260036020526040812054600280549091908110610cff57610cff613645565b906000526020600020906005020190508060010154831115610d635760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610871565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa158015610db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd491906137ec565b91509150814210158015610de757508042105b610e2c5760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610871565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015610e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e91919061372d565b50509050868103610ea6576127109150610f27565b612710611388610eb68686613671565b610ec09190613769565b610eca9190613780565b610ed48542613671565b10610f215760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610871565b614e2091505b84546000908690610f3a90600190613671565b81548110610f4a57610f4a613645565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015610fa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcd9190613810565b610fd79190613671565b60008a815260078401602052604090205490915060ff161561103b5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610871565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa158015611085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a99190613810565b905060006127106110ba8784613769565b6110c49190613780565b6110ce90836137a2565b60008c81526006860160205260408120549192509082111561117f5760008c815260068601602052604090205434906111079084613671565b1161112c5760008c81526006860160205260409020546111279083613671565b61112e565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611176929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906111ab9084906137a2565b909155505060008c8152600686016020526040812080548392906111d09084906137a2565b909155505060008c815260068601602052604090205482116112a25760008c8152600686016020526040812054600987018054919290916112129084906137a2565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156114ad578285600901546112bf9190613671565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa15801561130d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113319190613829565b1561134a5760028a01805460ff1916600117905561142d565b895460038b01600061135d8760016137a2565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b81526004016113d891815260200190565b602060405180830381865afa1580156113f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114199190613810565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161147a9392919061387e565b6000604051808303818588803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b50505050505b803411156114db57336108fc6114c38334613671565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6114f382612e94565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061157157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611565600080516020613e5c8339815191525490565b6001600160a01b031614155b1561158f5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156115e9575060408051601f3d908101601f191682019092526115e691810190613810565b60015b61161157604051630c76093760e01b81526001600160a01b0383166004820152602401610871565b600080516020613e5c833981519152811461164257604051632a87526960e21b815260048101829052602401610871565b600080516020613e5c8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561170d576000836001600160a01b0316836040516116a99190613918565b600060405180830381855af49150503d80600081146116e4576040519150601f19603f3d011682016040523d82523d6000602084013e6116e9565b606091505b505090508061170b576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b60008381526003602052604081205460028054839290811061173657611736613645565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061176a5761176a613645565b90600052602060002090600c0201600001848154811061178c5761178c613645565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa1580156117ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180e919061372d565b506003850154919350915060ff168015611832575081836002015414806118325750805b156118455761271094505050505061184e565b60009450505050505b9392505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118a05760405163703e46dd60e11b815260040160405180910390fd5b50600080516020613e5c83398151915290565b600281815481106118c357600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff90911692916118f690613844565b80601f016020809104026020016040519081016040528092919081815260200182805461192290613844565b801561196f5780601f106119445761010080835404028352916020019161196f565b820191906000526020600020905b81548152906001019060200180831161195257829003601f168201915b5050505050905083565b60008481526003602052604090205460028054869290811061199d5761199d613645565b600091825260209091206002600590920201015460ff16156119d15760405162461bcd60e51b8152600401610871906137b5565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3f91906136b0565b5090935060019250611a4f915050565b816004811115611a6157611a61613717565b14611abe5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610871565b82611afb5760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610871565b600086815260036020526040812054600280549091908110611b1f57611b1f613645565b60009182526020822060059091020180549092508290611b4190600190613671565b81548110611b5157611b51613645565b90600052602060002090600c0201905060005b86811015611c1f573382898984818110611b8057611b80613645565b9050602002013581548110611b9757611b97613645565b60009182526020909120600490910201546001600160a01b031614611bce5760405162461bcd60e51b815260040161087190613934565b8582898984818110611be257611be2613645565b9050602002013581548110611bf957611bf9613645565b600091825260209091206001600490920201015580611c178161396b565b915050611b64565b5086869050816005016000828254611c3791906137a2565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890611c74908b908b908b906139b6565b60405180910390a35050505050505050565b6000818152600360205260408120546002805460609392908110611cac57611cac613645565b60009182526020822060059091020180549092508290611cce90600190613671565b81548110611cde57611cde613645565b90600052602060002090600c0201905080600a01805480602002602001604051908101604052809291908181526020018280548015611d3c57602002820191906000526020600020905b815481526020019060010190808311611d28575b505050505092505050919050565b60008060008060008060006002600360008c81526020019081526020016000205481548110611d7b57611d7b613645565b600091825260208083208c8452600360059093020191820190526040822054815491935083918110611daf57611daf613645565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611e2657611e26613645565b60009182526020822060059091020180549092508290611e4890600190613671565b81548110611e5857611e58613645565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b03163314611ea35760405162461bcd60e51b8152600401610871906139da565b6000836001600160a01b03168383604051611ebe9190613918565b60006040518083038185875af1925050503d8060008114611efb576040519150601f19603f3d011682016040523d82523d6000602084013e611f00565b606091505b505090508061170b5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610871565b600086815260036020526040902054600280548892908110611f6957611f69613645565b600091825260209091206002600590920201015460ff1615611f9d5760405162461bcd60e51b8152600401610871906137b5565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906136b0565b509093506002925061201b915050565b81600481111561202d5761202d613717565b146120885760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610871565b856120ca5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610871565b6000888152600360205260408120546002805490919081106120ee576120ee613645565b9060005260206000209060050201905080600101548611156121495760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610871565b8054600090829061215c90600190613671565b8154811061216c5761216c613645565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa1580156121c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121eb91906136b0565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015612246573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226a9190613a1c565b505050505091505060005b8a8110156124e75733848d8d8481811061229157612291613645565b90506020020135815481106122a8576122a8613645565b60009182526020909120600490910201546001600160a01b0316146122df5760405162461bcd60e51b815260040161087190613934565b811580612353575089888a6040516020016122fc93929190613a86565b60405160208183030381529060405280519060200120846000018d8d8481811061232857612328613645565b905060200201358154811061233f5761233f613645565b906000526020600020906004020160010154145b6123c55760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610871565b838c8c838181106123d8576123d8613645565b90506020020135815481106123ef576123ef613645565b600091825260209091206003600490920201015460ff16156124485760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610871565b89848d8d8481811061245c5761245c613645565b905060200201358154811061247357612473613645565b60009182526020909120600260049092020101556001848d8d8481811061249c5761249c613645565b90506020020135815481106124b3576124b3613645565b60009182526020909120600490910201600301805460ff1916911515919091179055806124df8161396b565b915050612275565b508a8a90508360040160008282546124ff91906137a2565b90915550506000898152600284016020526040812080548c92906125249084906137a2565b90915550506001830154890361255357600383015460ff161561254e5760038301805460ff191690555b6125cc565b60018301546000908152600284016020526040808220548b83529120540361259557600383015460ff1661254e5760038301805460ff191660011790556125cc565b60018301546000908152600284016020526040808220548b835291205411156125cc576001830189905560038301805460ff191690555b88336001600160a01b03168d7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48e8e8c60405161260b93929190613ab3565b60405180910390a4505050505050505050505050565b6000546001600160a01b0316331461264b5760405162461bcd60e51b8152600401610871906139da565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce10699684846040516126a9929190613b0c565b60405180910390a3505050565b60008060008060006002600360008a815260200190815260200160002054815481106126e4576126e4613645565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061271857612718613645565b90600052602060002090600c0201600001878154811061273a5761273a613645565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146127a65760405162461bcd60e51b815260040161087190613b28565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad201612831858783613bba565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa158015612888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ac9190613810565b6128b69190613671565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581089061293f908a908a908a90613c7a565b60405180910390a25050505050505050565b60008381526003602052604081205460028054839290811061297557612975613645565b600091825260208083208784526003600590930201918201905260408220548154919350839181106129a9576129a9613645565b90600052602060002090600c020160000184815481106129cb576129cb613645565b600091825260209091206004909102016003015460ff169695505050505050565b6001546000906001600160a01b03163314612a195760405162461bcd60e51b815260040161087190613b28565b600083815260036020526040902054600280548592908110612a3d57612a3d613645565b600091825260209091206002600590920201015460ff1615612a715760405162461bcd60e51b8152600401610871906137b5565b600084815260036020526040812054600280549091908110612a9557612a95613645565b60009182526020822060059091020180549092508290612ab790600190613671565b81548110612ac757612ac7613645565b90600052602060002090600c020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b509190613c94565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc391906136b0565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa158015612c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4b9190613c94565b9650612c578988612ec1565b15612ce457604080516080810182526001600160a01b03898116825260006020808401828152948401828152606085018381528a5460018082018d558c8652939094209551600490940290950180546001600160a01b0319169390941692909217835593519382019390935591516002830155516003909101805460ff1916911515919091179055612ce9565b600096505b50505050505092915050565b600082815260036020526040812054600280548392908110612d1957612d19613645565b60009182526020808320868452600360059093020191820190526040822054815491935083918110612d4d57612d4d613645565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa158015612dac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dd0919061372d565b5091509150826004015460001480612dff575080158015612dff57506000828152600284016020526040902054155b15612e11576000945050505050612e42565b8015612e26575050600401549150612e429050565b506000908152600290910160205260409020549150612e429050565b92915050565b6000546001600160a01b03163314612e725760405162461bcd60e51b8152600401610871906139da565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314612ebe5760405162461bcd60e51b8152600401610871906139da565b50565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612f0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3391906136b0565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015612f92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb69190613810565b612fc09190613671565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015613001573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130299190810190613d44565b60200151600154604051631a383be960e31b81526001600160a01b0387811660048301526001600160601b03861660248301529293506000928392169063d1c1df4890604401608060405180830381865afa15801561308c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130b09190613e25565b50509150915082816130c291906137a2565b909110159695505050505050565b6000602082840312156130e257600080fd5b5035919050565b6001600160a01b0381168114612ebe57600080fd5b6000806000806080858703121561311457600080fd5b843593506020850135613126816130e9565b93969395505050506040820135916060013590565b6000806040838503121561314e57600080fd5b8235613159816130e9565b91506020830135613169816130e9565b809150509250929050565b6000806040838503121561318757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b03811182821017156131cf576131cf613196565b60405290565b604051601f8201601f191681016001600160401b03811182821017156131fd576131fd613196565b604052919050565b60006001600160401b0383111561321e5761321e613196565b613231601f8401601f19166020016131d5565b905082815283838301111561324557600080fd5b828260208301376000602084830101529392505050565b600082601f83011261326d57600080fd5b61184e83833560208501613205565b6000806040838503121561328f57600080fd5b823561329a816130e9565b915060208301356001600160401b038111156132b557600080fd5b6132c18582860161325c565b9150509250929050565b6000806000606084860312156132e057600080fd5b505081359360208301359350604090920135919050565b60005b838110156133125781810151838201526020016132fa565b50506000910152565b600081518084526133338160208601602086016132f7565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613368606083018461331b565b95945050505050565b60008083601f84011261338357600080fd5b5081356001600160401b0381111561339a57600080fd5b6020830191508360208260051b85010111156133b557600080fd5b9250929050565b600080600080606085870312156133d257600080fd5b8435935060208501356001600160401b038111156133ef57600080fd5b6133fb87828801613371565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156134465783518352928401929184019160010161342a565b50909695505050505050565b60008060006060848603121561346757600080fd5b8335613472816130e9565b92506020840135915060408401356001600160401b0381111561349457600080fd5b6134a08682870161325c565b9150509250925092565b60008060008060008060a087890312156134c357600080fd5b8635955060208701356001600160401b03808211156134e157600080fd5b6134ed8a838b01613371565b90975095506040890135945060608901359350608089013591508082111561351457600080fd5b508701601f8101891361352657600080fd5b61353589823560208401613205565b9150509295509295509295565b60006020828403121561355457600080fd5b813561184e816130e9565b60008083601f84011261357157600080fd5b5081356001600160401b0381111561358857600080fd5b6020830191508360208285010111156133b557600080fd5b6000806000604084860312156135b557600080fd5b8335925060208401356001600160401b038111156135d257600080fd5b6135de8682870161355f565b9497909650939450505050565b60008060008060006080868803121561360357600080fd5b853594506020860135935060408601356001600160401b0381111561362757600080fd5b6136338882890161355f565b96999598509660600135949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115612e4257612e4261365b565b80516001600160601b038116811461369b57600080fd5b919050565b8051801515811461369b57600080fd5b600080600080600060a086880312156136c857600080fd5b6136d186613684565b945060208601516136e1816130e9565b6040870151909450600581106136f657600080fd5b9250613704606087016136a0565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60008060006060848603121561374257600080fd5b83519250613752602085016136a0565b9150613760604085016136a0565b90509250925092565b8082028115828204841417612e4257612e4261365b565b60008261379d57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612e4257612e4261365b565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080604083850312156137ff57600080fd5b505080516020909101519092909150565b60006020828403121561382257600080fd5b5051919050565b60006020828403121561383b57600080fd5b61184e826136a0565b600181811c9082168061385857607f821691505b60208210810361387857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845461389e81613844565b80606087015260806001808416600081146138c057600181146138da57613908565b60ff1985168984015283151560051b890183019550613908565b896000528660002060005b858110156139005781548b82018601529083019088016138e5565b8a0184019650505b50939a9950505050505050505050565b6000825161392a8184602087016132f7565b9190910192915050565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b60006001820161397d5761397d61365b565b5060010190565b81835260006001600160fb1b0383111561399d57600080fd5b8260051b80836020870137939093016020019392505050565b6040815260006139ca604083018587613984565b9050826020830152949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600080600080600080600060e0888a031215613a3757600080fd5b613a4088613684565b9650613a4e602089016136a0565b955060408801519450606088015193506080880151925060a08801519150613a7860c089016136a0565b905092959891949750929550565b83815260008351613a9e8160208501602088016132f7565b60209201918201929092526040019392505050565b604081526000613ac7604083018587613984565b8281036020840152613ad9818561331b565b9695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000613b20602083018486613ae3565b949350505050565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f82111561170d57600081815260208120601f850160051c81016020861015613b935750805b601f850160051c820191505b81811015613bb257828155600101613b9f565b505050505050565b6001600160401b03831115613bd157613bd1613196565b613be583613bdf8354613844565b83613b6c565b6000601f841160018114613c195760008515613c015750838201355b600019600387901b1c1916600186901b178355613c73565b600083815260209020601f19861690835b82811015613c4a5786850135825560209485019460019092019101613c2a565b5086821015613c675760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b838152604060208201526000613368604083018486613ae3565b600060208284031215613ca657600080fd5b815161184e816130e9565b600082601f830112613cc257600080fd5b815160206001600160401b03821115613cdd57613cdd613196565b8160051b613cec8282016131d5565b9283528481018201928281019087851115613d0657600080fd5b83870192505b84831015613d2e578251613d1f816130e9565b82529183019190830190613d0c565b979650505050505050565b805161369b816130e9565b600060208284031215613d5657600080fd5b81516001600160401b0380821115613d6d57600080fd5b908301906101608286031215613d8257600080fd5b613d8a6131ac565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015182811115613dd257600080fd5b613dde87828601613cb1565b60c08301525060e0838101519082015261010080840151908201526101209150613e09828401613d39565b9181019190915261014091820151918101919091529392505050565b60008060008060808587031215613e3b57600080fd5b50508251602084015160408501516060909501519196909550909250905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca264697066735822122056557df8ae3687441a934036471e7ec15a7a35687881d7f4aa31efb5c64cd1cb64736f6c63430008120033", + "devdoc": { + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "ChoiceFunded(uint256,uint256,uint256)": { + "details": "To be emitted when a choice is fully funded for an appeal.", + "params": { + "_choice": "The choice that is being funded.", + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_coreRoundID": "The identifier of the round in the Arbitrator contract." + } + }, + "CommitCast(uint256,address,uint256[],bytes32)": { + "details": "To be emitted when a vote commitment is cast.", + "params": { + "_commit": "The commitment of the juror.", + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_juror": "The address of the juror casting the vote commitment.", + "_voteIDs": "The identifiers of the votes in the dispute." + } + }, + "Contribution(uint256,uint256,uint256,address,uint256)": { + "details": "To be emitted when a funding contribution is made.", + "params": { + "_amount": "The amount contributed.", + "_choice": "The choice that is being funded.", + "_contributor": "The address of the contributor.", + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_coreRoundID": "The identifier of the round in the Arbitrator contract." + } + }, + "DisputeCreation(uint256,uint256,bytes)": { + "details": "To be emitted when a dispute is created.", + "params": { + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_extraData": "The extra data for the dispute.", + "_numberOfChoices": "The number of choices available in the dispute." + } + }, + "Evidence(uint256,address,string)": { + "details": "To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).", + "params": { + "_evidence": "IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'", + "_externalDisputeID": "Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.", + "_party": "The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party." + } + }, + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + }, + "VoteCast(uint256,address,uint256[],uint256,string)": { + "details": "Emitted when casting a vote to provide the justification of juror's choice.", + "params": { + "_choice": "The choice juror voted for.", + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_juror": "Address of the juror.", + "_justification": "Justification of the choice.", + "_voteIDs": "The identifiers of the votes in the dispute." + } + }, + "Withdrawal(uint256,uint256,uint256,address,uint256)": { + "details": "To be emitted when the contributed funds are withdrawn.", + "params": { + "_amount": "The amount withdrawn.", + "_choice": "The choice that is being funded.", + "_contributor": "The address of the contributor.", + "_coreDisputeID": "The identifier of the dispute in the Arbitrator contract.", + "_coreRoundID": "The identifier of the round in the Arbitrator contract." + } + } + }, + "kind": "dev", + "methods": { + "areCommitsAllCast(uint256)": { + "details": "Returns true if all of the jurors have cast their commits for the last round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core." + }, + "returns": { + "_0": "Whether all of the jurors have cast their commits for the last round." + } + }, + "areVotesAllCast(uint256)": { + "details": "Returns true if all of the jurors have cast their votes for the last round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core." + }, + "returns": { + "_0": "Whether all of the jurors have cast their votes for the last round." + } + }, + "castCommit(uint256,uint256[],bytes32)": { + "details": "Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.", + "params": { + "_commit": "The commit. Note that justification string is a part of the commit.", + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_voteIDs": "The IDs of the votes." + } + }, + "castVote(uint256,uint256[],uint256,uint256,string)": { + "details": "Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.", + "params": { + "_choice": "The choice.", + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_justification": "Justification of the choice.", + "_salt": "The salt for the commit if the votes were hidden.", + "_voteIDs": "The IDs of the votes." + } + }, + "changeCore(address)": { + "details": "Changes the `core` storage variable.", + "params": { + "_core": "The new value for the `core` storage variable." + } + }, + "changeGovernor(address)": { + "details": "Changes the `governor` storage variable.", + "params": { + "_governor": "The new value for the `governor` storage variable." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "createDispute(uint256,uint256,bytes,uint256)": { + "details": "Creates a local dispute and maps it to the dispute ID in the Core contract. Note: Access restricted to Kleros Core only.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_extraData": "Additional info about the dispute, for possible use in future dispute kits.", + "_nbVotes": "Number of votes for this dispute.", + "_numberOfChoices": "Number of choices of the dispute" + } + }, + "currentRuling(uint256)": { + "details": "Gets the current ruling of a specified dispute.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core." + }, + "returns": { + "overridden": "Whether the ruling was overridden by appeal funding or not.", + "ruling": "The current ruling.", + "tied": "Whether it's a tie or not." + } + }, + "draw(uint256,uint256)": { + "details": "Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. Note: Access restricted to Kleros Core only.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_nonce": "Nonce of the drawing iteration." + }, + "returns": { + "drawnAddress": "The drawn address." + } + }, + "executeGovernorProposal(address,uint256,bytes)": { + "details": "Allows the governor to call anything on behalf of the contract.", + "params": { + "_amount": "The value sent with the call.", + "_data": "The data sent with the call.", + "_destination": "The destination of the call." + } + }, + "fundAppeal(uint256,uint256)": { + "details": "Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.", + "params": { + "_choice": "A choice that receives funding.", + "_coreDisputeID": "Index of the dispute in Kleros Core." + } + }, + "getCoherentCount(uint256,uint256)": { + "details": "Gets the number of jurors who are eligible to a reward in this round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", + "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit." + }, + "returns": { + "_0": "The number of coherent jurors." + } + }, + "getDegreeOfCoherence(uint256,uint256,uint256)": { + "details": "Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", + "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit.", + "_voteID": "The ID of the vote." + }, + "returns": { + "_0": "The degree of coherence in basis points." + } + }, + "initialize(address,address)": { + "details": "Initializer.", + "params": { + "_core": "The KlerosCore arbitrator.", + "_governor": "The governor's address." + } + }, + "isVoteActive(uint256,uint256,uint256)": { + "details": "Returns true if the specified voter was active in this round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit.", + "_coreRoundID": "The ID of the round in Kleros Core, not in the Dispute Kit.", + "_voteID": "The ID of the voter." + }, + "returns": { + "_0": "Whether the voter was active or not." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "submitEvidence(uint256,string)": { + "details": "Submits evidence for a dispute.", + "params": { + "_evidence": "IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.", + "_externalDisputeID": "Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + }, + "withdrawFeesAndRewards(uint256,address,uint256,uint256)": { + "details": "Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.", + "params": { + "_beneficiary": "The address whose rewards to withdraw.", + "_choice": "The ruling option that the caller wants to withdraw from.", + "_coreDisputeID": "Index of the dispute in Kleros Core contract.", + "_coreRoundID": "The round in the Kleros Core contract the caller wants to withdraw from." + }, + "returns": { + "amount": "The withdrawn amount." + } + } + }, + "title": "DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggregation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5290, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5293, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "core", + "offset": 0, + "slot": "1", + "type": "t_contract(KlerosCore)3971" + }, + { + "astId": 5297, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "disputes", + "offset": 0, + "slot": "2", + "type": "t_array(t_struct(Dispute)5229_storage)dyn_storage" + }, + { + "astId": 5301, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreDisputeIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(Dispute)5229_storage)dyn_storage": { + "base": "t_struct(Dispute)5229_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)5267_storage)dyn_storage": { + "base": "t_struct(Round)5267_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Vote)5276_storage)dyn_storage": { + "base": "t_struct(Vote)5276_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Vote[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(KlerosCore)3971": { + "encoding": "inplace", + "label": "contract KlerosCore", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Dispute)5229_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Dispute", + "members": [ + { + "astId": 5218, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "rounds", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Round)5267_storage)dyn_storage" + }, + { + "astId": 5220, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "numberOfChoices", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 5222, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "jumped", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 5226, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreRoundIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 5228, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "extraData", + "offset": 0, + "slot": "4", + "type": "t_bytes_storage" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Round)5267_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Round", + "members": [ + { + "astId": 5233, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "votes", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Vote)5276_storage)dyn_storage" + }, + { + "astId": 5235, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "winningChoice", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 5239, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "counts", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 5241, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "tied", + "offset": 0, + "slot": "3", + "type": "t_bool" + }, + { + "astId": 5243, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalVoted", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 5245, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalCommitted", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 5249, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "paidFees", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 5253, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "hasPaid", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 5259, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "contributions", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 5261, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "feeRewards", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 5264, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "fundedChoices", + "offset": 0, + "slot": "10", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 5266, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "nbVotes", + "offset": 0, + "slot": "11", + "type": "t_uint256" + } + ], + "numberOfBytes": "384" + }, + "t_struct(Vote)5276_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Vote", + "members": [ + { + "astId": 5269, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5271, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "commit", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 5273, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "choice", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 5275, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "voted", + "offset": 0, + "slot": "3", + "type": "t_bool" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Proxy.json new file mode 100644 index 000000000..4533243c1 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeKitClassic_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", + "transactionIndex": 1, + "gasUsed": "177891", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000820000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbb2fff5b1c43c879e9781fdc05359b894dfbcb222a639a0e80db713d5189dfcd", + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823737, + "transactionHash": "0x391279d9b0fe1d54a8345c878c388b309d8aad4056c4fd477f7ff57773edc13d", + "address": "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0xbb2fff5b1c43c879e9781fdc05359b894dfbcb222a639a0e80db713d5189dfcd" + } + ], + "blockNumber": 43823737, + "cumulativeGasUsed": "177891", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9755b94c2c8AB04dDc7d102A6F8c974f538481fb", + "0x485cc955000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a30000000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeResolver.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeResolver.json index 55bcc2e3c..b0aa12e60 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/DisputeResolver.json +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeResolver.json @@ -1,5 +1,5 @@ { - "address": "0x66439ac54509892a5149efeF397DD36446281234", + "address": "0xE4af4D800Ce12149199FA6f8870cD650cD8f3164", "abi": [ { "inputs": [ @@ -292,28 +292,28 @@ "type": "function" } ], - "transactionHash": "0x08ef47c07831ed106c173c5d6ef886f1a33d69a6a7e724c998b288b8403171eb", + "transactionHash": "0x579619725b0898c988113b3fda26c324396363ee7e8459bd309f4af112b278ff", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x66439ac54509892a5149efeF397DD36446281234", + "contractAddress": "0xE4af4D800Ce12149199FA6f8870cD650cD8f3164", "transactionIndex": 1, "gasUsed": "899028", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8f0e851e202a8dec63acc94daa90aaac3bec0c42696c29984a6e7fdaf1e3c944", - "transactionHash": "0x08ef47c07831ed106c173c5d6ef886f1a33d69a6a7e724c998b288b8403171eb", + "blockHash": "0x295d1a7d1d4123c7a4434aeda815c3a328baa0f9c5dc576791c7f53de610dce0", + "transactionHash": "0x579619725b0898c988113b3fda26c324396363ee7e8459bd309f4af112b278ff", "logs": [], - "blockNumber": 43589431, + "blockNumber": 43823932, "cumulativeGasUsed": "899028", "status": 1, "byzantium": true }, "args": [ - "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", - "0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640" + "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A" ], - "numDeployments": 3, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"_templateRegistry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_arbitrableDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateUri\",\"type\":\"string\"}],\"name\":\"DisputeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"arbitratorDisputeIDToLocalID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"name\":\"changeArbitrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"_templateRegistry\",\"type\":\"address\"}],\"name\":\"changeTemplateRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_disputeTemplate\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_disputeTemplateDataMappings\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"}],\"name\":\"createDisputeForTemplate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_disputeTemplateUri\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"}],\"name\":\"createDisputeForTemplateUri\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"isRuled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numberOfRulingOptions\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"templateRegistry\",\"outputs\":[{\"internalType\":\"contract IDisputeTemplateRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"DisputeRequest(address,uint256,uint256,uint256,string)\":{\"details\":\"To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\",\"params\":{\"_arbitrableDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\",\"_arbitrator\":\"The arbitrator of the contract.\",\"_externalDisputeID\":\"An identifier created outside Kleros by the protocol requesting arbitration.\",\"_templateId\":\"The identifier of the dispute template. Should not be used with _templateUri.\",\"_templateUri\":\"The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrator\":\"The arbitrator giving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor.\",\"params\":{\"_governor\":\"The address of the new governor.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"_arbitrator\":\"Target global arbitrator for any disputes.\"}},\"createDisputeForTemplate(bytes,string,string,uint256)\":{\"details\":\"Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_arbitratorExtraData\":\"Extra data for the arbitrator of the dispute.\",\"_disputeTemplate\":\"Dispute template.\",\"_disputeTemplateDataMappings\":\"The data mappings.\",\"_numberOfRulingOptions\":\"Number of ruling options.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the created dispute.\"}},\"createDisputeForTemplateUri(bytes,string,uint256)\":{\"details\":\"Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_arbitratorExtraData\":\"Extra data for the arbitrator of the dispute.\",\"_disputeTemplateUri\":\"The URI to the dispute template. For example on IPFS: starting with '/ipfs/'.\",\"_numberOfRulingOptions\":\"Number of ruling options.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the created dispute.\"}},\"rule(uint256,uint256)\":{\"details\":\"To be called by the arbitrator of the dispute, to declare the winning ruling.\",\"params\":{\"_externalDisputeID\":\"ID of the dispute in arbitrator contract.\",\"_ruling\":\"The ruling choice of the arbitration.\"}}},\"title\":\"DisputeResolver DisputeResolver contract adapted for V2 from https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/arbitrables/DisputeResolver.sol\":\"DisputeResolver\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/arbitrables/DisputeResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@ferittuncer, @unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"../interfaces/IArbitrableV2.sol\\\";\\nimport \\\"../interfaces/IDisputeTemplateRegistry.sol\\\";\\n\\npragma solidity 0.8.18;\\n\\n/// @title DisputeResolver\\n/// DisputeResolver contract adapted for V2 from https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\\ncontract DisputeResolver is IArbitrableV2 {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeStruct {\\n bytes arbitratorExtraData; // Extra data for the dispute.\\n bool isRuled; // True if the dispute has been ruled.\\n uint256 ruling; // Ruling given to the dispute.\\n uint256 numberOfRulingOptions; // The number of choices the arbitrator can give.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The governor.\\n IArbitratorV2 public arbitrator; // The arbitrator.\\n IDisputeTemplateRegistry public templateRegistry; // The dispute template registry.\\n DisputeStruct[] public disputes; // Local disputes.\\n mapping(uint256 => uint256) public arbitratorDisputeIDToLocalID; // Maps arbitrator-side dispute IDs to local dispute IDs.\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor\\n /// @param _arbitrator Target global arbitrator for any disputes.\\n constructor(IArbitratorV2 _arbitrator, IDisputeTemplateRegistry _templateRegistry) {\\n governor = msg.sender;\\n arbitrator = _arbitrator;\\n templateRegistry = _templateRegistry;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Changes the governor.\\n /// @param _governor The address of the new governor.\\n function changeGovernor(address _governor) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n governor = _governor;\\n }\\n\\n function changeArbitrator(IArbitratorV2 _arbitrator) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n arbitrator = _arbitrator;\\n }\\n\\n function changeTemplateRegistry(IDisputeTemplateRegistry _templateRegistry) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n templateRegistry = _templateRegistry;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Calls createDispute function of the specified arbitrator to create a dispute.\\n /// Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n /// @param _arbitratorExtraData Extra data for the arbitrator of the dispute.\\n /// @param _disputeTemplate Dispute template.\\n /// @param _disputeTemplateDataMappings The data mappings.\\n /// @param _numberOfRulingOptions Number of ruling options.\\n /// @return disputeID Dispute id (on arbitrator side) of the created dispute.\\n function createDisputeForTemplate(\\n bytes calldata _arbitratorExtraData,\\n string calldata _disputeTemplate,\\n string memory _disputeTemplateDataMappings,\\n uint256 _numberOfRulingOptions\\n ) external payable returns (uint256 disputeID) {\\n return\\n _createDispute(\\n _arbitratorExtraData,\\n _disputeTemplate,\\n _disputeTemplateDataMappings,\\n \\\"\\\",\\n _numberOfRulingOptions\\n );\\n }\\n\\n /// @dev Calls createDispute function of the specified arbitrator to create a dispute.\\n /// Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n /// @param _arbitratorExtraData Extra data for the arbitrator of the dispute.\\n /// @param _disputeTemplateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'.\\n /// @param _numberOfRulingOptions Number of ruling options.\\n /// @return disputeID Dispute id (on arbitrator side) of the created dispute.\\n function createDisputeForTemplateUri(\\n bytes calldata _arbitratorExtraData,\\n string calldata _disputeTemplateUri,\\n uint256 _numberOfRulingOptions\\n ) external payable returns (uint256 disputeID) {\\n return _createDispute(_arbitratorExtraData, \\\"\\\", \\\"\\\", _disputeTemplateUri, _numberOfRulingOptions);\\n }\\n\\n /// @dev To be called by the arbitrator of the dispute, to declare the winning ruling.\\n /// @param _externalDisputeID ID of the dispute in arbitrator contract.\\n /// @param _ruling The ruling choice of the arbitration.\\n function rule(uint256 _externalDisputeID, uint256 _ruling) external override {\\n uint256 localDisputeID = arbitratorDisputeIDToLocalID[_externalDisputeID];\\n DisputeStruct storage dispute = disputes[localDisputeID];\\n require(msg.sender == address(arbitrator), \\\"Only the arbitrator can execute this.\\\");\\n require(_ruling <= dispute.numberOfRulingOptions, \\\"Invalid ruling.\\\");\\n require(!dispute.isRuled, \\\"This dispute has been ruled already.\\\");\\n\\n dispute.isRuled = true;\\n dispute.ruling = _ruling;\\n\\n emit Ruling(IArbitratorV2(msg.sender), _externalDisputeID, dispute.ruling);\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function _createDispute(\\n bytes calldata _arbitratorExtraData,\\n string memory _disputeTemplate,\\n string memory _disputeTemplateDataMappings,\\n string memory _disputeTemplateUri,\\n uint256 _numberOfRulingOptions\\n ) internal returns (uint256 disputeID) {\\n require(_numberOfRulingOptions > 1, \\\"Should be at least 2 ruling options.\\\");\\n\\n disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n uint256 localDisputeID = disputes.length;\\n disputes.push(\\n DisputeStruct({\\n arbitratorExtraData: _arbitratorExtraData,\\n isRuled: false,\\n ruling: 0,\\n numberOfRulingOptions: _numberOfRulingOptions\\n })\\n );\\n arbitratorDisputeIDToLocalID[disputeID] = localDisputeID;\\n uint256 templateId = templateRegistry.setDisputeTemplate(\\\"\\\", _disputeTemplate, _disputeTemplateDataMappings);\\n emit DisputeRequest(arbitrator, disputeID, localDisputeID, templateId, _disputeTemplateUri);\\n }\\n}\\n\",\"keccak256\":\"0x6a73611696ae6b6f128c1c3d6f355f691f93b374243f41e6a9b0795bbfb8fb13\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeTemplate\\n/// @notice Dispute Template interface.\\ninterface IDisputeTemplateRegistry {\\n /// @dev To be emitted when a new dispute template is created.\\n /// @param _templateId The identifier of the dispute template.\\n /// @param _templateTag An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\\n /// @param _templateData The template data.\\n /// @param _templateDataMappings The data mappings.\\n event DisputeTemplate(\\n uint256 indexed _templateId,\\n string indexed _templateTag,\\n string _templateData,\\n string _templateDataMappings\\n );\\n\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId);\\n}\\n\",\"keccak256\":\"0x4b1b3f98d13e4a9a1c546dd45f98490f86e871cfc4b4be9a3fe4d29b3c99649c\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50604051610ed5380380610ed583398101604081905261002f91610083565b600080546001600160a01b03199081163317909155600180546001600160a01b03948516908316179055600280549290931691161790556100bd565b6001600160a01b038116811461008057600080fd5b50565b6000806040838503121561009657600080fd5b82516100a18161006b565b60208401519092506100b28161006b565b809150509250929050565b610e09806100cc6000396000f3fe60806040526004361061009c5760003560e01c8063908bb29511610064578063908bb29514610170578063a0af81f014610191578063dc653511146101b1578063e09997d9146101c4578063e4c0aaf4146101f1578063fc548f081461021157600080fd5b80630c340a24146100a1578063311a6c56146100de5780634660ebbe14610100578063564a565d146101205780636cc6cde114610150575b600080fd5b3480156100ad57600080fd5b506000546100c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ea57600080fd5b506100fe6100f93660046108bb565b610231565b005b34801561010c57600080fd5b506100fe61011b3660046108f5565b6103d1565b34801561012c57600080fd5b5061014061013b366004610919565b61041d565b6040516100d59493929190610978565b34801561015c57600080fd5b506001546100c1906001600160a01b031681565b61018361017e3660046109f0565b6104eb565b6040519081526020016100d5565b34801561019d57600080fd5b506002546100c1906001600160a01b031681565b6101836101bf366004610a7a565b61055a565b3480156101d057600080fd5b506101836101df366004610919565b60046020526000908152604090205481565b3480156101fd57600080fd5b506100fe61020c3660046108f5565b6105b9565b34801561021d57600080fd5b506100fe61022c3660046108f5565b610605565b600082815260046020526040812054600380549192918390811061025757610257610b88565b6000918252602090912060015460049092020191506001600160a01b031633146102d65760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806003015483111561031c5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b60448201526064016102cd565b600181015460ff161561037d5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b60648201526084016102cd565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000546001600160a01b031633146103fb5760405162461bcd60e51b81526004016102cd90610b9e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003818154811061042d57600080fd5b906000526020600020906004020160009150905080600001805461045090610be0565b80601f016020809104026020016040519081016040528092919081815260200182805461047c90610be0565b80156104c95780601f1061049e576101008083540402835291602001916104c9565b820191906000526020600020905b8154815290600101906020018083116104ac57829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b60006105508686604051806020016040528060008152506040518060200160405280600081525088888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250610651915050565b9695505050505050565b60006105ae878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525060408051602081019091529081528a93509150889050610651565b979650505050505050565b6000546001600160a01b031633146105e35760405162461bcd60e51b81526004016102cd90610b9e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461062f5760405162461bcd60e51b81526004016102cd90610b9e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600182116106af5760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b60648201526084016102cd565b60015460405163c13517e160e01b81526001600160a01b039091169063c13517e19034906106e59086908c908c90600401610c1a565b60206040518083038185885af1158015610703573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107289190610c50565b600380546040805160a06020601f8d018190040282018101909252608081018b8152949550919382918c908c90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381522081519192600402019081906107a59082610cb8565b5060208281015160018301805460ff19169115159190911790556040808401516002808501919091556060909401516003909301929092556000858152600491829052828120859055925491516312a6505d60e21b81526001600160a01b0390921691634a9941749161081c918b918b9101610d78565b6020604051808303816000875af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085f9190610c50565b60015460405191925084916001600160a01b03909116907f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e27186906108a790869086908b90610db4565b60405180910390a350509695505050505050565b600080604083850312156108ce57600080fd5b50508035926020909101359150565b6001600160a01b03811681146108f257600080fd5b50565b60006020828403121561090757600080fd5b8135610912816108dd565b9392505050565b60006020828403121561092b57600080fd5b5035919050565b6000815180845260005b818110156109585760208185018101518683018201520161093c565b506000602082860101526020601f19601f83011685010191505092915050565b60808152600061098b6080830187610932565b9415156020830152506040810192909252606090910152919050565b60008083601f8401126109b957600080fd5b50813567ffffffffffffffff8111156109d157600080fd5b6020830191508360208285010111156109e957600080fd5b9250929050565b600080600080600060608688031215610a0857600080fd5b853567ffffffffffffffff80821115610a2057600080fd5b610a2c89838a016109a7565b90975095506020880135915080821115610a4557600080fd5b50610a52888289016109a7565b96999598509660400135949350505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060808789031215610a9357600080fd5b863567ffffffffffffffff80821115610aab57600080fd5b610ab78a838b016109a7565b90985096506020890135915080821115610ad057600080fd5b610adc8a838b016109a7565b90965094506040890135915080821115610af557600080fd5b818901915089601f830112610b0957600080fd5b813581811115610b1b57610b1b610a64565b604051601f8201601f19908116603f01168101908382118183101715610b4357610b43610a64565b816040528281528c6020848701011115610b5c57600080fd5b826020860160208301376000602084830101528096505050505050606087013590509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600181811c90821680610bf457607f821691505b602082108103610c1457634e487b7160e01b600052602260045260246000fd5b50919050565b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060208284031215610c6257600080fd5b5051919050565b601f821115610cb357600081815260208120601f850160051c81016020861015610c905750805b601f850160051c820191505b81811015610caf57828155600101610c9c565b5050505b505050565b815167ffffffffffffffff811115610cd257610cd2610a64565b610ce681610ce08454610be0565b84610c69565b602080601f831160018114610d1b5760008415610d035750858301515b600019600386901b1c1916600185901b178555610caf565b600085815260208120601f198616915b82811015610d4a57888601518255948401946001909101908401610d2b565b5085821015610d685787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6060815260006060820152608060208201526000610d996080830185610932565b8281036040840152610dab8185610932565b95945050505050565b838152826020820152606060408201526000610dab606083018461093256fea2646970667358221220c324d7140e9a3d1af3d79e61c385889111fcf915450df6674ffa003e40949e0964736f6c63430008120033", "deployedBytecode": "0x60806040526004361061009c5760003560e01c8063908bb29511610064578063908bb29514610170578063a0af81f014610191578063dc653511146101b1578063e09997d9146101c4578063e4c0aaf4146101f1578063fc548f081461021157600080fd5b80630c340a24146100a1578063311a6c56146100de5780634660ebbe14610100578063564a565d146101205780636cc6cde114610150575b600080fd5b3480156100ad57600080fd5b506000546100c1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ea57600080fd5b506100fe6100f93660046108bb565b610231565b005b34801561010c57600080fd5b506100fe61011b3660046108f5565b6103d1565b34801561012c57600080fd5b5061014061013b366004610919565b61041d565b6040516100d59493929190610978565b34801561015c57600080fd5b506001546100c1906001600160a01b031681565b61018361017e3660046109f0565b6104eb565b6040519081526020016100d5565b34801561019d57600080fd5b506002546100c1906001600160a01b031681565b6101836101bf366004610a7a565b61055a565b3480156101d057600080fd5b506101836101df366004610919565b60046020526000908152604090205481565b3480156101fd57600080fd5b506100fe61020c3660046108f5565b6105b9565b34801561021d57600080fd5b506100fe61022c3660046108f5565b610605565b600082815260046020526040812054600380549192918390811061025757610257610b88565b6000918252602090912060015460049092020191506001600160a01b031633146102d65760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806003015483111561031c5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b60448201526064016102cd565b600181015460ff161561037d5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b60648201526084016102cd565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000546001600160a01b031633146103fb5760405162461bcd60e51b81526004016102cd90610b9e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003818154811061042d57600080fd5b906000526020600020906004020160009150905080600001805461045090610be0565b80601f016020809104026020016040519081016040528092919081815260200182805461047c90610be0565b80156104c95780601f1061049e576101008083540402835291602001916104c9565b820191906000526020600020905b8154815290600101906020018083116104ac57829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b60006105508686604051806020016040528060008152506040518060200160405280600081525088888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250610651915050565b9695505050505050565b60006105ae878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525060408051602081019091529081528a93509150889050610651565b979650505050505050565b6000546001600160a01b031633146105e35760405162461bcd60e51b81526004016102cd90610b9e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461062f5760405162461bcd60e51b81526004016102cd90610b9e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600182116106af5760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b60648201526084016102cd565b60015460405163c13517e160e01b81526001600160a01b039091169063c13517e19034906106e59086908c908c90600401610c1a565b60206040518083038185885af1158015610703573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107289190610c50565b600380546040805160a06020601f8d018190040282018101909252608081018b8152949550919382918c908c90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381522081519192600402019081906107a59082610cb8565b5060208281015160018301805460ff19169115159190911790556040808401516002808501919091556060909401516003909301929092556000858152600491829052828120859055925491516312a6505d60e21b81526001600160a01b0390921691634a9941749161081c918b918b9101610d78565b6020604051808303816000875af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085f9190610c50565b60015460405191925084916001600160a01b03909116907f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e27186906108a790869086908b90610db4565b60405180910390a350509695505050505050565b600080604083850312156108ce57600080fd5b50508035926020909101359150565b6001600160a01b03811681146108f257600080fd5b50565b60006020828403121561090757600080fd5b8135610912816108dd565b9392505050565b60006020828403121561092b57600080fd5b5035919050565b6000815180845260005b818110156109585760208185018101518683018201520161093c565b506000602082860101526020601f19601f83011685010191505092915050565b60808152600061098b6080830187610932565b9415156020830152506040810192909252606090910152919050565b60008083601f8401126109b957600080fd5b50813567ffffffffffffffff8111156109d157600080fd5b6020830191508360208285010111156109e957600080fd5b9250929050565b600080600080600060608688031215610a0857600080fd5b853567ffffffffffffffff80821115610a2057600080fd5b610a2c89838a016109a7565b90975095506020880135915080821115610a4557600080fd5b50610a52888289016109a7565b96999598509660400135949350505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060808789031215610a9357600080fd5b863567ffffffffffffffff80821115610aab57600080fd5b610ab78a838b016109a7565b90985096506020890135915080821115610ad057600080fd5b610adc8a838b016109a7565b90965094506040890135915080821115610af557600080fd5b818901915089601f830112610b0957600080fd5b813581811115610b1b57610b1b610a64565b604051601f8201601f19908116603f01168101908382118183101715610b4357610b43610a64565b816040528281528c6020848701011115610b5c57600080fd5b826020860160208301376000602084830101528096505050505050606087013590509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600181811c90821680610bf457607f821691505b602082108103610c1457634e487b7160e01b600052602260045260246000fd5b50919050565b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060208284031215610c6257600080fd5b5051919050565b601f821115610cb357600081815260208120601f850160051c81016020861015610c905750805b601f850160051c820191505b81811015610caf57828155600101610c9c565b5050505b505050565b815167ffffffffffffffff811115610cd257610cd2610a64565b610ce681610ce08454610be0565b84610c69565b602080601f831160018114610d1b5760008415610d035750858301515b600019600386901b1c1916600185901b178555610caf565b600085815260208120601f198616915b82811015610d4a57888601518255948401946001909101908401610d2b565b5085821015610d685787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6060815260006060820152608060208201526000610d996080830185610932565b8281036040840152610dab8185610932565b95945050505050565b838152826020820152606060408201526000610dab606083018461093256fea2646970667358221220c324d7140e9a3d1af3d79e61c385889111fcf915450df6674ffa003e40949e0964736f6c63430008120033", @@ -394,7 +394,7 @@ "storageLayout": { "storage": [ { - "astId": 9813, + "astId": 9953, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "governor", "offset": 0, @@ -402,31 +402,31 @@ "type": "t_address" }, { - "astId": 9816, + "astId": 9956, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "arbitrator", "offset": 0, "slot": "1", - "type": "t_contract(IArbitratorV2)15393" + "type": "t_contract(IArbitratorV2)15618" }, { - "astId": 9819, + "astId": 9959, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "templateRegistry", "offset": 0, "slot": "2", - "type": "t_contract(IDisputeTemplateRegistry)15561" + "type": "t_contract(IDisputeTemplateRegistry)15786" }, { - "astId": 9823, + "astId": 9963, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "disputes", "offset": 0, "slot": "3", - "type": "t_array(t_struct(DisputeStruct)9811_storage)dyn_storage" + "type": "t_array(t_struct(DisputeStruct)9951_storage)dyn_storage" }, { - "astId": 9827, + "astId": 9967, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "arbitratorDisputeIDToLocalID", "offset": 0, @@ -440,8 +440,8 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(DisputeStruct)9811_storage)dyn_storage": { - "base": "t_struct(DisputeStruct)9811_storage", + "t_array(t_struct(DisputeStruct)9951_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)9951_storage", "encoding": "dynamic_array", "label": "struct DisputeResolver.DisputeStruct[]", "numberOfBytes": "32" @@ -456,12 +456,12 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(IArbitratorV2)15393": { + "t_contract(IArbitratorV2)15618": { "encoding": "inplace", "label": "contract IArbitratorV2", "numberOfBytes": "20" }, - "t_contract(IDisputeTemplateRegistry)15561": { + "t_contract(IDisputeTemplateRegistry)15786": { "encoding": "inplace", "label": "contract IDisputeTemplateRegistry", "numberOfBytes": "20" @@ -473,12 +473,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(DisputeStruct)9811_storage": { + "t_struct(DisputeStruct)9951_storage": { "encoding": "inplace", "label": "struct DisputeResolver.DisputeStruct", "members": [ { - "astId": 9804, + "astId": 9944, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "arbitratorExtraData", "offset": 0, @@ -486,7 +486,7 @@ "type": "t_bytes_storage" }, { - "astId": 9806, + "astId": 9946, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "isRuled", "offset": 0, @@ -494,7 +494,7 @@ "type": "t_bool" }, { - "astId": 9808, + "astId": 9948, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "ruling", "offset": 0, @@ -502,7 +502,7 @@ "type": "t_uint256" }, { - "astId": 9810, + "astId": 9950, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "numberOfRulingOptions", "offset": 0, diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry.json index e48167a39..4ae00070e 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry.json +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry.json @@ -1,6 +1,56 @@ { - "address": "0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640", + "address": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -32,6 +82,84 @@ "name": "DisputeTemplate", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -73,46 +201,102 @@ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0xe130d9a9cb46a6ae957c30c5ad289a7f596057a48a7da14d01229de8f4fb50c1", + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xB01eC32bB0ba461ebEA9A61A6172Aba0DDE2B640", + "contractAddress": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", "transactionIndex": 1, - "gasUsed": "785719", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6b94e5db6dc511e5919a3b8ab4f4424a8c64e71bc232eb01d1698fa90148964c", - "transactionHash": "0xe130d9a9cb46a6ae957c30c5ad289a7f596057a48a7da14d01229de8f4fb50c1", - "logs": [], - "blockNumber": 33428169, - "cumulativeGasUsed": "785719", + "gasUsed": "175199", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000200000000000000000000000000000", + "blockHash": "0x3991e25ffaddcd4c0e9e1cc793c499fb549447f51b68bec13d30e7531585c131", + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823905, + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", + "address": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x3991e25ffaddcd4c0e9e1cc793c499fb549447f51b68bec13d30e7531585c131" + } + ], + "blockNumber": 43823905, + "cumulativeGasUsed": "175199", "status": 1, "byzantium": true }, - "args": [], + "args": [ + "0x93bf43132b6805E215d3c8305232ec3A174Ef146", + "0xc4d66de8000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], "numDeployments": 1, - "solcInputHash": "356abb1cf2a2e12b481e44f0376af297", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"_templateTag\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"}],\"name\":\"DisputeTemplate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_templateTag\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"}],\"name\":\"setDisputeTemplate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"templateId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"templates\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A contract to maintain a registry of dispute templates.\",\"events\":{\"DisputeTemplate(uint256,string,string,string)\":{\"details\":\"To be emitted when a new dispute template is created.\",\"params\":{\"_templateData\":\"The template data.\",\"_templateDataMappings\":\"The data mappings.\",\"_templateId\":\"The identifier of the dispute template.\",\"_templateTag\":\"An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\"}}},\"kind\":\"dev\",\"methods\":{},\"title\":\"Dispute Template Registry\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/DisputeTemplateRegistry.sol\":\"DisputeTemplateRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/DisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport \\\"./interfaces/IDisputeTemplateRegistry.sol\\\";\\n\\n/// @title Dispute Template Registry\\n/// @dev A contract to maintain a registry of dispute templates.\\ncontract DisputeTemplateRegistry is IDisputeTemplateRegistry {\\n uint256 public templates;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId) {\\n templateId = templates++;\\n emit DisputeTemplate(templateId, _templateTag, _templateData, _templateDataMappings);\\n }\\n}\\n\",\"keccak256\":\"0xbc2d8ff9784d93f932199993fd58aab88fbc367268a10ffb7fe07a85826960c1\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeTemplate\\n/// @notice Dispute Template interface.\\ninterface IDisputeTemplateRegistry {\\n /// @dev To be emitted when a new dispute template is created.\\n /// @param _templateId The identifier of the dispute template.\\n /// @param _templateTag An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\\n /// @param _templateData The template data.\\n /// @param _templateDataMappings The data mappings.\\n event DisputeTemplate(\\n uint256 indexed _templateId,\\n string indexed _templateTag,\\n string _templateData,\\n string _templateDataMappings\\n );\\n\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId);\\n}\\n\",\"keccak256\":\"0x4b1b3f98d13e4a9a1c546dd45f98490f86e871cfc4b4be9a3fe4d29b3c99649c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506102f1806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633a283d7d1461003b5780634a99417414610056575b600080fd5b61004460005481565b60405190815260200160405180910390f35b610044610064366004610172565b600080548180610073836101fa565b919050559050836040516100879190610245565b6040518091039020817ef7cd7255d1073b4e136dd477c38ea0020c051ab17110cc5bfab0c840ff992485856040516100c092919061028d565b60405180910390a39392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126100f657600080fd5b813567ffffffffffffffff80821115610111576101116100cf565b604051601f8301601f19908116603f01168101908282118183101715610139576101396100cf565b8160405283815286602085880101111561015257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561018757600080fd5b833567ffffffffffffffff8082111561019f57600080fd5b6101ab878388016100e5565b945060208601359150808211156101c157600080fd5b6101cd878388016100e5565b935060408601359150808211156101e357600080fd5b506101f0868287016100e5565b9150509250925092565b60006001820161021a57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b8381101561023c578181015183820152602001610224565b50506000910152565b60008251610257818460208701610221565b9190910192915050565b60008151808452610279816020860160208601610221565b601f01601f19169290920160200192915050565b6040815260006102a06040830185610261565b82810360208401526102b28185610261565b9594505050505056fea26469706673582212208e28c2a1ac6bf992487f46d3bb5b26e186ac986099d0d98440c6107f111f92ab64736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633a283d7d1461003b5780634a99417414610056575b600080fd5b61004460005481565b60405190815260200160405180910390f35b610044610064366004610172565b600080548180610073836101fa565b919050559050836040516100879190610245565b6040518091039020817ef7cd7255d1073b4e136dd477c38ea0020c051ab17110cc5bfab0c840ff992485856040516100c092919061028d565b60405180910390a39392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126100f657600080fd5b813567ffffffffffffffff80821115610111576101116100cf565b604051601f8301601f19908116603f01168101908282118183101715610139576101396100cf565b8160405283815286602085880101111561015257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561018757600080fd5b833567ffffffffffffffff8082111561019f57600080fd5b6101ab878388016100e5565b945060208601359150808211156101c157600080fd5b6101cd878388016100e5565b935060408601359150808211156101e357600080fd5b506101f0868287016100e5565b9150509250925092565b60006001820161021a57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b8381101561023c578181015183820152602001610224565b50506000910152565b60008251610257818460208701610221565b9190910192915050565b60008151808452610279816020860160208601610221565b601f01601f19169290920160200192915050565b6040815260006102a06040830185610261565b82810360208401526102b28185610261565b9594505050505056fea26469706673582212208e28c2a1ac6bf992487f46d3bb5b26e186ac986099d0d98440c6107f111f92ab64736f6c63430008120033", + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + ] + }, + "implementation": "0x93bf43132b6805E215d3c8305232ec3A174Ef146", "devdoc": { - "details": "A contract to maintain a registry of dispute templates.", - "events": { - "DisputeTemplate(uint256,string,string,string)": { - "details": "To be emitted when a new dispute template is created.", - "params": { - "_templateData": "The template data.", - "_templateDataMappings": "The data mappings.", - "_templateId": "The identifier of the dispute template.", - "_templateTag": "An optional tag for the dispute template, such as \"registration\" or \"removal\"." - } + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." } }, - "kind": "dev", - "methods": {}, - "title": "Dispute Template Registry", + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -121,22 +305,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 85, - "contract": "src/arbitration/DisputeTemplateRegistry.sol:DisputeTemplateRegistry", - "label": "templates", - "offset": 0, - "slot": "0", - "type": "t_uint256" - } - ], - "types": { - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Implementation.json new file mode 100644 index 000000000..d52246284 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Implementation.json @@ -0,0 +1,392 @@ +{ + "address": "0x93bf43132b6805E215d3c8305232ec3A174Ef146", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_templateId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "string", + "name": "_templateTag", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "_templateData", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "_templateDataMappings", + "type": "string" + } + ], + "name": "DisputeTemplate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_templateTag", + "type": "string" + }, + { + "internalType": "string", + "name": "_templateData", + "type": "string" + }, + { + "internalType": "string", + "name": "_templateDataMappings", + "type": "string" + } + ], + "name": "setDisputeTemplate", + "outputs": [ + { + "internalType": "uint256", + "name": "templateId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "templates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x6a098d6629c939d8011344600869f1ad7c285433f5ebf3aa3450dbe8368070bf", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x93bf43132b6805E215d3c8305232ec3A174Ef146", + "transactionIndex": 2, + "gasUsed": "567398", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xabcd97243a8b90750e14f987ce4e4cb08e9ac1f96d5a41224bb7b2c99e2552f0", + "transactionHash": "0x6a098d6629c939d8011344600869f1ad7c285433f5ebf3aa3450dbe8368070bf", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 43823886, + "transactionHash": "0x6a098d6629c939d8011344600869f1ad7c285433f5ebf3aa3450dbe8368070bf", + "address": "0x93bf43132b6805E215d3c8305232ec3A174Ef146", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 20, + "blockHash": "0xabcd97243a8b90750e14f987ce4e4cb08e9ac1f96d5a41224bb7b2c99e2552f0" + } + ], + "blockNumber": 43823886, + "cumulativeGasUsed": "1874870", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"_templateTag\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"}],\"name\":\"DisputeTemplate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_templateTag\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateData\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_templateDataMappings\",\"type\":\"string\"}],\"name\":\"setDisputeTemplate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"templateId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"templates\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A contract to maintain a registry of dispute templates.\",\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"DisputeTemplate(uint256,string,string,string)\":{\"details\":\"To be emitted when a new dispute template is created.\",\"params\":{\"_templateData\":\"The template data.\",\"_templateDataMappings\":\"The data mappings.\",\"_templateId\":\"The identifier of the dispute template.\",\"_templateTag\":\"An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\"}},\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor of the contract.\",\"params\":{\"_governor\":\"The new governor.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"initialize(address)\":{\"details\":\"Initializer\",\"params\":{\"_governor\":\"Governor of the contract.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"setDisputeTemplate(string,string,string)\":{\"details\":\"Registers a new dispute template.\",\"params\":{\"_templateData\":\"The data of the template.\",\"_templateDataMappings\":\"The data mappings of the template.\",\"_templateTag\":\"The tag of the template (optional).\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}}},\"title\":\"Dispute Template Registry\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/DisputeTemplateRegistry.sol\":\"DisputeTemplateRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/DisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\nimport \\\"./interfaces/IDisputeTemplateRegistry.sol\\\";\\n\\n/// @title Dispute Template Registry\\n/// @dev A contract to maintain a registry of dispute templates.\\ncontract DisputeTemplateRegistry is IDisputeTemplateRegistry, UUPSProxiable, Initializable {\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The address that can withdraw funds.\\n uint256 public templates; // The number of templates.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer\\n /// @param _governor Governor of the contract.\\n function initialize(address _governor) external reinitializer(1) {\\n governor = _governor;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Changes the governor of the contract.\\n /// @param _governor The new governor.\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Registers a new dispute template.\\n /// @param _templateTag The tag of the template (optional).\\n /// @param _templateData The data of the template.\\n /// @param _templateDataMappings The data mappings of the template.\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId) {\\n templateId = templates++;\\n emit DisputeTemplate(templateId, _templateTag, _templateData, _templateDataMappings);\\n }\\n}\\n\",\"keccak256\":\"0x230526c8cffcfc580fa1c802cd497a944ae92bd97b37d750ca2f811edb32ff93\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeTemplateRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeTemplate\\n/// @notice Dispute Template interface.\\ninterface IDisputeTemplateRegistry {\\n /// @dev To be emitted when a new dispute template is created.\\n /// @param _templateId The identifier of the dispute template.\\n /// @param _templateTag An optional tag for the dispute template, such as \\\"registration\\\" or \\\"removal\\\".\\n /// @param _templateData The template data.\\n /// @param _templateDataMappings The data mappings.\\n event DisputeTemplate(\\n uint256 indexed _templateId,\\n string indexed _templateTag,\\n string _templateData,\\n string _templateDataMappings\\n );\\n\\n function setDisputeTemplate(\\n string memory _templateTag,\\n string memory _templateData,\\n string memory _templateDataMappings\\n ) external returns (uint256 templateId);\\n}\\n\",\"keccak256\":\"0x4b1b3f98d13e4a9a1c546dd45f98490f86e871cfc4b4be9a3fe4d29b3c99649c\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff16156100715760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516108d66100fc600039600081816101d1015281816101fa01526103f701526108d66000f3fe6080604052600436106100605760003560e01c80630c340a24146100655780633a283d7d146100a25780634a994174146100c65780634f1ef286146100e657806352d1902d146100fb578063c4d66de814610110578063e4c0aaf414610130575b600080fd5b34801561007157600080fd5b50600054610085906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ae57600080fd5b506100b860015481565b604051908152602001610099565b3480156100d257600080fd5b506100b86100e136600461065e565b610150565b6100f96100f4366004610702565b6101bd565b005b34801561010757600080fd5b506100b86103ea565b34801561011c57600080fd5b506100f961012b366004610764565b610448565b34801561013c57600080fd5b506100f961014b366004610764565b610532565b60018054600091826101618361077f565b9190505590508360405161017591906107ca565b6040518091039020817ef7cd7255d1073b4e136dd477c38ea0020c051ab17110cc5bfab0c840ff992485856040516101ae929190610812565b60405180910390a39392505050565b6101c68261057e565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061024457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166102386000805160206108818339815191525490565b6001600160a01b031614155b156102625760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156102bc575060408051601f3d908101601f191682019092526102b991810190610840565b60015b6102e957604051630c76093760e01b81526001600160a01b03831660048201526024015b60405180910390fd5b600080516020610881833981519152811461031a57604051632a87526960e21b8152600481018290526024016102e0565b6000805160206108818339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156103e5576000836001600160a01b03168360405161038191906107ca565b600060405180830381855af49150503d80600081146103bc576040519150601f19603f3d011682016040523d82523d6000602084013e6103c1565b606091505b50509050806103e3576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104355760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061088183398151915290565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806104925750805467ffffffffffffffff808416911610155b156104af5760405162dc149f60e41b815260040160405180910390fd5b8054600160401b67ffffffffffffffff841668ffffffffffffffffff199092168217178255600080546001600160a01b0319166001600160a01b038616179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b6000546001600160a01b0316331461055c5760405162461bcd60e51b81526004016102e090610859565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146105a85760405162461bcd60e51b81526004016102e090610859565b50565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156105dc576105dc6105ab565b604051601f8501601f19908116603f01168101908282118183101715610604576106046105ab565b8160405280935085815286868601111561061d57600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261064857600080fd5b610657838335602085016105c1565b9392505050565b60008060006060848603121561067357600080fd5b833567ffffffffffffffff8082111561068b57600080fd5b61069787838801610637565b945060208601359150808211156106ad57600080fd5b6106b987838801610637565b935060408601359150808211156106cf57600080fd5b506106dc86828701610637565b9150509250925092565b80356001600160a01b03811681146106fd57600080fd5b919050565b6000806040838503121561071557600080fd5b61071e836106e6565b9150602083013567ffffffffffffffff81111561073a57600080fd5b8301601f8101851361074b57600080fd5b61075a858235602084016105c1565b9150509250929050565b60006020828403121561077657600080fd5b610657826106e6565b60006001820161079f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b838110156107c15781810151838201526020016107a9565b50506000910152565b600082516107dc8184602087016107a6565b9190910192915050565b600081518084526107fe8160208601602086016107a6565b601f01601f19169290920160200192915050565b60408152600061082560408301856107e6565b828103602084015261083781856107e6565b95945050505050565b60006020828403121561085257600080fd5b5051919050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b60408201526060019056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220cf606ec3a83793ea11588baa936d5fac78ff9fcc4a7a4c4e7ad1ae3a9dd1136e64736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106100605760003560e01c80630c340a24146100655780633a283d7d146100a25780634a994174146100c65780634f1ef286146100e657806352d1902d146100fb578063c4d66de814610110578063e4c0aaf414610130575b600080fd5b34801561007157600080fd5b50600054610085906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ae57600080fd5b506100b860015481565b604051908152602001610099565b3480156100d257600080fd5b506100b86100e136600461065e565b610150565b6100f96100f4366004610702565b6101bd565b005b34801561010757600080fd5b506100b86103ea565b34801561011c57600080fd5b506100f961012b366004610764565b610448565b34801561013c57600080fd5b506100f961014b366004610764565b610532565b60018054600091826101618361077f565b9190505590508360405161017591906107ca565b6040518091039020817ef7cd7255d1073b4e136dd477c38ea0020c051ab17110cc5bfab0c840ff992485856040516101ae929190610812565b60405180910390a39392505050565b6101c68261057e565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061024457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166102386000805160206108818339815191525490565b6001600160a01b031614155b156102625760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156102bc575060408051601f3d908101601f191682019092526102b991810190610840565b60015b6102e957604051630c76093760e01b81526001600160a01b03831660048201526024015b60405180910390fd5b600080516020610881833981519152811461031a57604051632a87526960e21b8152600481018290526024016102e0565b6000805160206108818339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156103e5576000836001600160a01b03168360405161038191906107ca565b600060405180830381855af49150503d80600081146103bc576040519150601f19603f3d011682016040523d82523d6000602084013e6103c1565b606091505b50509050806103e3576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104355760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061088183398151915290565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806104925750805467ffffffffffffffff808416911610155b156104af5760405162dc149f60e41b815260040160405180910390fd5b8054600160401b67ffffffffffffffff841668ffffffffffffffffff199092168217178255600080546001600160a01b0319166001600160a01b038616179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b6000546001600160a01b0316331461055c5760405162461bcd60e51b81526004016102e090610859565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146105a85760405162461bcd60e51b81526004016102e090610859565b50565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156105dc576105dc6105ab565b604051601f8501601f19908116603f01168101908282118183101715610604576106046105ab565b8160405280935085815286868601111561061d57600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261064857600080fd5b610657838335602085016105c1565b9392505050565b60008060006060848603121561067357600080fd5b833567ffffffffffffffff8082111561068b57600080fd5b61069787838801610637565b945060208601359150808211156106ad57600080fd5b6106b987838801610637565b935060408601359150808211156106cf57600080fd5b506106dc86828701610637565b9150509250925092565b80356001600160a01b03811681146106fd57600080fd5b919050565b6000806040838503121561071557600080fd5b61071e836106e6565b9150602083013567ffffffffffffffff81111561073a57600080fd5b8301601f8101851361074b57600080fd5b61075a858235602084016105c1565b9150509250929050565b60006020828403121561077657600080fd5b610657826106e6565b60006001820161079f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b838110156107c15781810151838201526020016107a9565b50506000910152565b600082516107dc8184602087016107a6565b9190910192915050565b600081518084526107fe8160208601602086016107a6565b601f01601f19169290920160200192915050565b60408152600061082560408301856107e6565b828103602084015261083781856107e6565b95945050505050565b60006020828403121561085257600080fd5b5051919050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b60408201526060019056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220cf606ec3a83793ea11588baa936d5fac78ff9fcc4a7a4c4e7ad1ae3a9dd1136e64736f6c63430008120033", + "devdoc": { + "details": "A contract to maintain a registry of dispute templates.", + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "DisputeTemplate(uint256,string,string,string)": { + "details": "To be emitted when a new dispute template is created.", + "params": { + "_templateData": "The template data.", + "_templateDataMappings": "The data mappings.", + "_templateId": "The identifier of the dispute template.", + "_templateTag": "An optional tag for the dispute template, such as \"registration\" or \"removal\"." + } + }, + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "changeGovernor(address)": { + "details": "Changes the governor of the contract.", + "params": { + "_governor": "The new governor." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "initialize(address)": { + "details": "Initializer", + "params": { + "_governor": "Governor of the contract." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "setDisputeTemplate(string,string,string)": { + "details": "Registers a new dispute template.", + "params": { + "_templateData": "The data of the template.", + "_templateDataMappings": "The data mappings of the template.", + "_templateTag": "The tag of the template (optional)." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + } + }, + "title": "Dispute Template Registry", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2848, + "contract": "src/arbitration/DisputeTemplateRegistry.sol:DisputeTemplateRegistry", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2850, + "contract": "src/arbitration/DisputeTemplateRegistry.sol:DisputeTemplateRegistry", + "label": "templates", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Proxy.json new file mode 100644 index 000000000..30ff5ebbe --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/DisputeTemplateRegistry_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", + "transactionIndex": 1, + "gasUsed": "175199", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000200000000000000000000000000000", + "blockHash": "0x3991e25ffaddcd4c0e9e1cc793c499fb549447f51b68bec13d30e7531585c131", + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823905, + "transactionHash": "0x6ff76894946bbfcaec1984ac434c8eb3bd381b78dbc2a06b6f60aa96805750c7", + "address": "0xBf5AF2c2938B3EE689d9A4f5324F144d9a617a2A", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x3991e25ffaddcd4c0e9e1cc793c499fb549447f51b68bec13d30e7531585c131" + } + ], + "blockNumber": 43823905, + "cumulativeGasUsed": "175199", + "status": 1, + "byzantium": true + }, + "args": [ + "0x93bf43132b6805E215d3c8305232ec3A174Ef146", + "0xc4d66de8000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/HomeGatewayToGnosis.json b/contracts/deployments/arbitrumGoerliDevnet/HomeGatewayToGnosis.json deleted file mode 100644 index 75d246375..000000000 --- a/contracts/deployments/arbitrumGoerliDevnet/HomeGatewayToGnosis.json +++ /dev/null @@ -1,845 +0,0 @@ -{ - "address": "0x3DbB7993B8C2D7a1be58b8F2647ba1Cac60B6111", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governor", - "type": "address" - }, - { - "internalType": "contract IArbitratorV2", - "name": "_arbitrator", - "type": "address" - }, - { - "internalType": "contract IVeaInbox", - "name": "_veaInbox", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_foreignChainID", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_foreignGateway", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "_feeToken", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IArbitratorV2", - "name": "_arbitrator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_arbitrableChainId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "_arbitrable", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_arbitrableDisputeID", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_arbitratorDisputeID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_externalDisputeID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_templateId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "_templateUri", - "type": "string" - } - ], - "name": "CrossChainDisputeIncoming", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IArbitratorV2", - "name": "_arbitrator", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_arbitrableDisputeID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_externalDisputeID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_templateId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "_templateUri", - "type": "string" - } - ], - "name": "DisputeRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IArbitratorV2", - "name": "_arbitrator", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_disputeID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ruling", - "type": "uint256" - } - ], - "name": "Ruling", - "type": "event" - }, - { - "inputs": [], - "name": "NATIVE_CURRENCY", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "arbitrator", - "outputs": [ - { - "internalType": "contract IArbitratorV2", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IArbitratorV2", - "name": "_arbitrator", - "type": "address" - } - ], - "name": "changeArbitrator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_feeToken", - "type": "address" - } - ], - "name": "changeFeeToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_foreignGateway", - "type": "address" - } - ], - "name": "changeForeignGateway", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governor", - "type": "address" - } - ], - "name": "changeGovernor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVeaInbox", - "name": "_veaInbox", - "type": "address" - } - ], - "name": "changeVea", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_disputeHash", - "type": "bytes32" - } - ], - "name": "disputeHashToHomeID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "disputeHashtoID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "disputeHashtoRelayedData", - "outputs": [ - { - "internalType": "uint256", - "name": "arbitrationCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "relayer", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "disputeIDtoHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "foreignChainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "foreignGateway", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "receiverGateway", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "foreignBlockHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "foreignChainID", - "type": "uint256" - }, - { - "internalType": "address", - "name": "foreignArbitrable", - "type": "address" - }, - { - "internalType": "uint256", - "name": "foreignDisputeID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "externalDisputeID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "templateId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "templateUri", - "type": "string" - }, - { - "internalType": "uint256", - "name": "choices", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct IHomeGateway.RelayCreateDisputeParams", - "name": "_params", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "_feeAmount", - "type": "uint256" - } - ], - "name": "relayCreateDispute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "foreignBlockHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "foreignChainID", - "type": "uint256" - }, - { - "internalType": "address", - "name": "foreignArbitrable", - "type": "address" - }, - { - "internalType": "uint256", - "name": "foreignDisputeID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "externalDisputeID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "templateId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "templateUri", - "type": "string" - }, - { - "internalType": "uint256", - "name": "choices", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct IHomeGateway.RelayCreateDisputeParams", - "name": "_params", - "type": "tuple" - } - ], - "name": "relayCreateDispute", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_disputeID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_ruling", - "type": "uint256" - } - ], - "name": "rule", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "veaInbox", - "outputs": [ - { - "internalType": "contract IVeaInbox", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x0c8d03f77868d3bc2e0af56e4159ddda02d0769a5d22b8035eec080f5896e3a6", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x3DbB7993B8C2D7a1be58b8F2647ba1Cac60B6111", - "transactionIndex": 1, - "gasUsed": "1314287", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x34b405adafe2c0795ad00750e98e4e918b8dc5f7737d0e8551ae02d2a9086a4b", - "transactionHash": "0x0c8d03f77868d3bc2e0af56e4159ddda02d0769a5d22b8035eec080f5896e3a6", - "logs": [], - "blockNumber": 43589808, - "cumulativeGasUsed": "1314287", - "status": 1, - "byzantium": true - }, - "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", - "0x660daB9A6436A814a6ae3a6f27b309356a4bE78c", - 10200, - "0x83F393F2aE68FA6A6701D7c65CBbFf3225f3fDf9", - "0xB755843e26F2cD1c6A46659cEBb67CcFAE0f2EeE" - ], - "numDeployments": 3, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"contract IVeaInbox\",\"name\":\"_veaInbox\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_foreignChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_foreignGateway\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_arbitrableChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_arbitrableDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_arbitratorDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateUri\",\"type\":\"string\"}],\"name\":\"CrossChainDisputeIncoming\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_arbitrableDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_templateId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_templateUri\",\"type\":\"string\"}],\"name\":\"DisputeRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NATIVE_CURRENCY\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IArbitratorV2\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"name\":\"changeArbitrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"changeFeeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_foreignGateway\",\"type\":\"address\"}],\"name\":\"changeForeignGateway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IVeaInbox\",\"name\":\"_veaInbox\",\"type\":\"address\"}],\"name\":\"changeVea\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"disputeHashToHomeID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoRelayedData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"arbitrationCost\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeIDtoHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foreignChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foreignGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"receiverGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"foreignBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"foreignChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"foreignArbitrable\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"foreignDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"templateId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"templateUri\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct IHomeGateway.RelayCreateDisputeParams\",\"name\":\"_params\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_feeAmount\",\"type\":\"uint256\"}],\"name\":\"relayCreateDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"foreignBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"foreignChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"foreignArbitrable\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"foreignDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"templateId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"templateUri\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct IHomeGateway.RelayCreateDisputeParams\",\"name\":\"_params\",\"type\":\"tuple\"}],\"name\":\"relayCreateDispute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veaInbox\",\"outputs\":[{\"internalType\":\"contract IVeaInbox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"CrossChainDisputeIncoming(address,uint256,address,uint256,uint256,uint256,uint256,string)\":{\"details\":\"To be emitted when a dispute is received from the IForeignGateway.\",\"params\":{\"_arbitrable\":\"The address of the Arbitrable contract.\",\"_arbitrableChainId\":\"The chain identifier where the Arbitrable contract is deployed.\",\"_arbitrableDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\",\"_arbitrator\":\"The arbitrator of the contract.\",\"_arbitratorDisputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_externalDisputeID\":\"An identifier created outside Kleros by the protocol requesting arbitration.\",\"_templateId\":\"The identifier of the dispute template. Should not be used with _templateUri.\",\"_templateUri\":\"IPFS path to the dispute template starting with '/ipfs/'. Should not be used with _templateId.\"}},\"DisputeRequest(address,uint256,uint256,uint256,string)\":{\"details\":\"To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\",\"params\":{\"_arbitrableDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\",\"_arbitrator\":\"The arbitrator of the contract.\",\"_externalDisputeID\":\"An identifier created outside Kleros by the protocol requesting arbitration.\",\"_templateId\":\"The identifier of the dispute template. Should not be used with _templateUri.\",\"_templateUri\":\"The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrator\":\"The arbitrator giving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}}},\"kind\":\"dev\",\"methods\":{\"changeArbitrator(address)\":{\"details\":\"Changes the arbitrator.\",\"params\":{\"_arbitrator\":\"The address of the new arbitrator.\"}},\"changeFeeToken(address)\":{\"details\":\"Changes the fee token.\",\"params\":{\"_feeToken\":\"The address of the new fee token.\"}},\"changeForeignGateway(address)\":{\"details\":\"Changes the foreign gateway.\",\"params\":{\"_foreignGateway\":\"The address of the new foreign gateway.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the governor.\",\"params\":{\"_governor\":\"The address of the new governor.\"}},\"changeVea(address)\":{\"details\":\"Changes the vea inbox, useful to increase the claim deposit.\",\"params\":{\"_veaInbox\":\"The address of the new vea inbox.\"}},\"disputeHashToHomeID(bytes32)\":{\"details\":\"Looks up the local home disputeID for a disputeHash\",\"params\":{\"_disputeHash\":\"dispute hash\"},\"returns\":{\"_0\":\"disputeID dispute identifier on the home chain\"}},\"relayCreateDispute((bytes32,uint256,address,uint256,uint256,uint256,string,uint256,bytes))\":{\"details\":\"Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling. This function accepts the fees payment in the native currency of the home chain, typically ETH.\",\"params\":{\"_params\":\"The parameters of the dispute, see `RelayCreateDisputeParams`.\"}},\"relayCreateDispute((bytes32,uint256,address,uint256,uint256,uint256,string,uint256,bytes),uint256)\":{\"details\":\"Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling. This function accepts the fees payment in the ERC20 `acceptedFeeToken()`.\",\"params\":{\"_params\":\"The parameters of the dispute, see `RelayCreateDisputeParams`.\"}},\"rule(uint256,uint256)\":{\"details\":\"Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\",\"params\":{\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\"}}},\"stateVariables\":{\"foreignChainID\":{\"return\":\"The chain ID where the corresponding foreign gateway is deployed.\",\"returns\":{\"_0\":\"The chain ID where the corresponding foreign gateway is deployed.\"}},\"foreignGateway\":{\"return\":\"The address of the corresponding foreign gateway.\",\"returns\":{\"_0\":\"The address of the corresponding foreign gateway.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"feeToken()\":{\"notice\":\"return The fee token.\"}},\"notice\":\"Home Gateway Counterpart of `ForeignGateway`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/HomeGateway.sol\":\"HomeGateway\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\ninterface IReceiverGateway {\\n function veaOutbox() external view returns (address);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xde6bdbe57ced7c1e79d62dca23aa8c2322e031da91ceac22cefd185f1e3740ef\",\"license\":\"MIT\"},\"@kleros/vea-contracts/src/interfaces/gateways/ISenderGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../inboxes/IVeaInbox.sol\\\";\\n\\ninterface ISenderGateway {\\n function veaInbox() external view returns (IVeaInbox);\\n\\n function receiverGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xc1b2064a853f33222c1321f3d1f0e22bc98c17e2fbff95fdae53ab9071f46b36\",\"license\":\"MIT\"},\"@kleros/vea-contracts/src/interfaces/inboxes/IVeaInbox.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\ninterface IVeaInbox {\\n /// @dev Sends an arbitrary message to receiving chain.\\n /// Note: Calls authenticated by receiving gateway checking the sender argument.\\n /// @param _to The cross-domain contract address which receives the calldata.\\n /// @param _fnSelection The function selector of the receiving contract.\\n /// @param _data The message calldata, abi.encode(...)\\n /// @return msgId The index of the message in the inbox, as a message Id, needed to relay the message.\\n function sendMessage(address _to, bytes4 _fnSelection, bytes memory _data) external returns (uint64 msgId);\\n\\n /// @dev Snapshots can be saved a maximum of once per epoch.\\n /// Saves snapshot of state root.\\n /// `O(log(count))` where count number of messages in the inbox.\\n function saveSnapshot() external;\\n}\\n\",\"keccak256\":\"0x053799bf55019a7f1db4cd889ce83cbe7319e832eec0234b1d4020a2aa0026f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/gateway/HomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\nimport \\\"./interfaces/IHomeGateway.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\n\\n/// Home Gateway\\n/// Counterpart of `ForeignGateway`\\ncontract HomeGateway is IHomeGateway {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct RelayedData {\\n uint256 arbitrationCost;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n IERC20 public constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n address public governor;\\n IArbitratorV2 public arbitrator;\\n IVeaInbox public veaInbox;\\n uint256 public immutable override foreignChainID;\\n address public override foreignGateway;\\n IERC20 public feeToken;\\n mapping(uint256 => bytes32) public disputeIDtoHash;\\n mapping(bytes32 => uint256) public disputeHashtoID;\\n mapping(bytes32 => RelayedData) public disputeHashtoRelayedData;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n constructor(\\n address _governor,\\n IArbitratorV2 _arbitrator,\\n IVeaInbox _veaInbox,\\n uint256 _foreignChainID,\\n address _foreignGateway,\\n IERC20 _feeToken\\n ) {\\n governor = _governor;\\n arbitrator = _arbitrator;\\n veaInbox = _veaInbox;\\n foreignChainID = _foreignChainID;\\n foreignGateway = _foreignGateway;\\n feeToken = _feeToken;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Changes the governor.\\n /// @param _governor The address of the new governor.\\n function changeGovernor(address _governor) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n governor = _governor;\\n }\\n\\n /// @dev Changes the arbitrator.\\n /// @param _arbitrator The address of the new arbitrator.\\n function changeArbitrator(IArbitratorV2 _arbitrator) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n arbitrator = _arbitrator;\\n }\\n\\n /// @dev Changes the vea inbox, useful to increase the claim deposit.\\n /// @param _veaInbox The address of the new vea inbox.\\n function changeVea(IVeaInbox _veaInbox) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n veaInbox = _veaInbox;\\n }\\n\\n /// @dev Changes the foreign gateway.\\n /// @param _foreignGateway The address of the new foreign gateway.\\n function changeForeignGateway(address _foreignGateway) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n foreignGateway = _foreignGateway;\\n }\\n\\n /// @dev Changes the fee token.\\n /// @param _feeToken The address of the new fee token.\\n function changeFeeToken(IERC20 _feeToken) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n feeToken = _feeToken;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @inheritdoc IHomeGateway\\n function relayCreateDispute(RelayCreateDisputeParams memory _params) external payable override {\\n require(feeToken == NATIVE_CURRENCY, \\\"Fees paid in ERC20 only\\\");\\n require(_params.foreignChainID == foreignChainID, \\\"Foreign chain ID not supported\\\");\\n\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n \\\"createDispute\\\",\\n _params.foreignBlockHash,\\n _params.foreignChainID,\\n _params.foreignArbitrable,\\n _params.foreignDisputeID,\\n _params.choices,\\n _params.extraData\\n )\\n );\\n RelayedData storage relayedData = disputeHashtoRelayedData[disputeHash];\\n require(relayedData.relayer == address(0), \\\"Dispute already relayed\\\");\\n\\n uint256 disputeID = arbitrator.createDispute{value: msg.value}(_params.choices, _params.extraData);\\n disputeIDtoHash[disputeID] = disputeHash;\\n disputeHashtoID[disputeHash] = disputeID;\\n relayedData.relayer = msg.sender;\\n\\n emit DisputeRequest(arbitrator, disputeID, _params.externalDisputeID, _params.templateId, _params.templateUri);\\n\\n emit CrossChainDisputeIncoming(\\n arbitrator,\\n _params.foreignChainID,\\n _params.foreignArbitrable,\\n _params.foreignDisputeID,\\n disputeID,\\n _params.externalDisputeID,\\n _params.templateId,\\n _params.templateUri\\n );\\n }\\n\\n /// @inheritdoc IHomeGateway\\n function relayCreateDispute(RelayCreateDisputeParams memory _params, uint256 _feeAmount) external {\\n require(feeToken != NATIVE_CURRENCY, \\\"Fees paid in native currency only\\\");\\n require(_params.foreignChainID == foreignChainID, \\\"Foreign chain ID not supported\\\");\\n\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n \\\"createDispute\\\",\\n _params.foreignBlockHash,\\n _params.foreignChainID,\\n _params.foreignArbitrable,\\n _params.foreignDisputeID,\\n _params.choices,\\n _params.extraData\\n )\\n );\\n RelayedData storage relayedData = disputeHashtoRelayedData[disputeHash];\\n require(relayedData.relayer == address(0), \\\"Dispute already relayed\\\");\\n\\n require(feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount), \\\"Transfer failed\\\");\\n require(feeToken.increaseAllowance(address(arbitrator), _feeAmount), \\\"Allowance increase failed\\\");\\n\\n uint256 disputeID = arbitrator.createDispute(_params.choices, _params.extraData, feeToken, _feeAmount);\\n disputeIDtoHash[disputeID] = disputeHash;\\n disputeHashtoID[disputeHash] = disputeID;\\n relayedData.relayer = msg.sender;\\n\\n // Not strictly necessary for functionality, only to satisfy IArbitrableV2\\n emit DisputeRequest(arbitrator, disputeID, _params.externalDisputeID, _params.templateId, _params.templateUri);\\n\\n emit CrossChainDisputeIncoming(\\n arbitrator,\\n _params.foreignChainID,\\n _params.foreignArbitrable,\\n _params.foreignDisputeID,\\n disputeID,\\n _params.externalDisputeID,\\n _params.templateId,\\n _params.templateUri\\n );\\n }\\n\\n /// @inheritdoc IArbitrableV2\\n function rule(uint256 _disputeID, uint256 _ruling) external override {\\n require(msg.sender == address(arbitrator), \\\"Only Arbitrator\\\");\\n\\n bytes32 disputeHash = disputeIDtoHash[_disputeID];\\n RelayedData memory relayedData = disputeHashtoRelayedData[disputeHash];\\n\\n // The first parameter of relayRule() `_messageSender` is missing from the encoding below\\n // because Vea takes care of inserting it for security reasons.\\n bytes4 methodSelector = IForeignGateway.relayRule.selector;\\n bytes memory data = abi.encode(disputeHash, _ruling, relayedData.relayer);\\n veaInbox.sendMessage(foreignGateway, methodSelector, data);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @inheritdoc IHomeGateway\\n function disputeHashToHomeID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoID[_disputeHash];\\n }\\n\\n /// @inheritdoc ISenderGateway\\n function receiverGateway() external view override returns (address) {\\n return foreignGateway;\\n }\\n}\\n\",\"keccak256\":\"0xf7a2a183fa507ad94ef46597e75002f5400f50cbd047737c3f4fab8cd77ecdf0\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../../arbitration/interfaces/IArbitratorV2.sol\\\";\\nimport \\\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitratorV2, IReceiverGateway {\\n /// @dev To be emitted when a dispute is sent to the IHomeGateway.\\n /// @param _foreignBlockHash foreignBlockHash\\n /// @param _foreignArbitrable The address of the Arbitrable contract.\\n /// @param _foreignDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _choices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Any extra data to attach.\\n event CrossChainDisputeOutgoing(\\n bytes32 _foreignBlockHash,\\n address indexed _foreignArbitrable,\\n uint256 indexed _foreignDisputeID,\\n uint256 _choices,\\n bytes _extraData\\n );\\n\\n /// Relay the rule call from the home gateway to the arbitrable.\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n /// Reimburses the dispute fees to the relayer who paid for these fees on the home chain.\\n /// @param _disputeHash The dispute hash for which to withdraw the fees.\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n /// @dev Looks up the local foreign disputeID for a disputeHash\\n /// @param _disputeHash dispute hash\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n /// @return The chain ID where the corresponding home gateway is deployed.\\n function homeChainID() external view returns (uint256);\\n\\n /// @return The address of the corresponding home gateway.\\n function homeGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf59d1a9cd8b601f82ea3871d48bd9181e012a650e8f075e2c23c04df00ca6fe8\",\"license\":\"MIT\"},\"src/gateway/interfaces/IHomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@kleros/vea-contracts/src/interfaces/gateways/ISenderGateway.sol\\\";\\nimport \\\"../../arbitration/interfaces/IArbitrableV2.sol\\\";\\n\\ninterface IHomeGateway is IArbitrableV2, ISenderGateway {\\n /// @dev To be emitted when a dispute is received from the IForeignGateway.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableChainId The chain identifier where the Arbitrable contract is deployed.\\n /// @param _arbitrable The address of the Arbitrable contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _arbitratorDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri IPFS path to the dispute template starting with '/ipfs/'. Should not be used with _templateId.\\n event CrossChainDisputeIncoming(\\n IArbitratorV2 _arbitrator,\\n uint256 _arbitrableChainId,\\n address indexed _arbitrable,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 indexed _arbitratorDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n // Workaround stack too deep for relayCreateDispute()\\n struct RelayCreateDisputeParams {\\n bytes32 foreignBlockHash;\\n uint256 foreignChainID;\\n address foreignArbitrable;\\n uint256 foreignDisputeID;\\n uint256 externalDisputeID;\\n uint256 templateId;\\n string templateUri;\\n uint256 choices;\\n bytes extraData;\\n }\\n\\n /// @dev Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain.\\n /// Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.\\n /// This function accepts the fees payment in the native currency of the home chain, typically ETH.\\n /// @param _params The parameters of the dispute, see `RelayCreateDisputeParams`.\\n function relayCreateDispute(RelayCreateDisputeParams memory _params) external payable;\\n\\n /// @dev Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain.\\n /// Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.\\n /// This function accepts the fees payment in the ERC20 `acceptedFeeToken()`.\\n /// @param _params The parameters of the dispute, see `RelayCreateDisputeParams`.\\n function relayCreateDispute(RelayCreateDisputeParams memory _params, uint256 _feeAmount) external;\\n\\n /// @dev Looks up the local home disputeID for a disputeHash\\n /// @param _disputeHash dispute hash\\n /// @return disputeID dispute identifier on the home chain\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);\\n\\n /// @return The chain ID where the corresponding foreign gateway is deployed.\\n function foreignChainID() external view returns (uint256);\\n\\n /// @return The address of the corresponding foreign gateway.\\n function foreignGateway() external view returns (address);\\n\\n /// return The fee token.\\n function feeToken() external view returns (IERC20);\\n}\\n\",\"keccak256\":\"0xe68e483368d2d6f6531dad9b884b15821aed87a68c4c5928e44c5d56281023e4\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a06040523480156200001157600080fd5b5060405162001619380380620016198339810160408190526200003491620000b6565b600080546001600160a01b03199081166001600160a01b039889161790915560018054821696881696909617909555600280548616948716949094179093556080919091526003805484169185169190911790556004805490921692169190911790556200013e565b6001600160a01b0381168114620000b357600080fd5b50565b60008060008060008060c08789031215620000d057600080fd5b8651620000dd816200009d565b6020880151909650620000f0816200009d565b604088015190955062000103816200009d565b6060880151608089015191955093506200011d816200009d565b60a088015190925062000130816200009d565b809150509295509295509295565b6080516114b1620001686000396000818161028a015281816106270152610a2f01526114b16000f3fe60806040526004361061011f5760003560e01c806396882403116100a0578063c95c095111610064578063c95c095114610338578063cddbfa1414610365578063e4c0aaf4146103bf578063fc4ba3a2146103df578063fc548f081461040c57600080fd5b806396882403146102785780639e72c153146102ba578063ba4bc763146102da578063c0fab03514610307578063c5ffcf701461031a57600080fd5b806349f42650116100e757806349f42650146101e3578063647846a5146101f85780636cc6cde1146102185780637608c3e8146102385780638d7c7daa1461025857600080fd5b806302d3e236146101245780630c340a24146101615780631a440de614610181578063311a6c56146101a3578063376dcc0d146101c3575b600080fd5b34801561013057600080fd5b50600254610144906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016d57600080fd5b50600054610144906001600160a01b031681565b34801561018d57600080fd5b506101a161019c366004610f15565b61042c565b005b3480156101af57600080fd5b506101a16101be366004610f39565b610481565b3480156101cf57600080fd5b506101a16101de3660046110f7565b6105c3565b3480156101ef57600080fd5b50610144600081565b34801561020457600080fd5b50600454610144906001600160a01b031681565b34801561022457600080fd5b50600154610144906001600160a01b031681565b34801561024457600080fd5b506101a1610253366004610f15565b610942565b34801561026457600080fd5b50600354610144906001600160a01b031681565b34801561028457600080fd5b506102ac7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610158565b3480156102c657600080fd5b506101a16102d5366004610f15565b61098e565b3480156102e657600080fd5b506102ac6102f536600461113c565b60056020526000908152604090205481565b6101a1610315366004611155565b6109da565b34801561032657600080fd5b506003546001600160a01b0316610144565b34801561034457600080fd5b506102ac61035336600461113c565b60066020526000908152604090205481565b34801561037157600080fd5b506103a261038036600461113c565b600760205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b03909116602083015201610158565b3480156103cb57600080fd5b506101a16103da366004610f15565b610c85565b3480156103eb57600080fd5b506102ac6103fa36600461113c565b60009081526006602052604090205490565b34801561041857600080fd5b506101a1610427366004610f15565b610cd1565b6000546001600160a01b0316331461045f5760405162461bcd60e51b815260040161045690611192565b60405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146104cd5760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b6044820152606401610456565b6000828152600560209081526040808320548084526007835281842082518084018452815481526001909101546001600160a01b03168185018190528351948501839052928401869052606084019290925292909163a60a4db560e01b919060800160408051601f19818403018152908290526002546003546317e1625b60e21b84529193506001600160a01b0390811692635f85896c9261057792169086908690600401611224565b6020604051808303816000875af1158015610596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ba9190611261565b50505050505050565b6004546001600160a01b03166106255760405162461bcd60e51b815260206004820152602160248201527f46656573207061696420696e206e61746976652063757272656e6379206f6e6c6044820152607960f81b6064820152608401610456565b7f00000000000000000000000000000000000000000000000000000000000000008260200151146106685760405162461bcd60e51b81526004016104569061128b565b8151602080840151604080860151606087015160e088015161010089015193516000976106999790969591016112c2565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b0316156106ec5760405162461bcd60e51b81526004016104569061132c565b600454610704906001600160a01b0316333086610d1d565b6107425760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610456565b60015460045461075f916001600160a01b03918216911685610df9565b6107a75760405162461bcd60e51b8152602060048201526019602482015278105b1b1bddd85b98d9481a5b98dc99585cd94819985a5b1959603a1b6044820152606401610456565b60015460e085015161010086015160048054604051633d941b6d60e21b81526000956001600160a01b039081169563f6506db4956107ee95919490939216918b910161135d565b6020604051808303816000875af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108319190611392565b6000818152600560209081526040808320879055868352600690915290819020829055600180850180546001600160a01b0319163317905554608088015160a089015160c08a0151935194955085946001600160a01b0393909316937f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e27186936108bb939291906113ab565b60405180910390a380856060015186604001516001600160a01b03167f2ecee3c6efdf9fe2284aca27b27774f7fdd967ff823bb1b329090ff881d8c40c600160009054906101000a90046001600160a01b031689602001518a608001518b60a001518c60c001516040516109339594939291906113ca565b60405180910390a45050505050565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260040161045690611192565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146109b85760405162461bcd60e51b815260040161045690611192565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b031615610a2d5760405162461bcd60e51b815260206004820152601760248201527646656573207061696420696e204552433230206f6e6c7960481b6044820152606401610456565b7f0000000000000000000000000000000000000000000000000000000000000000816020015114610a705760405162461bcd60e51b81526004016104569061128b565b8051602080830151604080850151606086015160e08701516101008801519351600097610aa19790969591016112c2565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b031615610af45760405162461bcd60e51b81526004016104569061132c565b60015460e084015161010085015160405163c13517e160e01b81526000936001600160a01b03169263c13517e1923492610b329291906004016113fd565b60206040518083038185885af1158015610b50573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b759190611392565b6000818152600560209081526040808320879055868352600690915290819020829055600180850180546001600160a01b0319163317905554608087015160a088015160c0890151935194955085946001600160a01b0393909316937f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e2718693610bff939291906113ab565b60405180910390a380846060015185604001516001600160a01b03167f2ecee3c6efdf9fe2284aca27b27774f7fdd967ff823bb1b329090ff881d8c40c600160009054906101000a90046001600160a01b0316886020015189608001518a60a001518b60c00151604051610c779594939291906113ca565b60405180910390a450505050565b6000546001600160a01b03163314610caf5760405162461bcd60e51b815260040161045690611192565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610cfb5760405162461bcd60e51b815260040161045690611192565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610d829190611416565b6000604051808303816000865af19150503d8060008114610dbf576040519150601f19603f3d011682016040523d82523d6000602084013e610dc4565b606091505b5091509150818015610dee575080511580610dee575080806020019051810190610dee9190611432565b979650505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063095ea7b39085908590849063dd62ed3e90604401602060405180830381865afa158015610e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e799190611392565b610e839190611454565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190611432565b506001949350505050565b6001600160a01b0381168114610f1257600080fd5b50565b600060208284031215610f2757600080fd5b8135610f3281610efd565b9392505050565b60008060408385031215610f4c57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715610f9557610f95610f5b565b60405290565b8035610fa681610efd565b919050565b600082601f830112610fbc57600080fd5b813567ffffffffffffffff80821115610fd757610fd7610f5b565b604051601f8301601f19908116603f01168101908282118183101715610fff57610fff610f5b565b8160405283815286602085880101111561101857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000610120828403121561104b57600080fd5b611053610f71565b9050813581526020820135602082015261106f60408301610f9b565b6040820152606082013560608201526080820135608082015260a082013560a082015260c082013567ffffffffffffffff808211156110ad57600080fd5b6110b985838601610fab565b60c084015260e084013560e0840152610100915081840135818111156110de57600080fd5b6110ea86828701610fab565b8385015250505092915050565b6000806040838503121561110a57600080fd5b823567ffffffffffffffff81111561112157600080fd5b61112d85828601611038565b95602094909401359450505050565b60006020828403121561114e57600080fd5b5035919050565b60006020828403121561116757600080fd5b813567ffffffffffffffff81111561117e57600080fd5b61118a84828501611038565b949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60005b838110156111ef5781810151838201526020016111d7565b50506000910152565b600081518084526112108160208601602086016111d4565b601f01601f19169290920160200192915050565b6001600160a01b03841681526001600160e01b031983166020820152606060408201819052600090611258908301846111f8565b95945050505050565b60006020828403121561127357600080fd5b815167ffffffffffffffff81168114610f3257600080fd5b6020808252601e908201527f466f726569676e20636861696e204944206e6f7420737570706f727465640000604082015260600190565b6c6372656174654469737075746560981b815286600d82015285602d8201526bffffffffffffffffffffffff198560601b16604d8201528360618201528260818201526000825161131a8160a18501602087016111d4565b9190910160a101979650505050505050565b602080825260179082015276111a5cdc1d5d1948185b1c9958591e481c995b185e5959604a1b604082015260600190565b84815260806020820152600061137660808301866111f8565b6001600160a01b03949094166040830152506060015292915050565b6000602082840312156113a457600080fd5b5051919050565b83815282602082015260606040820152600061125860608301846111f8565b60018060a01b038616815284602082015283604082015282606082015260a060808201526000610dee60a08301846111f8565b82815260406020820152600061118a60408301846111f8565b600082516114288184602087016111d4565b9190910192915050565b60006020828403121561144457600080fd5b81518015158114610f3257600080fd5b8082018082111561147557634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220336f6829deabf0d3f51e8438b93adc3e04cd04408d79bae4f491864ed298389964736f6c63430008120033", - "deployedBytecode": "0x60806040526004361061011f5760003560e01c806396882403116100a0578063c95c095111610064578063c95c095114610338578063cddbfa1414610365578063e4c0aaf4146103bf578063fc4ba3a2146103df578063fc548f081461040c57600080fd5b806396882403146102785780639e72c153146102ba578063ba4bc763146102da578063c0fab03514610307578063c5ffcf701461031a57600080fd5b806349f42650116100e757806349f42650146101e3578063647846a5146101f85780636cc6cde1146102185780637608c3e8146102385780638d7c7daa1461025857600080fd5b806302d3e236146101245780630c340a24146101615780631a440de614610181578063311a6c56146101a3578063376dcc0d146101c3575b600080fd5b34801561013057600080fd5b50600254610144906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016d57600080fd5b50600054610144906001600160a01b031681565b34801561018d57600080fd5b506101a161019c366004610f15565b61042c565b005b3480156101af57600080fd5b506101a16101be366004610f39565b610481565b3480156101cf57600080fd5b506101a16101de3660046110f7565b6105c3565b3480156101ef57600080fd5b50610144600081565b34801561020457600080fd5b50600454610144906001600160a01b031681565b34801561022457600080fd5b50600154610144906001600160a01b031681565b34801561024457600080fd5b506101a1610253366004610f15565b610942565b34801561026457600080fd5b50600354610144906001600160a01b031681565b34801561028457600080fd5b506102ac7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610158565b3480156102c657600080fd5b506101a16102d5366004610f15565b61098e565b3480156102e657600080fd5b506102ac6102f536600461113c565b60056020526000908152604090205481565b6101a1610315366004611155565b6109da565b34801561032657600080fd5b506003546001600160a01b0316610144565b34801561034457600080fd5b506102ac61035336600461113c565b60066020526000908152604090205481565b34801561037157600080fd5b506103a261038036600461113c565b600760205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b03909116602083015201610158565b3480156103cb57600080fd5b506101a16103da366004610f15565b610c85565b3480156103eb57600080fd5b506102ac6103fa36600461113c565b60009081526006602052604090205490565b34801561041857600080fd5b506101a1610427366004610f15565b610cd1565b6000546001600160a01b0316331461045f5760405162461bcd60e51b815260040161045690611192565b60405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146104cd5760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b6044820152606401610456565b6000828152600560209081526040808320548084526007835281842082518084018452815481526001909101546001600160a01b03168185018190528351948501839052928401869052606084019290925292909163a60a4db560e01b919060800160408051601f19818403018152908290526002546003546317e1625b60e21b84529193506001600160a01b0390811692635f85896c9261057792169086908690600401611224565b6020604051808303816000875af1158015610596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ba9190611261565b50505050505050565b6004546001600160a01b03166106255760405162461bcd60e51b815260206004820152602160248201527f46656573207061696420696e206e61746976652063757272656e6379206f6e6c6044820152607960f81b6064820152608401610456565b7f00000000000000000000000000000000000000000000000000000000000000008260200151146106685760405162461bcd60e51b81526004016104569061128b565b8151602080840151604080860151606087015160e088015161010089015193516000976106999790969591016112c2565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b0316156106ec5760405162461bcd60e51b81526004016104569061132c565b600454610704906001600160a01b0316333086610d1d565b6107425760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610456565b60015460045461075f916001600160a01b03918216911685610df9565b6107a75760405162461bcd60e51b8152602060048201526019602482015278105b1b1bddd85b98d9481a5b98dc99585cd94819985a5b1959603a1b6044820152606401610456565b60015460e085015161010086015160048054604051633d941b6d60e21b81526000956001600160a01b039081169563f6506db4956107ee95919490939216918b910161135d565b6020604051808303816000875af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108319190611392565b6000818152600560209081526040808320879055868352600690915290819020829055600180850180546001600160a01b0319163317905554608088015160a089015160c08a0151935194955085946001600160a01b0393909316937f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e27186936108bb939291906113ab565b60405180910390a380856060015186604001516001600160a01b03167f2ecee3c6efdf9fe2284aca27b27774f7fdd967ff823bb1b329090ff881d8c40c600160009054906101000a90046001600160a01b031689602001518a608001518b60a001518c60c001516040516109339594939291906113ca565b60405180910390a45050505050565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260040161045690611192565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146109b85760405162461bcd60e51b815260040161045690611192565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b031615610a2d5760405162461bcd60e51b815260206004820152601760248201527646656573207061696420696e204552433230206f6e6c7960481b6044820152606401610456565b7f0000000000000000000000000000000000000000000000000000000000000000816020015114610a705760405162461bcd60e51b81526004016104569061128b565b8051602080830151604080850151606086015160e08701516101008801519351600097610aa19790969591016112c2565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b031615610af45760405162461bcd60e51b81526004016104569061132c565b60015460e084015161010085015160405163c13517e160e01b81526000936001600160a01b03169263c13517e1923492610b329291906004016113fd565b60206040518083038185885af1158015610b50573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b759190611392565b6000818152600560209081526040808320879055868352600690915290819020829055600180850180546001600160a01b0319163317905554608087015160a088015160c0890151935194955085946001600160a01b0393909316937f8bd32f430ff060e6bd204709b3790c9807987263d3230c580dc80b5f89e2718693610bff939291906113ab565b60405180910390a380846060015185604001516001600160a01b03167f2ecee3c6efdf9fe2284aca27b27774f7fdd967ff823bb1b329090ff881d8c40c600160009054906101000a90046001600160a01b0316886020015189608001518a60a001518b60c00151604051610c779594939291906113ca565b60405180910390a450505050565b6000546001600160a01b03163314610caf5760405162461bcd60e51b815260040161045690611192565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610cfb5760405162461bcd60e51b815260040161045690611192565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251610d829190611416565b6000604051808303816000865af19150503d8060008114610dbf576040519150601f19603f3d011682016040523d82523d6000602084013e610dc4565b606091505b5091509150818015610dee575080511580610dee575080806020019051810190610dee9190611432565b979650505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063095ea7b39085908590849063dd62ed3e90604401602060405180830381865afa158015610e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e799190611392565b610e839190611454565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190611432565b506001949350505050565b6001600160a01b0381168114610f1257600080fd5b50565b600060208284031215610f2757600080fd5b8135610f3281610efd565b9392505050565b60008060408385031215610f4c57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715610f9557610f95610f5b565b60405290565b8035610fa681610efd565b919050565b600082601f830112610fbc57600080fd5b813567ffffffffffffffff80821115610fd757610fd7610f5b565b604051601f8301601f19908116603f01168101908282118183101715610fff57610fff610f5b565b8160405283815286602085880101111561101857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000610120828403121561104b57600080fd5b611053610f71565b9050813581526020820135602082015261106f60408301610f9b565b6040820152606082013560608201526080820135608082015260a082013560a082015260c082013567ffffffffffffffff808211156110ad57600080fd5b6110b985838601610fab565b60c084015260e084013560e0840152610100915081840135818111156110de57600080fd5b6110ea86828701610fab565b8385015250505092915050565b6000806040838503121561110a57600080fd5b823567ffffffffffffffff81111561112157600080fd5b61112d85828601611038565b95602094909401359450505050565b60006020828403121561114e57600080fd5b5035919050565b60006020828403121561116757600080fd5b813567ffffffffffffffff81111561117e57600080fd5b61118a84828501611038565b949350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60005b838110156111ef5781810151838201526020016111d7565b50506000910152565b600081518084526112108160208601602086016111d4565b601f01601f19169290920160200192915050565b6001600160a01b03841681526001600160e01b031983166020820152606060408201819052600090611258908301846111f8565b95945050505050565b60006020828403121561127357600080fd5b815167ffffffffffffffff81168114610f3257600080fd5b6020808252601e908201527f466f726569676e20636861696e204944206e6f7420737570706f727465640000604082015260600190565b6c6372656174654469737075746560981b815286600d82015285602d8201526bffffffffffffffffffffffff198560601b16604d8201528360618201528260818201526000825161131a8160a18501602087016111d4565b9190910160a101979650505050505050565b602080825260179082015276111a5cdc1d5d1948185b1c9958591e481c995b185e5959604a1b604082015260600190565b84815260806020820152600061137660808301866111f8565b6001600160a01b03949094166040830152506060015292915050565b6000602082840312156113a457600080fd5b5051919050565b83815282602082015260606040820152600061125860608301846111f8565b60018060a01b038616815284602082015283604082015282606082015260a060808201526000610dee60a08301846111f8565b82815260406020820152600061118a60408301846111f8565b600082516114288184602087016111d4565b9190910192915050565b60006020828403121561144457600080fd5b81518015158114610f3257600080fd5b8082018082111561147557634e487b7160e01b600052601160045260246000fd5b9291505056fea2646970667358221220336f6829deabf0d3f51e8438b93adc3e04cd04408d79bae4f491864ed298389964736f6c63430008120033", - "devdoc": { - "events": { - "CrossChainDisputeIncoming(address,uint256,address,uint256,uint256,uint256,uint256,string)": { - "details": "To be emitted when a dispute is received from the IForeignGateway.", - "params": { - "_arbitrable": "The address of the Arbitrable contract.", - "_arbitrableChainId": "The chain identifier where the Arbitrable contract is deployed.", - "_arbitrableDisputeID": "The identifier of the dispute in the Arbitrable contract.", - "_arbitrator": "The arbitrator of the contract.", - "_arbitratorDisputeID": "The identifier of the dispute in the Arbitrator contract.", - "_externalDisputeID": "An identifier created outside Kleros by the protocol requesting arbitration.", - "_templateId": "The identifier of the dispute template. Should not be used with _templateUri.", - "_templateUri": "IPFS path to the dispute template starting with '/ipfs/'. Should not be used with _templateId." - } - }, - "DisputeRequest(address,uint256,uint256,uint256,string)": { - "details": "To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.", - "params": { - "_arbitrableDisputeID": "The identifier of the dispute in the Arbitrable contract.", - "_arbitrator": "The arbitrator of the contract.", - "_externalDisputeID": "An identifier created outside Kleros by the protocol requesting arbitration.", - "_templateId": "The identifier of the dispute template. Should not be used with _templateUri.", - "_templateUri": "The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId." - } - }, - "Ruling(address,uint256,uint256)": { - "details": "To be raised when a ruling is given.", - "params": { - "_arbitrator": "The arbitrator giving the ruling.", - "_disputeID": "The identifier of the dispute in the Arbitrator contract.", - "_ruling": "The ruling which was given." - } - } - }, - "kind": "dev", - "methods": { - "changeArbitrator(address)": { - "details": "Changes the arbitrator.", - "params": { - "_arbitrator": "The address of the new arbitrator." - } - }, - "changeFeeToken(address)": { - "details": "Changes the fee token.", - "params": { - "_feeToken": "The address of the new fee token." - } - }, - "changeForeignGateway(address)": { - "details": "Changes the foreign gateway.", - "params": { - "_foreignGateway": "The address of the new foreign gateway." - } - }, - "changeGovernor(address)": { - "details": "Changes the governor.", - "params": { - "_governor": "The address of the new governor." - } - }, - "changeVea(address)": { - "details": "Changes the vea inbox, useful to increase the claim deposit.", - "params": { - "_veaInbox": "The address of the new vea inbox." - } - }, - "disputeHashToHomeID(bytes32)": { - "details": "Looks up the local home disputeID for a disputeHash", - "params": { - "_disputeHash": "dispute hash" - }, - "returns": { - "_0": "disputeID dispute identifier on the home chain" - } - }, - "relayCreateDispute((bytes32,uint256,address,uint256,uint256,uint256,string,uint256,bytes))": { - "details": "Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling. This function accepts the fees payment in the native currency of the home chain, typically ETH.", - "params": { - "_params": "The parameters of the dispute, see `RelayCreateDisputeParams`." - } - }, - "relayCreateDispute((bytes32,uint256,address,uint256,uint256,uint256,string,uint256,bytes),uint256)": { - "details": "Relays a dispute creation from the ForeignGateway to the home arbitrator using the same parameters as the ones on the foreign chain. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling. This function accepts the fees payment in the ERC20 `acceptedFeeToken()`.", - "params": { - "_params": "The parameters of the dispute, see `RelayCreateDisputeParams`." - } - }, - "rule(uint256,uint256)": { - "details": "Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract.", - "params": { - "_disputeID": "The identifier of the dispute in the Arbitrator contract.", - "_ruling": "Ruling given by the arbitrator. Note that 0 is reserved for \"Not able/wanting to make a decision\"." - } - } - }, - "stateVariables": { - "foreignChainID": { - "return": "The chain ID where the corresponding foreign gateway is deployed.", - "returns": { - "_0": "The chain ID where the corresponding foreign gateway is deployed." - } - }, - "foreignGateway": { - "return": "The address of the corresponding foreign gateway.", - "returns": { - "_0": "The address of the corresponding foreign gateway." - } - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "feeToken()": { - "notice": "return The fee token." - } - }, - "notice": "Home Gateway Counterpart of `ForeignGateway`", - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 16243, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 16246, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "arbitrator", - "offset": 0, - "slot": "1", - "type": "t_contract(IArbitratorV2)15393" - }, - { - "astId": 16249, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "veaInbox", - "offset": 0, - "slot": "2", - "type": "t_contract(IVeaInbox)46" - }, - { - "astId": 16255, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "foreignGateway", - "offset": 0, - "slot": "3", - "type": "t_address" - }, - { - "astId": 16258, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "feeToken", - "offset": 0, - "slot": "4", - "type": "t_contract(IERC20)1042" - }, - { - "astId": 16262, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeIDtoHash", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_uint256,t_bytes32)" - }, - { - "astId": 16266, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeHashtoID", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 16271, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeHashtoRelayedData", - "offset": 0, - "slot": "7", - "type": "t_mapping(t_bytes32,t_struct(RelayedData)16232_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(IArbitratorV2)15393": { - "encoding": "inplace", - "label": "contract IArbitratorV2", - "numberOfBytes": "20" - }, - "t_contract(IERC20)1042": { - "encoding": "inplace", - "label": "contract IERC20", - "numberOfBytes": "20" - }, - "t_contract(IVeaInbox)46": { - "encoding": "inplace", - "label": "contract IVeaInbox", - "numberOfBytes": "20" - }, - "t_mapping(t_bytes32,t_struct(RelayedData)16232_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct HomeGateway.RelayedData)", - "numberOfBytes": "32", - "value": "t_struct(RelayedData)16232_storage" - }, - "t_mapping(t_bytes32,t_uint256)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_uint256,t_bytes32)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bytes32)", - "numberOfBytes": "32", - "value": "t_bytes32" - }, - "t_struct(RelayedData)16232_storage": { - "encoding": "inplace", - "label": "struct HomeGateway.RelayedData", - "members": [ - { - "astId": 16229, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "arbitrationCost", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 16231, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "relayer", - "offset": 0, - "slot": "1", - "type": "t_address" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} diff --git a/contracts/deployments/arbitrumGoerliDevnet/KlerosCore.json b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore.json index 1e9ab5f2c..61b8c0a45 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/KlerosCore.json +++ b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore.json @@ -1,56 +1,18 @@ { - "address": "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", "abi": [ { - "inputs": [ - { - "internalType": "address", - "name": "_governor", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "_pinakion", - "type": "address" - }, - { - "internalType": "address", - "name": "_jurorProsecutionModule", - "type": "address" - }, - { - "internalType": "contract IDisputeKit", - "name": "_disputeKit", - "type": "address" - }, - { - "internalType": "bool", - "name": "_hiddenVotes", - "type": "bool" - }, - { - "internalType": "uint256[4]", - "name": "_courtParameters", - "type": "uint256[4]" - }, - { - "internalType": "uint256[4]", - "name": "_timesPerPeriod", - "type": "uint256[4]" - }, - { - "internalType": "bytes", - "name": "_sortitionExtraData", - "type": "bytes" - }, - { - "internalType": "contract ISortitionModule", - "name": "_sortitionModuleAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" }, { "inputs": [], @@ -117,6 +79,11 @@ "name": "EvidenceNotPassedAndNotAppeal", "type": "error" }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [], "name": "GovernorOnly", @@ -132,6 +99,17 @@ "name": "InvalidForkingCourtAsParent", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, { "inputs": [], "name": "MinStakeLowerThanParentCourt", @@ -147,6 +125,11 @@ "name": "NotExecutionPeriod", "type": "error" }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, { "inputs": [], "name": "RulingAlreadyExecuted", @@ -162,6 +145,27 @@ "name": "TokenNotAccepted", "type": "error" }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, { "inputs": [], "name": "UnsuccessfulCall", @@ -516,6 +520,19 @@ "name": "Draw", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -722,121 +739,17 @@ "type": "event" }, { - "inputs": [], - "name": "ALPHA_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_NB_OF_JURORS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DISPUTE_KIT_CLASSIC", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FORKING_COURT", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "GENERAL_COURT", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "NATIVE_CURRENCY", - "outputs": [ + "anonymous": false, + "inputs": [ { - "internalType": "contract IERC20", - "name": "", + "indexed": true, + "internalType": "address", + "name": "newImplementation", "type": "address" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "NON_PAYABLE_AMOUNT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "NULL_DISPUTE_KIT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SEARCH_ITERATIONS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" + "name": "Upgraded", + "type": "event" }, { "inputs": [ @@ -1776,6 +1689,59 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_pinakion", + "type": "address" + }, + { + "internalType": "address", + "name": "_jurorProsecutionModule", + "type": "address" + }, + { + "internalType": "contract IDisputeKit", + "name": "_disputeKit", + "type": "address" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "_courtParameters", + "type": "uint256[4]" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "internalType": "bytes", + "name": "_sortitionExtraData", + "type": "bytes" + }, + { + "internalType": "contract ISortitionModule", + "name": "_sortitionModuleAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1858,6 +1824,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1911,53 +1890,87 @@ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0xce92ae764134214f2b4fb42102c71940358d89e5065e90471818110b44a872df", + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", - "transactionIndex": 1, - "gasUsed": "5411777", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000020000000000004000000000000000000000000000000000000000000000000800040000000000000000000010000000000000000000000000040000000000000000000000000000020000000000000000000800400000000000000008000000000000000000000000000000004000000000040000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000008000000000000008000000000000000000000000000000000000060000000001001001000000000000000000000000000000000001000000000000000", - "blockHash": "0x08e3e2e49508601338e226109f82b0b677163ab6e364452a820d0bf3c5e5064e", - "transactionHash": "0xce92ae764134214f2b4fb42102c71940358d89e5065e90471818110b44a872df", + "contractAddress": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "transactionIndex": 2, + "gasUsed": "566267", + "logsBloom": "0x00002000000000000000000000080000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000040000000000000000000000000000020000100000000000000800400000000000000008000000000000000000000000000000004800000000040000000000000080000000000000000000000000000000000008000000000000000000040000000000000000000000000000000008000000000000000000000000000000000004000000000000000061000004001001000000000000000000000000000000000000000000000000000000", + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c", + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", "logs": [ { - "transactionIndex": 1, - "blockNumber": 43589342, - "transactionHash": "0xce92ae764134214f2b4fb42102c71940358d89e5065e90471818110b44a872df", - "address": "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", "topics": [ "0x7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498", "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x000000000000000000000000848db6fbe64b06d58cd9d58820a4fb2f70537f2b", + "0x0000000000000000000000006394a70cadd1376fde5c38ba331761256ddd03e2", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x", - "logIndex": 0, - "blockHash": "0x08e3e2e49508601338e226109f82b0b677163ab6e364452a820d0bf3c5e5064e" + "logIndex": 8, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" }, { - "transactionIndex": 1, - "blockNumber": 43589342, - "transactionHash": "0xce92ae764134214f2b4fb42102c71940358d89e5065e90471818110b44a872df", - "address": "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", "topics": [ "0x3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000", - "logIndex": 1, - "blockHash": "0x08e3e2e49508601338e226109f82b0b677163ab6e364452a820d0bf3c5e5064e" + "logIndex": 9, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" }, { - "transactionIndex": 1, - "blockNumber": 43589342, - "transactionHash": "0xce92ae764134214f2b4fb42102c71940358d89e5065e90471818110b44a872df", - "address": "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", "topics": [ "0xb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc79", "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -1965,326 +1978,82 @@ "0x0000000000000000000000000000000000000000000000000000000000000001" ], "data": "0x", - "logIndex": 2, - "blockHash": "0x08e3e2e49508601338e226109f82b0b677163ab6e364452a820d0bf3c5e5064e" + "logIndex": 10, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" + }, + { + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 11, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" } ], - "blockNumber": 43589342, - "cumulativeGasUsed": "5411777", + "blockNumber": 43823780, + "cumulativeGasUsed": "817492", "status": 1, "byzantium": true }, "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0x3483FA1b87792cd5BE4100822C4eCEC8D3E531ee", - "0x0000000000000000000000000000000000000000", - "0x848DB6FBE64b06d58cD9D58820a4FB2F70537F2b", - false, - [ - "200000000000000000000", - 10000, - "100000000000000000", - 256 - ], - [ - 0, - 0, - 0, - 10 - ], - "0x05", - "0x6f3b3c8d72Af21102088C8b3F07Ee97b166a21b2" + "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", + "0x994b27af000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a30000000000000000000000003483fa1b87792cd5be4100822c4ecec8d3e531ee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000006394a70cadd1376fde5c38ba331761256ddd03e2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000a7e5d4c3e6c593cf6a367c3a415bb8e4a065e62e00000000000000000000000000000000000000000000000000000000000000010500000000000000000000000000000000000000000000000000000000000000" ], - "numDeployments": 4, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKit\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256[4]\",\"name\":\"_courtParameters\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"bytes\",\"name\":\"_sortitionExtraData\",\"type\":\"bytes\"},{\"internalType\":\"contract ISortitionModule\",\"name\":\"_sortitionModuleAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AppealFeesNotEnough\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AppealPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ArbitrationFeesNotEnough\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ArraysLengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotDisableRootDKInGeneral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CommitPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepthLevelMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeKitNotSupportedByCourt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeKitOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeNotAppealable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodIsFinal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeStillDrawing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EvidenceNotPassedAndNotAppeal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GovernorOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDisputKitParent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidForkingCourtAsParent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinStakeLowerThanParentCourt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEvidencePeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotExecutionPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RulingAlreadyExecuted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakingFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotAccepted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsuccessfulCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsupportedDisputeKit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VotePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WrongCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WrongDisputeKitIndex\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"AcceptedFeeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealDecision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealPossible\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"CourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromCourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toCourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"CourtModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"DisputeKitCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"DisputeKitEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_fromDisputeKitID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_toDisputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"Draw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_pnkAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"LeftoverRewardSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"NewCurrencyRate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum KlerosCore.Period\",\"name\":\"_period\",\"type\":\"uint8\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"StakeDelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"StakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_degreeOfCoherency\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_pnkAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_feeAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"TokenAndETHShift\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ALPHA_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_NB_OF_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DISPUTE_KIT_CLASSIC\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FORKING_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GENERAL_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_CURRENCY\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NON_PAYABLE_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NULL_DISPUTE_KIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SEARCH_ITERATIONS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"addNewDisputeKit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"appeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"changeAcceptedFeeTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"changeCourtParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"changeCurrencyRates\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"}],\"name\":\"changeJurorProsecutionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"}],\"name\":\"changePinakion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ISortitionModule\",\"name\":\"_sortitionModule\",\"type\":\"address\"}],\"name\":\"changeSortitionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountInEth\",\"type\":\"uint256\"}],\"name\":\"convertEthToTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"courts\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"disabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"bytes\",\"name\":\"_sortitionExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"createCourt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_feeAmount\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"currencyRates\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"feePaymentAccepted\",\"type\":\"bool\"},{\"internalType\":\"uint64\",\"name\":\"rateInEth\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"rateDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeKitNodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"parent\",\"type\":\"uint256\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"disputeKit\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depthLevel\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"disabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"contract IArbitrableV2\",\"name\":\"arbitrated\",\"type\":\"address\"},{\"internalType\":\"enum KlerosCore.Period\",\"name\":\"period\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lastPeriodChange\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[]\",\"name\":\"_disputeKitIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"enableDisputeKits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"executeRuling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKit\",\"outputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKitChildren\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputeKitNodesLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalLocked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakedInCourt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbCourts\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"}],\"name\":\"getJurorCourtIDs\",\"outputs\":[{\"internalType\":\"uint96[]\",\"name\":\"\",\"type\":\"uint96[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfRounds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"disputeKitID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pnkAtStakePerJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeesForJurors\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repartitions\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pnkPenalties\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"drawnJurors\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"sumFeeRewardPaid\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sumPnkRewardPaid\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"drawIterations\",\"type\":\"uint256\"}],\"internalType\":\"struct KlerosCore.Round\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getTimesPerPeriod\",\"outputs\":[{\"internalType\":\"uint256[4]\",\"name\":\"timesPerPeriod\",\"type\":\"uint256[4]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"isDisputeKitJumping\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"isSupported\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jurorProsecutionModule\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"passPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pinakion\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_newStake\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_newStake\",\"type\":\"uint256\"}],\"name\":\"setStakeBySortitionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sortitionModule\",\"outputs\":[{\"internalType\":\"contract ISortitionModule\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AcceptedFeeToken(address,bool)\":{\"details\":\"To be emitted when an ERC20 token is added or removed as a method to pay fees.\",\"params\":{\"_accepted\":\"Whether the token is accepted or not.\",\"_token\":\"The ERC20 token.\"}},\"DisputeCreation(uint256,address)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_arbitrable\":\"The contract which created the dispute.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\"}},\"NewCurrencyRate(address,uint64,uint8)\":{\"details\":\"To be emitted when the fee for a particular ERC20 token is updated.\",\"params\":{\"_feeToken\":\"The ERC20 token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrable\":\"The arbitrable receiving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}}},\"kind\":\"dev\",\"methods\":{\"addNewDisputeKit(address,uint256)\":{\"details\":\"Add a new supported dispute kit module to the court.\",\"params\":{\"_disputeKitAddress\":\"The address of the dispute kit contract.\",\"_parent\":\"The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court.\"}},\"appeal(uint256,uint256,bytes)\":{\"details\":\"Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_extraData\":\"Extradata for the dispute. Can be required during court jump.\",\"_numberOfChoices\":\"Number of choices for the dispute. Can be required during court jump.\"}},\"appealCost(uint256)\":{\"details\":\"Gets the cost of appealing a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"cost\":\"The appeal cost.\"}},\"appealPeriod(uint256)\":{\"details\":\"Gets the start and the end of a specified dispute's current appeal period.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"end\":\"The end of the appeal period.\",\"start\":\"The start of the appeal period.\"}},\"arbitrationCost(bytes)\":{\"details\":\"Compute the cost of arbitration denominated in ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost in ETH.\"}},\"arbitrationCost(bytes,address)\":{\"details\":\"Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeToken\":\"The ERC20 token used to pay fees.\"},\"returns\":{\"cost\":\"The arbitration cost in `_feeToken`.\"}},\"changeAcceptedFeeTokens(address,bool)\":{\"details\":\"Changes the supported fee tokens.\",\"params\":{\"_accepted\":\"Whether the token is supported or not as a method of fee payment.\",\"_feeToken\":\"The fee token.\"}},\"changeCurrencyRates(address,uint64,uint8)\":{\"details\":\"Changes the currency rate of a fee token.\",\"params\":{\"_feeToken\":\"The fee token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeJurorProsecutionModule(address)\":{\"details\":\"Changes the `jurorProsecutionModule` storage variable.\",\"params\":{\"_jurorProsecutionModule\":\"The new value for the `jurorProsecutionModule` storage variable.\"}},\"changePinakion(address)\":{\"details\":\"Changes the `pinakion` storage variable.\",\"params\":{\"_pinakion\":\"The new value for the `pinakion` storage variable.\"}},\"changeSortitionModule(address)\":{\"details\":\"Changes the `_sortitionModule` storage variable. Note that the new module should be initialized for all courts.\",\"params\":{\"_sortitionModule\":\"The new value for the `sortitionModule` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_courtParameters\":\"Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\",\"_disputeKit\":\"The address of the default dispute kit.\",\"_governor\":\"The governor's address.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the general court.\",\"_jurorProsecutionModule\":\"The address of the juror prosecution module.\",\"_pinakion\":\"The address of the token contract.\",\"_sortitionExtraData\":\"The extra data for sortition module.\",\"_sortitionModuleAddress\":\"The sortition module responsible for sortition of the jurors.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the general court.\"}},\"createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],bytes,uint256[])\":{\"details\":\"Creates a court under a specified parent court.\",\"params\":{\"_alpha\":\"The `alpha` property value of the court.\",\"_feeForJuror\":\"The `feeForJuror` property value of the court.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the court.\",\"_jurorsForCourtJump\":\"The `jurorsForCourtJump` property value of the court.\",\"_minStake\":\"The `minStake` property value of the court.\",\"_parent\":\"The `parent` property value of the court.\",\"_sortitionExtraData\":\"Extra data for sortition module.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this court will support.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the court.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"createDispute(uint256,bytes,address,uint256)\":{\"details\":\"Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeAmount\":\"Amount of the ERC20 token used to pay fees.\",\"_feeToken\":\"The ERC20 token used to pay fees.\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws jurors for the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\"}},\"enableDisputeKits(uint96,uint256[],bool)\":{\"details\":\"Adds/removes court's support for specified dispute kits.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the court.\"}},\"execute(uint256,uint256,uint256)\":{\"details\":\"Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\",\"_round\":\"The appeal round.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"executeRuling(uint256)\":{\"details\":\"Executes a specified dispute's ruling.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getDisputeKit(uint256)\":{\"details\":\"Gets the dispute kit for a specific `_disputeKitID`.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"}},\"getDisputeKitChildren(uint256)\":{\"details\":\"Gets non-primitive properties of a specified dispute kit node.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"},\"returns\":{\"_0\":\"children Indexes of children of this DK.\"}},\"getJurorCourtIDs(address)\":{\"details\":\"Gets the court identifiers where a specific `_juror` has staked.\",\"params\":{\"_juror\":\"The address of the juror.\"}},\"getNumberOfVotes(uint256)\":{\"details\":\"Gets the number of votes permitted for the specified dispute in the latest round.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getTimesPerPeriod(uint96)\":{\"details\":\"Gets the timesPerPeriod array for a given court.\",\"params\":{\"_courtID\":\"The ID of the court to get the times from.\"},\"returns\":{\"timesPerPeriod\":\"The timesPerPeriod array for the given court.\"}},\"isDisputeKitJumping(uint256)\":{\"details\":\"Returns true if the dispute kit will be switched to a parent DK.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"_0\":\"Whether DK will be switched or not.\"}},\"passPeriod(uint256)\":{\"details\":\"Passes the period of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"setStake(uint96,uint256)\":{\"details\":\"Sets the caller's stake in a court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_newStake\":\"The new stake.\"}}},\"title\":\"KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/KlerosCore.sol\":\"KlerosCore\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2 {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 public constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n /// @dev Constructor.\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n if (_courtID != GENERAL_COURT && courts[courts[_courtID].parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n if (courts[courts[_courtID].children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n courts[_courtID].minStake = _minStake;\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n courts[_courtID].alpha = _alpha;\\n courts[_courtID].feeForJuror = _feeForJuror;\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n CurrencyRate storage rate = currencyRates[_feeToken];\\n rate.rateInEth = _rateInEth;\\n rate.rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n require(_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount), \\\"Transfer failed\\\");\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit;\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKit.createDispute(_disputeID, _numberOfChoices, _extraData, extraRound.nbVotes);\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n CurrencyRate storage rate = currencyRates[_toToken];\\n return (_amountInEth * 10 ** rate.rateDecimals) / rate.rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == FORKING_COURT || courtID >= courts.length) {\\n courtID = GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = DEFAULT_NB_OF_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n}\\n\",\"keccak256\":\"0xc9f7a39d8996805b06b34b538277cd9250e56302bf9f259b4f16d1775f343bdd\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620061533803806200615383398101604081905262000034916200065f565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c8316908416178155600280548c841690851617815560038054878516951694909417909355600580546040805160a081018252878152815188815260208082018452808301918252968f1692820192909252606081018890526080810188905295820183559582905284519201027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db08101918255935180519394919362000128937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db19093019291909101906200045c565b506040828101516002830180546001600160a01b0319166001600160a01b03928316179055606084015160038401556080909301516004909201805460ff191692151592909217909155516000918816906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a460048054600101815560008181526003546040516311de995760e21b81526001600160a01b039091169263477a655c92620001e19290918791016200074c565b600060405180830381600087803b158015620001fc57600080fd5b505af115801562000211573d6000803e3d6000fd5b5050600480546001810182556000918252600c027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160601b031916815560408051838152602081019091529093509150508051620002819160018401916020909101906200045c565b50805460ff60601b19166c01000000000000000000000000871515021781558451600282015560208501516003820155604085015160048083019190915560608601516005830155620002db9060068301908690620004ac565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c90620003119060019087906004016200074c565b600060405180830381600087803b1580156200032c57600080fd5b505af115801562000341573d6000803e3d6000fd5b5050825487516020808a01516040808c015160608d0151825160008152948501928390526001600160601b039096169750600196507f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d95620003ab958f959094938e91906200079e565b60405180910390a3620003c160018080620003d1565b505050505050505050506200083a565b806004846001600160601b031681548110620003f157620003f162000788565b60009182526020808320868452600c92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b8280548282559060005260206000209081019282156200049a579160200282015b828111156200049a5782518255916020019190600101906200047d565b50620004a8929150620004dc565b5090565b82600481019282156200049a57916020028201828111156200049a5782518255916020019190600101906200047d565b5b80821115620004a85760008155600101620004dd565b6001600160a01b03811681146200050957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200053457600080fd5b604051608081016001600160401b03811182821017156200055957620005596200050c565b6040528060808401858111156200056f57600080fd5b845b818110156200058b57805183526020928301920162000571565b509195945050505050565b60005b83811015620005b357818101518382015260200162000599565b50506000910152565b600082601f830112620005ce57600080fd5b81516001600160401b0380821115620005eb57620005eb6200050c565b604051601f8301601f19908116603f011681019082821181831017156200061657620006166200050c565b816040528381528660208588010111156200063057600080fd5b6200064384602083016020890162000596565b9695505050505050565b80516200065a81620004f3565b919050565b60008060008060008060008060006101e08a8c0312156200067f57600080fd5b89516200068c81620004f3565b60208b01519099506200069f81620004f3565b60408b0151909850620006b281620004f3565b60608b0151909750620006c581620004f3565b60808b01519096508015158114620006dc57600080fd5b9450620006ed8b60a08c0162000522565b9350620006ff8b6101208c0162000522565b6101a08b01519093506001600160401b038111156200071d57600080fd5b6200072b8c828d01620005bc565b9250506200073d6101c08b016200064d565b90509295985092959850929598565b82815260406020820152600082518060408401526200077381606085016020870162000596565b601f01601f1916919091016060019392505050565b634e487b7160e01b600052603260045260246000fd5b60006101408083018a1515845260208a8186015289604086015288606086015287608086015260a085018760005b6004811015620007eb57815183529183019190830190600101620007cc565b5050506101208501929092528451908190526101608401918086019160005b8181101562000828578351855293820193928201926001016200080a565b50929c9b505050505050505050505050565b615909806200084a6000396000f3fe6080604052600436106102d45760003560e01c8063751accd01161017b578063c258bb19116100d7578063e4c0aaf411610085578063e4c0aaf414610a20578063f12ada8b14610a40578063f6506db414610a60578063f7434ea914610a80578063fbf405b014610aa0578063fc6f8f1614610ac0578063fe524c3914610ae057600080fd5b8063c258bb19146108ef578063c35699021461090f578063c71f425314610922578063cf0c38f814610942578063d1c1df4814610962578063d2b8035a146109e0578063d98493f614610a0057600080fd5b80638a9bb02a116101345780638a9bb02a146108055780638bb0487514610832578063a072b86c14610852578063afe15cfb14610872578063b0049637146108a7578063bcb1a166146108c7578063c13517e1146108dc57600080fd5b8063751accd01461074a5780637717a6e81461076a5780637934c0be1461078a57806382d02237146107aa578063840bc19c146107ca57806386541b24146107e557600080fd5b806327e6ec8a1161023557806349f42650116101e357806349f4265014610678578063543f8a361461068d578063564a565d146106ba57806359ec827e146106eb5780635ea5c0381461070b5780636235593f146107205780636c1eb1b91461073557600080fd5b806327e6ec8a146105865780632d29a47b146105b35780632e1daf2f146105d35780632ea7b4d0146105f357806334d5fb31146106095780633cfd11841461061e57806343d4137f1461064b57600080fd5b80630d83b940116102925780630d83b94014610435578063115d5376146104585780631860592b146104785780631956b1f91461049857806319b81529146104b85780631c3db16d146104e85780631f5a0dd21461052557600080fd5b8062f5822c146102d95780630219da79146102fb5780630761c14d146103735780630b7414bc146103935780630c340a24146103b35780630d1b9d1a146103eb575b600080fd5b3480156102e557600080fd5b506102f96102f4366004614b1f565b610b00565b005b34801561030757600080fd5b50610346610316366004614b1f565b60086020526000908152604090205460ff808216916001600160401b0361010082041691600160481b9091041683565b6040805193151584526001600160401b03909216602084015260ff16908201526060015b60405180910390f35b34801561037f57600080fd5b506102f961038e366004614b58565b610b4d565b34801561039f57600080fd5b506102f96103ae366004614c5e565b610b89565b3480156103bf57600080fd5b506000546103d3906001600160a01b031681565b6040516001600160a01b03909116815260200161036a565b3480156103f757600080fd5b5061040b610406366004614cbf565b610cfe565b604080519485526001600160a01b039093166020850152918301521515606082015260800161036a565b34801561044157600080fd5b5061044a600181565b60405190815260200161036a565b34801561046457600080fd5b506102f9610473366004614cbf565b610d44565b34801561048457600080fd5b5061044a610493366004614cd8565b611286565b3480156104a457600080fd5b506103d36104b3366004614cbf565b6112e2565b3480156104c457600080fd5b506104d86104d3366004614cbf565b61131a565b604051901515815260200161036a565b3480156104f457600080fd5b50610508610503366004614cbf565b611413565b60408051938452911515602084015215159082015260600161036a565b34801561053157600080fd5b50610545610540366004614cbf565b61151c565b604080516001600160601b0390981688529515156020880152948601939093526060850191909152608084015260a0830152151560c082015260e00161036a565b34801561059257600080fd5b5061059b600081565b6040516001600160601b03909116815260200161036a565b3480156105bf57600080fd5b506102f96105ce366004614d04565b61157b565b3480156105df57600080fd5b506003546103d3906001600160a01b031681565b3480156105ff57600080fd5b5061044a61271081565b34801561061557600080fd5b5061059b600181565b34801561062a57600080fd5b5061063e610639366004614d30565b6117c3565b60405161036a9190614d6e565b34801561065757600080fd5b5061066b610666366004614cbf565b611834565b60405161036a9190614db7565b34801561068457600080fd5b506103d3600081565b34801561069957600080fd5b506106ad6106a8366004614b1f565b6118b0565b60405161036a9190614dca565b3480156106c657600080fd5b506106da6106d5366004614cbf565b61194c565b60405161036a959493929190614e4f565b3480156106f757600080fd5b5061044a610706366004614cbf565b6119a8565b34801561071757600080fd5b5060055461044a565b34801561072c57600080fd5b5061044a600081565b34801561074157600080fd5b5061044a600a81565b34801561075657600080fd5b506102f9610765366004614efd565b611afd565b34801561077657600080fd5b506102f9610785366004614f55565b611ba7565b34801561079657600080fd5b506102f96107a5366004614f71565b611bd3565b3480156107b657600080fd5b506102f96107c5366004614faa565b611c52565b3480156107d657600080fd5b5061044a6001600160ff1b0381565b3480156107f157600080fd5b506102f9610800366004615069565b611d14565b34801561081157600080fd5b506108256108203660046150d7565b612049565b60405161036a9190615132565b34801561083e57600080fd5b506102f961084d366004614cbf565b6121d5565b34801561085e57600080fd5b506102f961086d3660046151d7565b612339565b34801561087e57600080fd5b5061089261088d366004614cbf565b612678565b6040805192835260208301919091520161036a565b3480156108b357600080fd5b506102f96108c2366004614b1f565b612724565b3480156108d357600080fd5b5061044a600381565b61044a6108ea366004615297565b612771565b3480156108fb57600080fd5b506102f961090a366004614b1f565b6127b0565b6102f961091d3660046152dd565b6127fd565b34801561092e57600080fd5b5061044a61093d366004614cbf565b612de5565b34801561094e57600080fd5b506002546103d3906001600160a01b031681565b34801561096e57600080fd5b506109c061097d366004615316565b6001600160a01b039091166000908152600760209081526040808320600181015460028201546001600160601b0390961685526003820190935292205491549093565b60408051948552602085019390935291830152606082015260800161036a565b3480156109ec57600080fd5b506102f96109fb3660046150d7565b612e4d565b348015610a0c57600080fd5b5061044a610a1b366004615393565b613134565b348015610a2c57600080fd5b506102f9610a3b366004614b1f565b613181565b348015610a4c57600080fd5b506102f9610a5b366004614cd8565b6131ce565b348015610a6c57600080fd5b5061044a610a7b3660046153de565b6133f1565b348015610a8c57600080fd5b5061044a610a9b366004615444565b6134fa565b348015610aac57600080fd5b506001546103d3906001600160a01b031681565b348015610acc57600080fd5b5061044a610adb366004614cbf565b613546565b348015610aec57600080fd5b506104d8610afb366004614f55565b613575565b6000546001600160a01b03163314610b2b5760405163c383977560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314610b785760405163068690bf60e11b815260040160405180910390fd5b610b838383836135bd565b50505050565b6000546001600160a01b03163314610bb45760405163c383977560e01b815260040160405180910390fd5b60005b8251811015610b83578115610c5357828181518110610bd857610bd8615478565b602002602001015160001480610c0b57506005548351849083908110610c0057610c00615478565b602002602001015110155b15610c2957604051633d58a98960e11b815260040160405180910390fd5b610c4e84848381518110610c3f57610c3f615478565b60200260200101516001613b62565b610cec565b6001600160601b0384166001148015610ca9575060006005848381518110610c7d57610c7d615478565b602002602001015181548110610c9557610c95615478565b906000526020600020906005020160000154145b15610cc757604051630c6e81c960e11b815260040160405180910390fd5b610cec84848381518110610cdd57610cdd615478565b60200260200101516000613b62565b80610cf6816154a4565b915050610bb7565b60058181548110610d0e57600080fd5b600091825260209091206005909102018054600282015460038301546004909301549193506001600160a01b0316919060ff1684565b600060068281548110610d5957610d59615478565b600091825260208220600491820201805482549194506001600160601b0316908110610d8757610d87615478565b6000918252602082206003850154600c909202019250610da9906001906154bd565b90506000836003018281548110610dc257610dc2615478565b600091825260208220600b909102019150600185015460ff166004811115610dec57610dec614e17565b03610ec75781158015610e3b57506001840154600684019060ff166004811115610e1857610e18614e17565b60048110610e2857610e28615478565b01546002850154610e3990426154bd565b105b15610e5957604051633e9727df60e01b815260040160405180910390fd5b6003810154600682015414610e81576040516309e4486b60e41b815260040160405180910390fd5b8254600160601b900460ff16610e98576002610e9b565b60015b60018086018054909160ff1990911690836004811115610ebd57610ebd614e17565b0217905550611238565b60018085015460ff166004811115610ee157610ee1614e17565b03610ff9576001840154600684019060ff166004811115610f0457610f04614e17565b60048110610f1457610f14615478565b01546002850154610f2590426154bd565b108015610fc457506005816000015481548110610f4457610f44615478565b6000918252602090912060059091020160020154604051630baa64d160e01b8152600481018790526001600160a01b0390911690630baa64d190602401602060405180830381865afa158015610f9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc291906154d0565b155b15610fe257604051634dfa578560e11b815260040160405180910390fd5b6001808501805460029260ff199091169083610ebd565b6002600185015460ff16600481111561101457611014614e17565b0361116a576001840154600684019060ff16600481111561103757611037614e17565b6004811061104757611047615478565b0154600285015461105890426154bd565b1080156110f75750600581600001548154811061107757611077615478565b60009182526020909120600590910201600201546040516336a66c7560e11b8152600481018790526001600160a01b0390911690636d4cd8ea90602401602060405180830381865afa1580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f591906154d0565b155b1561111557604051631988dead60e31b815260040160405180910390fd5b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611238565b6003600185015460ff16600481111561118557611185614e17565b036111ff576001840154600684019060ff1660048111156111a8576111a8614e17565b600481106111b8576111b8615478565b015460028501546111c990426154bd565b10156111e857604051632f4dfd8760e01b815260040160405180910390fd5b6001808501805460049260ff199091169083610ebd565b6004600185015460ff16600481111561121a5761121a614e17565b03611238576040516307f38c8f60e11b815260040160405180910390fd5b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91916112779160ff16906154ed565b60405180910390a25050505050565b6001600160a01b0382166000908152600860205260408120805461010081046001600160401b0316906112c490600160481b900460ff16600a6155df565b6112ce90856155ee565b6112d8919061561b565b9150505b92915050565b6000600582815481106112f7576112f7615478565b60009182526020909120600260059092020101546001600160a01b031692915050565b6000806006838154811061133057611330615478565b6000918252602082206003600490920201908101805491935090611356906001906154bd565b8154811061136657611366615478565b600091825260208220845460048054600b909402909201945090916001600160601b0390911690811061139b5761139b615478565b90600052602060002090600c020190508060050154826003015410156113c657506000949350505050565b80546004805490916001600160601b03169081106113e6576113e6615478565b6000918252602080832094548352600a600c9092029094010190925250604090205460ff16159392505050565b6000806000806006858154811061142c5761142c615478565b6000918252602082206003600490920201908101805491935090611452906001906154bd565b8154811061146257611462615478565b90600052602060002090600b020190506000600582600001548154811061148b5761148b615478565b6000918252602090912060059091020160020154604051631c3db16d60e01b8152600481018990526001600160a01b0390911691508190631c3db16d90602401606060405180830381865afa1580156114e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150c919061562f565b9199909850909650945050505050565b6004818154811061152c57600080fd5b60009182526020909120600c9091020180546002820154600383015460048401546005850154600b909501546001600160601b038516965060ff600160601b9095048516959394929391921687565b60006006848154811061159057611590615478565b600091825260209091206004918202019150600182015460ff1660048111156115bb576115bb614e17565b146115d957604051638794ce4b60e01b815260040160405180910390fd5b60008160030184815481106115f0576115f0615478565b90600052602060002090600b020190506000600582600001548154811061161957611619615478565b6000918252602082206002600590920201015460048401546001600160a01b039091169250906116498683615667565b6005850154600686015460405163368efae360e21b8152600481018c9052602481018b905292935090916000906001600160a01b0387169063da3beb8c90604401602060405180830381865afa1580156116a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cb919061567a565b9050806000036116e657818411156116e1578193505b611706565b6116f18260026155ee565b841115611706576117038260026155ee565b93505b60048701849055845b848110156117a2578281101561175b576117546040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250613bea565b9350611790565b6117906040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614088565b8061179a816154a4565b91505061170f565b50828760050154146117b657600587018390555b5050505050505050505050565b6117cb614a5c565b60006004836001600160601b0316815481106117e9576117e9615478565b60009182526020909120604080516080810191829052600c9093029091019250600683019060049082845b815481526020019060010190808311611814575050505050915050919050565b60606005828154811061184957611849615478565b90600052602060002090600502016001018054806020026020016040519081016040528092919081815260200182805480156118a457602002820191906000526020600020905b815481526020019060010190808311611890575b50505050509050919050565b6001600160a01b0381166000908152600760209081526040918290208054835181840281018401909452808452606093928301828280156118a457602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b010492830192600103820291508084116118ff575094979650505050505050565b6006818154811061195c57600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600683815481106119be576119be615478565b60009182526020822060036004909202019081018054919350906119e4906001906154bd565b815481106119f4576119f4615478565b600091825260208220845460048054600b909402909201945090916001600160601b03909116908110611a2957611a29615478565b90600052602060002090600c020190508060050154826003015410611ac85782546001600160601b031660001901611a6a576001600160ff1b039350611af5565b6003820154611a7a9060026155ee565b611a85906001615667565b81546004805490916001600160601b0316908110611aa557611aa5615478565b90600052602060002090600c020160040154611ac191906155ee565b9350611af5565b6003820154611ad89060026155ee565b611ae3906001615667565b8160040154611af291906155ee565b93505b505050919050565b6000546001600160a01b03163314611b285760405163c383977560e01b815260040160405180910390fd5b6000836001600160a01b03168383604051611b4391906156b7565b60006040518083038185875af1925050503d8060008114611b80576040519150601f19603f3d011682016040523d82523d6000602084013e611b85565b606091505b5050905080610b83576040516322092f2f60e11b815260040160405180910390fd5b611bb23383836135bd565b611bcf5760405163a437293760e01b815260040160405180910390fd5b5050565b6000546001600160a01b03163314611bfe5760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038216600081815260086020526040808220805460ff191685151590811790915590519092917f541615e167511d757a7067a700eb54431b256bb458dfdce0ac58bf2ed0aefd4491a35050565b6000546001600160a01b03163314611c7d5760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038316600081815260086020908152604091829020805469ffffffffffffffffff0019166101006001600160401b03881690810260ff60481b191691909117600160481b60ff881690810291909117835584519182529281019290925292917fe6996b7f03e9bd02228b99d3d946932e3197f505f60542c4cfbc919441d8a4e6910160405180910390a250505050565b6000546001600160a01b03163314611d3f5760405163c383977560e01b815260040160405180910390fd5b6001600160601b038716600114801590611db3575084600480896001600160601b031681548110611d7257611d72615478565b60009182526020909120600c909102015481546001600160601b03909116908110611d9f57611d9f615478565b90600052602060002090600c020160020154115b15611dd157604051639717078960e01b815260040160405180910390fd5b60005b6004886001600160601b031681548110611df057611df0615478565b90600052602060002090600c020160010180549050811015611eaa57856004808a6001600160601b031681548110611e2a57611e2a615478565b90600052602060002090600c02016001018381548110611e4c57611e4c615478565b906000526020600020015481548110611e6757611e67615478565b90600052602060002090600c0201600201541015611e9857604051639717078960e01b815260040160405180910390fd5b80611ea2816154a4565b915050611dd4565b50846004886001600160601b031681548110611ec857611ec8615478565b90600052602060002090600c020160020181905550856004886001600160601b031681548110611efa57611efa615478565b90600052602060002090600c0201600001600c6101000a81548160ff021916908315150217905550836004886001600160601b031681548110611f3f57611f3f615478565b90600052602060002090600c020160030181905550826004886001600160601b031681548110611f7157611f71615478565b90600052602060002090600c020160040181905550816004886001600160601b031681548110611fa357611fa3615478565b90600052602060002090600c020160050181905550806004886001600160601b031681548110611fd557611fd5615478565b90600052602060002090600c0201600601906004611ff4929190614a7a565b50866001600160601b03167f709b1f5fda58af9a4f52dacd1ec404840a8148455700cce155a2bd8cf127ef1a878787878787604051612038969594939291906156d3565b60405180910390a250505050505050565b6120af60405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b600683815481106120c2576120c2615478565b906000526020600020906004020160030182815481106120e4576120e4615478565b90600052602060002090600b0201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180548060200260200160405190810160405280929190818152602001828054801561219357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612175575b5050509183525050600782015460208201526008820154604082015260098201546001600160a01b03166060820152600a909101546080909101529392505050565b6000600682815481106121ea576121ea615478565b600091825260209091206004918202019150600182015460ff16600481111561221557612215614e17565b1461223357604051638794ce4b60e01b815260040160405180910390fd5b6001810154610100900460ff161561225e5760405163c977f8d360e01b815260040160405180910390fd5b600061226983611413565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561231c57600080fd5b505af1158015612330573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146123645760405163c383977560e01b815260040160405180910390fd5b8660048a6001600160601b03168154811061238157612381615478565b90600052602060002090600c02016002015411156123b257604051639717078960e01b815260040160405180910390fd5b80516000036123d45760405163402585f560e01b815260040160405180910390fd5b6001600160601b0389166123fb57604051631ef4f64960e01b815260040160405180910390fd5b60048054600181018255600091825290600c82027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01905b83518110156124f95783818151811061244e5761244e615478565b6020026020010151600014806124815750600554845185908390811061247657612476615478565b602002602001015110155b1561249f57604051633d58a98960e11b815260040160405180910390fd5b600182600a0160008684815181106124b9576124b9615478565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806124f1906154a4565b915050612433565b5080546001600160601b0319166001600160601b038c161781556040805160008152602081019182905251612532916001840191614ab8565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556125759060068301908790614a7a565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c906125a89085908890600401615732565b600060405180830381600087803b1580156125c257600080fd5b505af11580156125d6573d6000803e3d6000fd5b5050505060048b6001600160601b0316815481106125f6576125f6615478565b600091825260208083206001600c909302018201805492830181558352909120018290556040516001600160601b038c169083907f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d90612663908e908e908e908e908e908e908d9061574b565b60405180910390a35050505050505050505050565b60008060006006848154811061269057612690615478565b6000918252602090912060049091020190506003600182015460ff1660048111156126bd576126bd614e17565b03612715576002810154815460048054929550916001600160601b039091169081106126eb576126eb615478565b600091825260209091206009600c909202010154600282015461270e9190615667565b915061271e565b60009250600091505b50915091565b6000546001600160a01b0316331461274f5760405163c383977560e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061277c826134fa565b34101561279c57604051630e3360f160e21b815260040160405180910390fd5b6127a9838360003461453f565b9392505050565b6000546001600160a01b031633146127db5760405163c383977560e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b612806836119a8565b34101561282657604051633191f8f160e01b815260040160405180910390fd5b60006006848154811061283b5761283b615478565b6000918252602090912060049091020190506003600182015460ff16600481111561286857612868614e17565b14612886576040516337cdefcb60e21b815260040160405180910390fd5b6003810180546000919061289c906001906154bd565b815481106128ac576128ac615478565b90600052602060002090600b0201905060058160000154815481106128d3576128d3615478565b60009182526020909120600590910201600201546001600160a01b0316331461290f5760405163065f245f60e01b815260040160405180910390fd5b8154815460038401805460018101825560009182526020909120600480546001600160601b0390951694600b909302909101918490811061295257612952615478565b90600052602060002090600c020160050154846003015410612b50576004836001600160601b03168154811061298a5761298a615478565b600091825260208220600c90910201546001600160601b031693505b600a811015612a95576004846001600160601b0316815481106129cb576129cb615478565b60009182526020808320868452600a600c90930201919091019052604090205460ff16612a9557600060058481548110612a0757612a07615478565b90600052602060002090600502016000015414612a4a5760058381548110612a3157612a31615478565b9060005260206000209060050201600001549250612a83565b6004846001600160601b031681548110612a6657612a66615478565b60009182526020909120600c90910201546001600160601b031693505b80612a8d816154a4565b9150506129a6565b506004836001600160601b031681548110612ab257612ab2615478565b60009182526020808320858452600a600c90930201919091019052604090205460ff16612ade57600192505b84546001600160601b03848116911614612b5057845460038601546001600160601b0390911690612b11906001906154bd565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff1916905542600287015560048054600092908110612b9357612b93615478565b90600052602060002090600c02019050806004015434612bb3919061561b565b826003018190555061271081600301548260020154612bd291906155ee565b612bdc919061561b565b60018084019190915534600284015583835560038054908801546001600160a01b039091169163d09f392d918c91612c13916154bd565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015612c5157600080fd5b505af1158015612c65573d6000803e3d6000fd5b505086548454149150612d6290505760006005836000015481548110612c8d57612c8d615478565b6000918252602090912060026005909202010154865460038901546001600160a01b03909216925090612cc2906001906154bd565b84546040519081528c907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460038301546040516302dbb79560e61b81526001600160a01b0383169163b6ede54091612d2e918e918e918e9160040161579b565b600060405180830381600087803b158015612d4857600080fd5b505af1158015612d5c573d6000803e3d6000fd5b50505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b916000604051612dd291906154ed565b60405180910390a2505050505050505050565b60008060068381548110612dfb57612dfb615478565b906000526020600020906004020190508060030160018260030180549050612e2391906154bd565b81548110612e3357612e33615478565b90600052602060002090600b020160030154915050919050565b600060068381548110612e6257612e62615478565b90600052602060002090600402019050600060018260030180549050612e8891906154bd565b90506000826003018281548110612ea157612ea1615478565b600091825260208220600b909102019150600184015460ff166004811115612ecb57612ecb614e17565b14612ee957604051638285c4ef60e01b815260040160405180910390fd5b60006005826000015481548110612f0257612f02615478565b60009182526020822060026005909202010154600a8401546001600160a01b039091169250905b8681108015612f3f575060038401546006850154105b156131115760006001600160a01b03841663d2b8035a8a84612f60816154a4565b9550612f6c9087615667565b6040516001600160e01b031960e085901b168152600481019290925260248201526044016020604051808303816000875af1158015612faf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd391906157cb565b90506001600160a01b038116612fe95750612f29565b60018501546001600160a01b03821660009081526007602052604081206002018054909190613019908490615667565b909155505060068501546040805188815260208101929092528a916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a36006850180546001810182556000828152602090200180546001600160a01b0319166001600160a01b038416179055600386015490540361310b57600354604051632e96bc2360e11b8152600481018b9052602481018890526001600160a01b0390911690635d2d784690604401600060405180830381600087803b1580156130f257600080fd5b505af1158015613106573d6000803e3d6000fd5b505050505b50612f29565b8084600a0160008282546131259190615667565b90915550505050505050505050565b60006131798261049386868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506134fa92505050565b949350505050565b6000546001600160a01b031633146131ac5760405163c383977560e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146131f95760405163c383977560e01b815260040160405180910390fd5b60055480821061321c57604051630becfec560e01b815260040160405180910390fd5b60008215613277576005838154811061323757613237615478565b90600052602060002090600502016003015460016132559190615667565b9050600a8110613277576040516210d62560e51b815260040160405180910390fd5b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b0389169484019490945260608301859052608083018190526005805460018101825591819052835191027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db081019182559151805193949193613328937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db101929190910190614ab8565b5060408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080909101516004909101805460ff1916911515919091179055600580548490811061338757613387615478565b600091825260208083206001600590930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482610b8357610b836001836001613b62565b6001600160a01b03821660009081526008602052604081205460ff1661342a5760405163e51cf7bf60e01b815260040160405180910390fd5b613435858585613134565b82101561345557604051630e3360f160e21b815260040160405180910390fd5b61346a6001600160a01b038416333085614830565b6134ac5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015260640160405180910390fd5b6134f08686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925087915061453f9050565b9695505050505050565b60008060006135088461490c565b5091509150806004836001600160601b03168154811061352a5761352a615478565b90600052602060002090600c02016004015461317991906155ee565b60006006828154811061355b5761355b615478565b600091825260209091206003600490920201015492915050565b60006004836001600160601b03168154811061359357613593615478565b60009182526020808320948352600c91909102909301600a0190925250604090205460ff16919050565b60006001600160601b03831615806135df57506004546001600160601b038416115b156135ec575060006127a9565b6001600160a01b03841660009081526007602090815260408083206001600160601b038716845260038101909252909120548315613669576004856001600160601b03168154811061364057613640615478565b90600052602060002090600c020160020154841015613664576000925050506127a9565b61367c565b8060000361367c576000925050506127a9565b60035460405163684fbf5f60e01b81526000916001600160a01b03169063684fbf5f906136b1908a908a908a906004016157e8565b6020604051808303816000875af11580156136d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f49190615812565b9050600281600281111561370a5761370a614e17565b0361371b57600093505050506127a9565b600181600281111561372f5761372f614e17565b0361378d57604080516001600160601b0388168152602081018790526001600160a01b038916917f64c1aa6f3a1b4d72ebddff4e415cd05929dd5af5d670f06dce76627211b49911910160405180910390a2600193505050506127a9565b600082861061386d5760008460010154856002015410156137af5760006137c3565b846001015485600201546137c391906154bd565b90506137cf8185615667565b8710156137dd5760006137f2565b806137e885896154bd565b6137f291906154bd565b9150811561382457600154613812906001600160a01b03168a3085614830565b613824576000955050505050506127a9565b83600003613867578454600180820187556000878152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b50613a52565b600284015461387c87856154bd565b6138869190615667565b8460010154106138a15761389a86846154bd565b90506138c7565b83600201548460010154106138c757836002015484600101546138c491906154bd565b90505b80156138f5576001546138e4906001600160a01b03168983614993565b6138f55760009450505050506127a9565b85600003613a525783545b8015613a50576001600160601b0388168561391c6001846154bd565b8154811061392c5761392c615478565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031603613a3e5784548590613968906001906154bd565b8154811061397857613978615478565b600091825260209091206002820401546001918216600c026101000a90046001600160601b03169086906139ac90846154bd565b815481106139bc576139bc615478565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480613a0857613a08615833565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055613a50565b80613a4881615849565b915050613900565b505b8284600101541015613a645785613a7f565b85838560010154613a7591906154bd565b613a7f9190615667565b60018501556001600160601b03871660009081526003808601602052604091829020889055549051631166238b60e21b81526001600160a01b03909116906345988e2c90613ad5908b908b908b906004016157e8565b600060405180830381600087803b158015613aef57600080fd5b505af1158015613b03573d6000803e3d6000fd5b5050604080516001600160601b038b168152602081018a90526001600160a01b038c1693507f4732545d01e38980276a17e6d394f01577ba63f2fea5eba41af0757d9c060c5c92500160405180910390a2506001979650505050505050565b806004846001600160601b031681548110613b7f57613b7f615478565b60009182526020808320868452600c92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b6000806006836000015181548110613c0457613c04615478565b90600052602060002090600402019050600081600301846020015181548110613c2f57613c2f615478565b90600052602060002090600b0201905060006005826000015481548110613c5857613c58615478565b600091825260208083206005929092029091016002015487519188015160a0890151604051634fe264fb60e01b81526004810194909452602484019190915260448301526001600160a01b031692508290634fe264fb90606401602060405180830381865afa158015613ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cf3919061567a565b9050612710811115613d0457506127105b6000612710613d1383826154bd565b8560010154613d2291906155ee565b613d2c919061561b565b90508087608001818151613d409190615667565b90525060a0870151600685018054600092908110613d6057613d60615478565b60009182526020808320909101546001600160a01b0316808352600790915260408220600201805491935084929091613d9a9084906154bd565b90915550506001600160a01b0381166000908152600760205260409020600101548211613df7576001600160a01b03811660009081526007602052604081206001018054849290613dec9084906154bd565b90915550613e149050565b6001600160a01b0381166000908152600760205260408120600101555b602088015188516001600160a01b0383167f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e786613e5087615860565b60098b0154604051613e729392916000916001600160a01b039091169061587c565b60405180910390a48751602089015160a08a015160405163ba66fde760e01b81526004810193909352602483019190915260448201526001600160a01b0385169063ba66fde790606401602060405180830381865afa158015613ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efd91906154d0565b613f615760035460405163b5d69e9960e01b81526001600160a01b0383811660048301529091169063b5d69e9990602401600060405180830381600087803b158015613f4857600080fd5b505af1158015613f5c573d6000803e3d6000fd5b505050505b60018860600151613f7291906154bd565b8860a00151148015613f8657506040880151155b156140775760098501546001600160a01b0316613fcf576000805460028701546040516001600160a01b039092169281156108fc029290818181858888f1935050505050613ff6565b60005460028601546009870154613ff4926001600160a01b0391821692911690614993565b505b6000546080890151600154614019926001600160a01b0391821692911690614993565b506020880151885160808a0151600288015460098901546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49361406e93909290916001600160a01b03909116906158a0565b60405180910390a35b505050608090940151949350505050565b600060068260000151815481106140a1576140a1615478565b906000526020600020906004020190506000816003018360200151815481106140cc576140cc615478565b90600052602060002090600b02019050600060058260000154815481106140f5576140f5615478565b906000526020600020906005020160020160009054906101000a90046001600160a01b031690506000816001600160a01b0316634fe264fb8660000151876020015188606001518960a0015161414b91906158bf565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401602060405180830381865afa158015614194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141b8919061567a565b90506127108111156141c957506127105b60008360060186606001518760a001516141e391906158bf565b815481106141f3576141f3615478565b600091825260208220015460018601546001600160a01b0390911692506127109061421f9085906155ee565b614229919061561b565b6001600160a01b0383166000908152600760205260408120600201805492935083929091906142599084906154bd565b90915550506001600160a01b038216600090815260076020526040812060010154900361429957600154614297906001600160a01b03168383614993565b505b60006127108489604001518a608001516142b3919061561b565b6142bd91906155ee565b6142c7919061561b565b9050808660080160008282546142dd9190615667565b925050819055506000612710858a6040015189600201546142fe919061561b565b61430891906155ee565b614312919061561b565b9050808760070160008282546143289190615667565b9091555050600154614344906001600160a01b03168584614993565b5060098701546001600160a01b0316614382576040516001600160a01b0385169082156108fc029083906000818181858888f193505050505061439d565b600987015461439b906001600160a01b03168583614993565b505b6020890151895160098901546040516001600160a01b03888116927f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e7926143ed928c928a928a929091169061587c565b60405180910390a460018960600151600261440891906155ee565b61441291906154bd565b8960a001510361453457600087600801548a6080015161443291906154bd565b905060008860070154896002015461444a91906154bd565b90508115158061445957508015155b156117b657811561448357600054600154614481916001600160a01b03918216911684614993565b505b80156144ea5760098901546001600160a01b03166144c957600080546040516001600160a01b039091169183156108fc02918491818181858888f19350505050506144ea565b60005460098a01546144e8916001600160a01b03918216911683614993565b505b60208b01518b5160098b01546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49161266391879187916001600160a01b03909116906158a0565b505050505050505050565b600080600061454d8661490c565b92505091506004826001600160601b03168154811061456e5761456e615478565b60009182526020808320848452600a600c90930201919091019052604090205460ff166145ae5760405163b34eb75d60e01b815260040160405180910390fd5b600680546001810182556000918252600160601b33026001600160601b03851617600482027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101918255427ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190910155600580549296509092918490811061463957614639615478565b600091825260208220600260059092020101548354600480546001600160a01b039093169450916001600160601b0390911690811061467a5761467a615478565b60009182526020808320600387018054600181018255908552918420600c909302019350600b0201906001600160a01b038a16156146c5576146c08a8460040154611286565b6146cb565b82600401545b90506146d7818a61561b565b6003808401919091558683558301546002840154612710916146f8916155ee565b614702919061561b565b6001830155600282018990556009820180546001600160a01b0319166001600160a01b038c81169190911790915560035460405163d09f392d60e01b8152600481018b90526000602482015291169063d09f392d90604401600060405180830381600087803b15801561477457600080fd5b505af1158015614788573d6000803e3d6000fd5b50505050836001600160a01b031663b6ede540898e8e86600301546040518563ffffffff1660e01b81526004016147c2949392919061579b565b600060405180830381600087803b1580156147dc57600080fd5b505af11580156147f0573d6000803e3d6000fd5b50506040513392508a91507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505050949350505050565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b1790525161489591906156b7565b6000604051808303816000865af19150503d80600081146148d2576040519150601f19603f3d011682016040523d82523d6000602084013e6148d7565b606091505b509150915081801561490157508051158061490157508080602001905181019061490191906154d0565b979650505050505050565b60008060006040845110614981575050506020810151604082015160608301516001600160601b038316158061494d57506004546001600160601b03841610155b1561495757600192505b8160000361496457600391505b80158061497357506005548110155b1561497c575060015b61498c565b506001915060039050815b9193909250565b6040516001600160a01b03838116602483015260448201839052600091829182919087169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052516149f091906156b7565b6000604051808303816000865af19150503d8060008114614a2d576040519150601f19603f3d011682016040523d82523d6000602084013e614a32565b606091505b50915091508180156134f05750805115806134f05750808060200190518101906134f091906154d0565b60405180608001604052806004906020820280368337509192915050565b8260048101928215614aa8579160200282015b82811115614aa8578251825591602001919060010190614a8d565b50614ab4929150614af2565b5090565b828054828255906000526020600020908101928215614aa85791602002820182811115614aa8578251825591602001919060010190614a8d565b5b80821115614ab45760008155600101614af3565b6001600160a01b0381168114614b1c57600080fd5b50565b600060208284031215614b3157600080fd5b81356127a981614b07565b80356001600160601b0381168114614b5357600080fd5b919050565b600080600060608486031215614b6d57600080fd5b8335614b7881614b07565b9250614b8660208501614b3c565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614bd457614bd4614b96565b604052919050565b600082601f830112614bed57600080fd5b813560206001600160401b03821115614c0857614c08614b96565b8160051b614c17828201614bac565b9283528481018201928281019087851115614c3157600080fd5b83870192505b8483101561490157823582529183019190830190614c37565b8015158114614b1c57600080fd5b600080600060608486031215614c7357600080fd5b614c7c84614b3c565b925060208401356001600160401b03811115614c9757600080fd5b614ca386828701614bdc565b9250506040840135614cb481614c50565b809150509250925092565b600060208284031215614cd157600080fd5b5035919050565b60008060408385031215614ceb57600080fd5b8235614cf681614b07565b946020939093013593505050565b600080600060608486031215614d1957600080fd5b505081359360208301359350604090920135919050565b600060208284031215614d4257600080fd5b6127a982614b3c565b8060005b6004811015610b83578151845260209384019390910190600101614d4f565b608081016112dc8284614d4b565b600081518084526020808501945080840160005b83811015614dac57815187529582019590820190600101614d90565b509495945050505050565b6020815260006127a96020830184614d7c565b6020808252825182820181905260009190848201906040850190845b81811015614e0b5783516001600160601b031683529284019291840191600101614de6565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b60058110614e4b57634e487b7160e01b600052602160045260246000fd5b9052565b6001600160601b03861681526001600160a01b038516602082015260a08101614e7b6040830186614e2d565b9215156060820152608001529392505050565b600082601f830112614e9f57600080fd5b81356001600160401b03811115614eb857614eb8614b96565b614ecb601f8201601f1916602001614bac565b818152846020838601011115614ee057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614f1257600080fd5b8335614f1d81614b07565b92506020840135915060408401356001600160401b03811115614f3f57600080fd5b614f4b86828701614e8e565b9150509250925092565b60008060408385031215614f6857600080fd5b614cf683614b3c565b60008060408385031215614f8457600080fd5b8235614f8f81614b07565b91506020830135614f9f81614c50565b809150509250929050565b600080600060608486031215614fbf57600080fd5b8335614fca81614b07565b925060208401356001600160401b0381168114614fe657600080fd5b9150604084013560ff81168114614cb457600080fd5b600082601f83011261500d57600080fd5b604051608081018181106001600160401b038211171561502f5761502f614b96565b60405280608084018581111561504457600080fd5b845b8181101561505e578035835260209283019201615046565b509195945050505050565b6000806000806000806000610140888a03121561508557600080fd5b61508e88614b3c565b9650602088013561509e81614c50565b955060408801359450606088013593506080880135925060a088013591506150c98960c08a01614ffc565b905092959891949750929550565b600080604083850312156150ea57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b83811015614dac5781516001600160a01b03168752958201959082019060010161510d565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516101608060e085015261518d6101808501836150f9565b60e086015161010086810191909152860151610120808701919091528601519092506101406151c6818701836001600160a01b03169052565b959095015193019290925250919050565b60008060008060008060008060006101808a8c0312156151f657600080fd5b6151ff8a614b3c565b985060208a013561520f81614c50565b975060408a0135965060608a0135955060808a0135945060a08a0135935061523a8b60c08c01614ffc565b92506101408a01356001600160401b038082111561525757600080fd5b6152638d838e01614e8e565b93506101608c013591508082111561527a57600080fd5b506152878c828d01614bdc565b9150509295985092959850929598565b600080604083850312156152aa57600080fd5b8235915060208301356001600160401b038111156152c757600080fd5b6152d385828601614e8e565b9150509250929050565b6000806000606084860312156152f257600080fd5b833592506020840135915060408401356001600160401b03811115614f3f57600080fd5b6000806040838503121561532957600080fd5b823561533481614b07565b915061534260208401614b3c565b90509250929050565b60008083601f84011261535d57600080fd5b5081356001600160401b0381111561537457600080fd5b60208301915083602082850101111561538c57600080fd5b9250929050565b6000806000604084860312156153a857600080fd5b83356001600160401b038111156153be57600080fd5b6153ca8682870161534b565b9094509250506020840135614cb481614b07565b6000806000806000608086880312156153f657600080fd5b8535945060208601356001600160401b0381111561541357600080fd5b61541f8882890161534b565b909550935050604086013561543381614b07565b949793965091946060013592915050565b60006020828403121561545657600080fd5b81356001600160401b0381111561546c57600080fd5b6112d884828501614e8e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016154b6576154b661548e565b5060010190565b818103818111156112dc576112dc61548e565b6000602082840312156154e257600080fd5b81516127a981614c50565b602081016112dc8284614e2d565b600181815b8085111561553657816000190482111561551c5761551c61548e565b8085161561552957918102915b93841c9390800290615500565b509250929050565b60008261554d575060016112dc565b8161555a575060006112dc565b8160018114615570576002811461557a57615596565b60019150506112dc565b60ff84111561558b5761558b61548e565b50506001821b6112dc565b5060208310610133831016604e8410600b84101617156155b9575081810a6112dc565b6155c383836154fb565b80600019048211156155d7576155d761548e565b029392505050565b60006127a960ff84168361553e565b80820281158282048414176112dc576112dc61548e565b634e487b7160e01b600052601260045260246000fd5b60008261562a5761562a615605565b500490565b60008060006060848603121561564457600080fd5b83519250602084015161565681614c50565b6040850151909250614cb481614c50565b808201808211156112dc576112dc61548e565b60006020828403121561568c57600080fd5b5051919050565b60005b838110156156ae578181015183820152602001615696565b50506000910152565b600082516156c9818460208701615693565b9190910192915050565b600061012082019050871515825286602083015285604083015284606083015283608083015261490160a0830184614d4b565b6000815180845261571e816020860160208601615693565b601f01601f19169290920160200192915050565b8281526040602082015260006131796040830184615706565b6000610140891515835288602084015287604084015286606084015285608084015261577a60a0840186614d4b565b8061012084015261578d81840185614d7c565b9a9950505050505050505050565b8481528360208201526080604082015260006157ba6080830185615706565b905082606083015295945050505050565b6000602082840312156157dd57600080fd5b81516127a981614b07565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b60006020828403121561582457600080fd5b8151600381106127a957600080fd5b634e487b7160e01b600052603160045260246000fd5b6000816158585761585861548e565b506000190190565b6000600160ff1b82016158755761587561548e565b5060000390565b938452602084019290925260408301526001600160a01b0316606082015260800190565b92835260208301919091526001600160a01b0316604082015260600190565b6000826158ce576158ce615605565b50069056fea2646970667358221220a1b7e777a928415490dfa579be6d77a94db9f9647aced4e284a65f692843b1d764736f6c63430008120033", - "deployedBytecode": "0x6080604052600436106102d45760003560e01c8063751accd01161017b578063c258bb19116100d7578063e4c0aaf411610085578063e4c0aaf414610a20578063f12ada8b14610a40578063f6506db414610a60578063f7434ea914610a80578063fbf405b014610aa0578063fc6f8f1614610ac0578063fe524c3914610ae057600080fd5b8063c258bb19146108ef578063c35699021461090f578063c71f425314610922578063cf0c38f814610942578063d1c1df4814610962578063d2b8035a146109e0578063d98493f614610a0057600080fd5b80638a9bb02a116101345780638a9bb02a146108055780638bb0487514610832578063a072b86c14610852578063afe15cfb14610872578063b0049637146108a7578063bcb1a166146108c7578063c13517e1146108dc57600080fd5b8063751accd01461074a5780637717a6e81461076a5780637934c0be1461078a57806382d02237146107aa578063840bc19c146107ca57806386541b24146107e557600080fd5b806327e6ec8a1161023557806349f42650116101e357806349f4265014610678578063543f8a361461068d578063564a565d146106ba57806359ec827e146106eb5780635ea5c0381461070b5780636235593f146107205780636c1eb1b91461073557600080fd5b806327e6ec8a146105865780632d29a47b146105b35780632e1daf2f146105d35780632ea7b4d0146105f357806334d5fb31146106095780633cfd11841461061e57806343d4137f1461064b57600080fd5b80630d83b940116102925780630d83b94014610435578063115d5376146104585780631860592b146104785780631956b1f91461049857806319b81529146104b85780631c3db16d146104e85780631f5a0dd21461052557600080fd5b8062f5822c146102d95780630219da79146102fb5780630761c14d146103735780630b7414bc146103935780630c340a24146103b35780630d1b9d1a146103eb575b600080fd5b3480156102e557600080fd5b506102f96102f4366004614b1f565b610b00565b005b34801561030757600080fd5b50610346610316366004614b1f565b60086020526000908152604090205460ff808216916001600160401b0361010082041691600160481b9091041683565b6040805193151584526001600160401b03909216602084015260ff16908201526060015b60405180910390f35b34801561037f57600080fd5b506102f961038e366004614b58565b610b4d565b34801561039f57600080fd5b506102f96103ae366004614c5e565b610b89565b3480156103bf57600080fd5b506000546103d3906001600160a01b031681565b6040516001600160a01b03909116815260200161036a565b3480156103f757600080fd5b5061040b610406366004614cbf565b610cfe565b604080519485526001600160a01b039093166020850152918301521515606082015260800161036a565b34801561044157600080fd5b5061044a600181565b60405190815260200161036a565b34801561046457600080fd5b506102f9610473366004614cbf565b610d44565b34801561048457600080fd5b5061044a610493366004614cd8565b611286565b3480156104a457600080fd5b506103d36104b3366004614cbf565b6112e2565b3480156104c457600080fd5b506104d86104d3366004614cbf565b61131a565b604051901515815260200161036a565b3480156104f457600080fd5b50610508610503366004614cbf565b611413565b60408051938452911515602084015215159082015260600161036a565b34801561053157600080fd5b50610545610540366004614cbf565b61151c565b604080516001600160601b0390981688529515156020880152948601939093526060850191909152608084015260a0830152151560c082015260e00161036a565b34801561059257600080fd5b5061059b600081565b6040516001600160601b03909116815260200161036a565b3480156105bf57600080fd5b506102f96105ce366004614d04565b61157b565b3480156105df57600080fd5b506003546103d3906001600160a01b031681565b3480156105ff57600080fd5b5061044a61271081565b34801561061557600080fd5b5061059b600181565b34801561062a57600080fd5b5061063e610639366004614d30565b6117c3565b60405161036a9190614d6e565b34801561065757600080fd5b5061066b610666366004614cbf565b611834565b60405161036a9190614db7565b34801561068457600080fd5b506103d3600081565b34801561069957600080fd5b506106ad6106a8366004614b1f565b6118b0565b60405161036a9190614dca565b3480156106c657600080fd5b506106da6106d5366004614cbf565b61194c565b60405161036a959493929190614e4f565b3480156106f757600080fd5b5061044a610706366004614cbf565b6119a8565b34801561071757600080fd5b5060055461044a565b34801561072c57600080fd5b5061044a600081565b34801561074157600080fd5b5061044a600a81565b34801561075657600080fd5b506102f9610765366004614efd565b611afd565b34801561077657600080fd5b506102f9610785366004614f55565b611ba7565b34801561079657600080fd5b506102f96107a5366004614f71565b611bd3565b3480156107b657600080fd5b506102f96107c5366004614faa565b611c52565b3480156107d657600080fd5b5061044a6001600160ff1b0381565b3480156107f157600080fd5b506102f9610800366004615069565b611d14565b34801561081157600080fd5b506108256108203660046150d7565b612049565b60405161036a9190615132565b34801561083e57600080fd5b506102f961084d366004614cbf565b6121d5565b34801561085e57600080fd5b506102f961086d3660046151d7565b612339565b34801561087e57600080fd5b5061089261088d366004614cbf565b612678565b6040805192835260208301919091520161036a565b3480156108b357600080fd5b506102f96108c2366004614b1f565b612724565b3480156108d357600080fd5b5061044a600381565b61044a6108ea366004615297565b612771565b3480156108fb57600080fd5b506102f961090a366004614b1f565b6127b0565b6102f961091d3660046152dd565b6127fd565b34801561092e57600080fd5b5061044a61093d366004614cbf565b612de5565b34801561094e57600080fd5b506002546103d3906001600160a01b031681565b34801561096e57600080fd5b506109c061097d366004615316565b6001600160a01b039091166000908152600760209081526040808320600181015460028201546001600160601b0390961685526003820190935292205491549093565b60408051948552602085019390935291830152606082015260800161036a565b3480156109ec57600080fd5b506102f96109fb3660046150d7565b612e4d565b348015610a0c57600080fd5b5061044a610a1b366004615393565b613134565b348015610a2c57600080fd5b506102f9610a3b366004614b1f565b613181565b348015610a4c57600080fd5b506102f9610a5b366004614cd8565b6131ce565b348015610a6c57600080fd5b5061044a610a7b3660046153de565b6133f1565b348015610a8c57600080fd5b5061044a610a9b366004615444565b6134fa565b348015610aac57600080fd5b506001546103d3906001600160a01b031681565b348015610acc57600080fd5b5061044a610adb366004614cbf565b613546565b348015610aec57600080fd5b506104d8610afb366004614f55565b613575565b6000546001600160a01b03163314610b2b5760405163c383977560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314610b785760405163068690bf60e11b815260040160405180910390fd5b610b838383836135bd565b50505050565b6000546001600160a01b03163314610bb45760405163c383977560e01b815260040160405180910390fd5b60005b8251811015610b83578115610c5357828181518110610bd857610bd8615478565b602002602001015160001480610c0b57506005548351849083908110610c0057610c00615478565b602002602001015110155b15610c2957604051633d58a98960e11b815260040160405180910390fd5b610c4e84848381518110610c3f57610c3f615478565b60200260200101516001613b62565b610cec565b6001600160601b0384166001148015610ca9575060006005848381518110610c7d57610c7d615478565b602002602001015181548110610c9557610c95615478565b906000526020600020906005020160000154145b15610cc757604051630c6e81c960e11b815260040160405180910390fd5b610cec84848381518110610cdd57610cdd615478565b60200260200101516000613b62565b80610cf6816154a4565b915050610bb7565b60058181548110610d0e57600080fd5b600091825260209091206005909102018054600282015460038301546004909301549193506001600160a01b0316919060ff1684565b600060068281548110610d5957610d59615478565b600091825260208220600491820201805482549194506001600160601b0316908110610d8757610d87615478565b6000918252602082206003850154600c909202019250610da9906001906154bd565b90506000836003018281548110610dc257610dc2615478565b600091825260208220600b909102019150600185015460ff166004811115610dec57610dec614e17565b03610ec75781158015610e3b57506001840154600684019060ff166004811115610e1857610e18614e17565b60048110610e2857610e28615478565b01546002850154610e3990426154bd565b105b15610e5957604051633e9727df60e01b815260040160405180910390fd5b6003810154600682015414610e81576040516309e4486b60e41b815260040160405180910390fd5b8254600160601b900460ff16610e98576002610e9b565b60015b60018086018054909160ff1990911690836004811115610ebd57610ebd614e17565b0217905550611238565b60018085015460ff166004811115610ee157610ee1614e17565b03610ff9576001840154600684019060ff166004811115610f0457610f04614e17565b60048110610f1457610f14615478565b01546002850154610f2590426154bd565b108015610fc457506005816000015481548110610f4457610f44615478565b6000918252602090912060059091020160020154604051630baa64d160e01b8152600481018790526001600160a01b0390911690630baa64d190602401602060405180830381865afa158015610f9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc291906154d0565b155b15610fe257604051634dfa578560e11b815260040160405180910390fd5b6001808501805460029260ff199091169083610ebd565b6002600185015460ff16600481111561101457611014614e17565b0361116a576001840154600684019060ff16600481111561103757611037614e17565b6004811061104757611047615478565b0154600285015461105890426154bd565b1080156110f75750600581600001548154811061107757611077615478565b60009182526020909120600590910201600201546040516336a66c7560e11b8152600481018790526001600160a01b0390911690636d4cd8ea90602401602060405180830381865afa1580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f591906154d0565b155b1561111557604051631988dead60e31b815260040160405180910390fd5b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611238565b6003600185015460ff16600481111561118557611185614e17565b036111ff576001840154600684019060ff1660048111156111a8576111a8614e17565b600481106111b8576111b8615478565b015460028501546111c990426154bd565b10156111e857604051632f4dfd8760e01b815260040160405180910390fd5b6001808501805460049260ff199091169083610ebd565b6004600185015460ff16600481111561121a5761121a614e17565b03611238576040516307f38c8f60e11b815260040160405180910390fd5b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91916112779160ff16906154ed565b60405180910390a25050505050565b6001600160a01b0382166000908152600860205260408120805461010081046001600160401b0316906112c490600160481b900460ff16600a6155df565b6112ce90856155ee565b6112d8919061561b565b9150505b92915050565b6000600582815481106112f7576112f7615478565b60009182526020909120600260059092020101546001600160a01b031692915050565b6000806006838154811061133057611330615478565b6000918252602082206003600490920201908101805491935090611356906001906154bd565b8154811061136657611366615478565b600091825260208220845460048054600b909402909201945090916001600160601b0390911690811061139b5761139b615478565b90600052602060002090600c020190508060050154826003015410156113c657506000949350505050565b80546004805490916001600160601b03169081106113e6576113e6615478565b6000918252602080832094548352600a600c9092029094010190925250604090205460ff16159392505050565b6000806000806006858154811061142c5761142c615478565b6000918252602082206003600490920201908101805491935090611452906001906154bd565b8154811061146257611462615478565b90600052602060002090600b020190506000600582600001548154811061148b5761148b615478565b6000918252602090912060059091020160020154604051631c3db16d60e01b8152600481018990526001600160a01b0390911691508190631c3db16d90602401606060405180830381865afa1580156114e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150c919061562f565b9199909850909650945050505050565b6004818154811061152c57600080fd5b60009182526020909120600c9091020180546002820154600383015460048401546005850154600b909501546001600160601b038516965060ff600160601b9095048516959394929391921687565b60006006848154811061159057611590615478565b600091825260209091206004918202019150600182015460ff1660048111156115bb576115bb614e17565b146115d957604051638794ce4b60e01b815260040160405180910390fd5b60008160030184815481106115f0576115f0615478565b90600052602060002090600b020190506000600582600001548154811061161957611619615478565b6000918252602082206002600590920201015460048401546001600160a01b039091169250906116498683615667565b6005850154600686015460405163368efae360e21b8152600481018c9052602481018b905292935090916000906001600160a01b0387169063da3beb8c90604401602060405180830381865afa1580156116a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cb919061567a565b9050806000036116e657818411156116e1578193505b611706565b6116f18260026155ee565b841115611706576117038260026155ee565b93505b60048701849055845b848110156117a2578281101561175b576117546040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250613bea565b9350611790565b6117906040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614088565b8061179a816154a4565b91505061170f565b50828760050154146117b657600587018390555b5050505050505050505050565b6117cb614a5c565b60006004836001600160601b0316815481106117e9576117e9615478565b60009182526020909120604080516080810191829052600c9093029091019250600683019060049082845b815481526020019060010190808311611814575050505050915050919050565b60606005828154811061184957611849615478565b90600052602060002090600502016001018054806020026020016040519081016040528092919081815260200182805480156118a457602002820191906000526020600020905b815481526020019060010190808311611890575b50505050509050919050565b6001600160a01b0381166000908152600760209081526040918290208054835181840281018401909452808452606093928301828280156118a457602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b010492830192600103820291508084116118ff575094979650505050505050565b6006818154811061195c57600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600683815481106119be576119be615478565b60009182526020822060036004909202019081018054919350906119e4906001906154bd565b815481106119f4576119f4615478565b600091825260208220845460048054600b909402909201945090916001600160601b03909116908110611a2957611a29615478565b90600052602060002090600c020190508060050154826003015410611ac85782546001600160601b031660001901611a6a576001600160ff1b039350611af5565b6003820154611a7a9060026155ee565b611a85906001615667565b81546004805490916001600160601b0316908110611aa557611aa5615478565b90600052602060002090600c020160040154611ac191906155ee565b9350611af5565b6003820154611ad89060026155ee565b611ae3906001615667565b8160040154611af291906155ee565b93505b505050919050565b6000546001600160a01b03163314611b285760405163c383977560e01b815260040160405180910390fd5b6000836001600160a01b03168383604051611b4391906156b7565b60006040518083038185875af1925050503d8060008114611b80576040519150601f19603f3d011682016040523d82523d6000602084013e611b85565b606091505b5050905080610b83576040516322092f2f60e11b815260040160405180910390fd5b611bb23383836135bd565b611bcf5760405163a437293760e01b815260040160405180910390fd5b5050565b6000546001600160a01b03163314611bfe5760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038216600081815260086020526040808220805460ff191685151590811790915590519092917f541615e167511d757a7067a700eb54431b256bb458dfdce0ac58bf2ed0aefd4491a35050565b6000546001600160a01b03163314611c7d5760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038316600081815260086020908152604091829020805469ffffffffffffffffff0019166101006001600160401b03881690810260ff60481b191691909117600160481b60ff881690810291909117835584519182529281019290925292917fe6996b7f03e9bd02228b99d3d946932e3197f505f60542c4cfbc919441d8a4e6910160405180910390a250505050565b6000546001600160a01b03163314611d3f5760405163c383977560e01b815260040160405180910390fd5b6001600160601b038716600114801590611db3575084600480896001600160601b031681548110611d7257611d72615478565b60009182526020909120600c909102015481546001600160601b03909116908110611d9f57611d9f615478565b90600052602060002090600c020160020154115b15611dd157604051639717078960e01b815260040160405180910390fd5b60005b6004886001600160601b031681548110611df057611df0615478565b90600052602060002090600c020160010180549050811015611eaa57856004808a6001600160601b031681548110611e2a57611e2a615478565b90600052602060002090600c02016001018381548110611e4c57611e4c615478565b906000526020600020015481548110611e6757611e67615478565b90600052602060002090600c0201600201541015611e9857604051639717078960e01b815260040160405180910390fd5b80611ea2816154a4565b915050611dd4565b50846004886001600160601b031681548110611ec857611ec8615478565b90600052602060002090600c020160020181905550856004886001600160601b031681548110611efa57611efa615478565b90600052602060002090600c0201600001600c6101000a81548160ff021916908315150217905550836004886001600160601b031681548110611f3f57611f3f615478565b90600052602060002090600c020160030181905550826004886001600160601b031681548110611f7157611f71615478565b90600052602060002090600c020160040181905550816004886001600160601b031681548110611fa357611fa3615478565b90600052602060002090600c020160050181905550806004886001600160601b031681548110611fd557611fd5615478565b90600052602060002090600c0201600601906004611ff4929190614a7a565b50866001600160601b03167f709b1f5fda58af9a4f52dacd1ec404840a8148455700cce155a2bd8cf127ef1a878787878787604051612038969594939291906156d3565b60405180910390a250505050505050565b6120af60405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b600683815481106120c2576120c2615478565b906000526020600020906004020160030182815481106120e4576120e4615478565b90600052602060002090600b0201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180548060200260200160405190810160405280929190818152602001828054801561219357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612175575b5050509183525050600782015460208201526008820154604082015260098201546001600160a01b03166060820152600a909101546080909101529392505050565b6000600682815481106121ea576121ea615478565b600091825260209091206004918202019150600182015460ff16600481111561221557612215614e17565b1461223357604051638794ce4b60e01b815260040160405180910390fd5b6001810154610100900460ff161561225e5760405163c977f8d360e01b815260040160405180910390fd5b600061226983611413565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561231c57600080fd5b505af1158015612330573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146123645760405163c383977560e01b815260040160405180910390fd5b8660048a6001600160601b03168154811061238157612381615478565b90600052602060002090600c02016002015411156123b257604051639717078960e01b815260040160405180910390fd5b80516000036123d45760405163402585f560e01b815260040160405180910390fd5b6001600160601b0389166123fb57604051631ef4f64960e01b815260040160405180910390fd5b60048054600181018255600091825290600c82027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01905b83518110156124f95783818151811061244e5761244e615478565b6020026020010151600014806124815750600554845185908390811061247657612476615478565b602002602001015110155b1561249f57604051633d58a98960e11b815260040160405180910390fd5b600182600a0160008684815181106124b9576124b9615478565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806124f1906154a4565b915050612433565b5080546001600160601b0319166001600160601b038c161781556040805160008152602081019182905251612532916001840191614ab8565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556125759060068301908790614a7a565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c906125a89085908890600401615732565b600060405180830381600087803b1580156125c257600080fd5b505af11580156125d6573d6000803e3d6000fd5b5050505060048b6001600160601b0316815481106125f6576125f6615478565b600091825260208083206001600c909302018201805492830181558352909120018290556040516001600160601b038c169083907f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d90612663908e908e908e908e908e908e908d9061574b565b60405180910390a35050505050505050505050565b60008060006006848154811061269057612690615478565b6000918252602090912060049091020190506003600182015460ff1660048111156126bd576126bd614e17565b03612715576002810154815460048054929550916001600160601b039091169081106126eb576126eb615478565b600091825260209091206009600c909202010154600282015461270e9190615667565b915061271e565b60009250600091505b50915091565b6000546001600160a01b0316331461274f5760405163c383977560e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061277c826134fa565b34101561279c57604051630e3360f160e21b815260040160405180910390fd5b6127a9838360003461453f565b9392505050565b6000546001600160a01b031633146127db5760405163c383977560e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b612806836119a8565b34101561282657604051633191f8f160e01b815260040160405180910390fd5b60006006848154811061283b5761283b615478565b6000918252602090912060049091020190506003600182015460ff16600481111561286857612868614e17565b14612886576040516337cdefcb60e21b815260040160405180910390fd5b6003810180546000919061289c906001906154bd565b815481106128ac576128ac615478565b90600052602060002090600b0201905060058160000154815481106128d3576128d3615478565b60009182526020909120600590910201600201546001600160a01b0316331461290f5760405163065f245f60e01b815260040160405180910390fd5b8154815460038401805460018101825560009182526020909120600480546001600160601b0390951694600b909302909101918490811061295257612952615478565b90600052602060002090600c020160050154846003015410612b50576004836001600160601b03168154811061298a5761298a615478565b600091825260208220600c90910201546001600160601b031693505b600a811015612a95576004846001600160601b0316815481106129cb576129cb615478565b60009182526020808320868452600a600c90930201919091019052604090205460ff16612a9557600060058481548110612a0757612a07615478565b90600052602060002090600502016000015414612a4a5760058381548110612a3157612a31615478565b9060005260206000209060050201600001549250612a83565b6004846001600160601b031681548110612a6657612a66615478565b60009182526020909120600c90910201546001600160601b031693505b80612a8d816154a4565b9150506129a6565b506004836001600160601b031681548110612ab257612ab2615478565b60009182526020808320858452600a600c90930201919091019052604090205460ff16612ade57600192505b84546001600160601b03848116911614612b5057845460038601546001600160601b0390911690612b11906001906154bd565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff1916905542600287015560048054600092908110612b9357612b93615478565b90600052602060002090600c02019050806004015434612bb3919061561b565b826003018190555061271081600301548260020154612bd291906155ee565b612bdc919061561b565b60018084019190915534600284015583835560038054908801546001600160a01b039091169163d09f392d918c91612c13916154bd565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015612c5157600080fd5b505af1158015612c65573d6000803e3d6000fd5b505086548454149150612d6290505760006005836000015481548110612c8d57612c8d615478565b6000918252602090912060026005909202010154865460038901546001600160a01b03909216925090612cc2906001906154bd565b84546040519081528c907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460038301546040516302dbb79560e61b81526001600160a01b0383169163b6ede54091612d2e918e918e918e9160040161579b565b600060405180830381600087803b158015612d4857600080fd5b505af1158015612d5c573d6000803e3d6000fd5b50505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b916000604051612dd291906154ed565b60405180910390a2505050505050505050565b60008060068381548110612dfb57612dfb615478565b906000526020600020906004020190508060030160018260030180549050612e2391906154bd565b81548110612e3357612e33615478565b90600052602060002090600b020160030154915050919050565b600060068381548110612e6257612e62615478565b90600052602060002090600402019050600060018260030180549050612e8891906154bd565b90506000826003018281548110612ea157612ea1615478565b600091825260208220600b909102019150600184015460ff166004811115612ecb57612ecb614e17565b14612ee957604051638285c4ef60e01b815260040160405180910390fd5b60006005826000015481548110612f0257612f02615478565b60009182526020822060026005909202010154600a8401546001600160a01b039091169250905b8681108015612f3f575060038401546006850154105b156131115760006001600160a01b03841663d2b8035a8a84612f60816154a4565b9550612f6c9087615667565b6040516001600160e01b031960e085901b168152600481019290925260248201526044016020604051808303816000875af1158015612faf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd391906157cb565b90506001600160a01b038116612fe95750612f29565b60018501546001600160a01b03821660009081526007602052604081206002018054909190613019908490615667565b909155505060068501546040805188815260208101929092528a916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a36006850180546001810182556000828152602090200180546001600160a01b0319166001600160a01b038416179055600386015490540361310b57600354604051632e96bc2360e11b8152600481018b9052602481018890526001600160a01b0390911690635d2d784690604401600060405180830381600087803b1580156130f257600080fd5b505af1158015613106573d6000803e3d6000fd5b505050505b50612f29565b8084600a0160008282546131259190615667565b90915550505050505050505050565b60006131798261049386868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506134fa92505050565b949350505050565b6000546001600160a01b031633146131ac5760405163c383977560e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146131f95760405163c383977560e01b815260040160405180910390fd5b60055480821061321c57604051630becfec560e01b815260040160405180910390fd5b60008215613277576005838154811061323757613237615478565b90600052602060002090600502016003015460016132559190615667565b9050600a8110613277576040516210d62560e51b815260040160405180910390fd5b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b0389169484019490945260608301859052608083018190526005805460018101825591819052835191027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db081019182559151805193949193613328937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db101929190910190614ab8565b5060408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080909101516004909101805460ff1916911515919091179055600580548490811061338757613387615478565b600091825260208083206001600590930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482610b8357610b836001836001613b62565b6001600160a01b03821660009081526008602052604081205460ff1661342a5760405163e51cf7bf60e01b815260040160405180910390fd5b613435858585613134565b82101561345557604051630e3360f160e21b815260040160405180910390fd5b61346a6001600160a01b038416333085614830565b6134ac5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015260640160405180910390fd5b6134f08686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925087915061453f9050565b9695505050505050565b60008060006135088461490c565b5091509150806004836001600160601b03168154811061352a5761352a615478565b90600052602060002090600c02016004015461317991906155ee565b60006006828154811061355b5761355b615478565b600091825260209091206003600490920201015492915050565b60006004836001600160601b03168154811061359357613593615478565b60009182526020808320948352600c91909102909301600a0190925250604090205460ff16919050565b60006001600160601b03831615806135df57506004546001600160601b038416115b156135ec575060006127a9565b6001600160a01b03841660009081526007602090815260408083206001600160601b038716845260038101909252909120548315613669576004856001600160601b03168154811061364057613640615478565b90600052602060002090600c020160020154841015613664576000925050506127a9565b61367c565b8060000361367c576000925050506127a9565b60035460405163684fbf5f60e01b81526000916001600160a01b03169063684fbf5f906136b1908a908a908a906004016157e8565b6020604051808303816000875af11580156136d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f49190615812565b9050600281600281111561370a5761370a614e17565b0361371b57600093505050506127a9565b600181600281111561372f5761372f614e17565b0361378d57604080516001600160601b0388168152602081018790526001600160a01b038916917f64c1aa6f3a1b4d72ebddff4e415cd05929dd5af5d670f06dce76627211b49911910160405180910390a2600193505050506127a9565b600082861061386d5760008460010154856002015410156137af5760006137c3565b846001015485600201546137c391906154bd565b90506137cf8185615667565b8710156137dd5760006137f2565b806137e885896154bd565b6137f291906154bd565b9150811561382457600154613812906001600160a01b03168a3085614830565b613824576000955050505050506127a9565b83600003613867578454600180820187556000878152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b50613a52565b600284015461387c87856154bd565b6138869190615667565b8460010154106138a15761389a86846154bd565b90506138c7565b83600201548460010154106138c757836002015484600101546138c491906154bd565b90505b80156138f5576001546138e4906001600160a01b03168983614993565b6138f55760009450505050506127a9565b85600003613a525783545b8015613a50576001600160601b0388168561391c6001846154bd565b8154811061392c5761392c615478565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031603613a3e5784548590613968906001906154bd565b8154811061397857613978615478565b600091825260209091206002820401546001918216600c026101000a90046001600160601b03169086906139ac90846154bd565b815481106139bc576139bc615478565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480613a0857613a08615833565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055613a50565b80613a4881615849565b915050613900565b505b8284600101541015613a645785613a7f565b85838560010154613a7591906154bd565b613a7f9190615667565b60018501556001600160601b03871660009081526003808601602052604091829020889055549051631166238b60e21b81526001600160a01b03909116906345988e2c90613ad5908b908b908b906004016157e8565b600060405180830381600087803b158015613aef57600080fd5b505af1158015613b03573d6000803e3d6000fd5b5050604080516001600160601b038b168152602081018a90526001600160a01b038c1693507f4732545d01e38980276a17e6d394f01577ba63f2fea5eba41af0757d9c060c5c92500160405180910390a2506001979650505050505050565b806004846001600160601b031681548110613b7f57613b7f615478565b60009182526020808320868452600c92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b6000806006836000015181548110613c0457613c04615478565b90600052602060002090600402019050600081600301846020015181548110613c2f57613c2f615478565b90600052602060002090600b0201905060006005826000015481548110613c5857613c58615478565b600091825260208083206005929092029091016002015487519188015160a0890151604051634fe264fb60e01b81526004810194909452602484019190915260448301526001600160a01b031692508290634fe264fb90606401602060405180830381865afa158015613ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cf3919061567a565b9050612710811115613d0457506127105b6000612710613d1383826154bd565b8560010154613d2291906155ee565b613d2c919061561b565b90508087608001818151613d409190615667565b90525060a0870151600685018054600092908110613d6057613d60615478565b60009182526020808320909101546001600160a01b0316808352600790915260408220600201805491935084929091613d9a9084906154bd565b90915550506001600160a01b0381166000908152600760205260409020600101548211613df7576001600160a01b03811660009081526007602052604081206001018054849290613dec9084906154bd565b90915550613e149050565b6001600160a01b0381166000908152600760205260408120600101555b602088015188516001600160a01b0383167f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e786613e5087615860565b60098b0154604051613e729392916000916001600160a01b039091169061587c565b60405180910390a48751602089015160a08a015160405163ba66fde760e01b81526004810193909352602483019190915260448201526001600160a01b0385169063ba66fde790606401602060405180830381865afa158015613ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efd91906154d0565b613f615760035460405163b5d69e9960e01b81526001600160a01b0383811660048301529091169063b5d69e9990602401600060405180830381600087803b158015613f4857600080fd5b505af1158015613f5c573d6000803e3d6000fd5b505050505b60018860600151613f7291906154bd565b8860a00151148015613f8657506040880151155b156140775760098501546001600160a01b0316613fcf576000805460028701546040516001600160a01b039092169281156108fc029290818181858888f1935050505050613ff6565b60005460028601546009870154613ff4926001600160a01b0391821692911690614993565b505b6000546080890151600154614019926001600160a01b0391821692911690614993565b506020880151885160808a0151600288015460098901546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49361406e93909290916001600160a01b03909116906158a0565b60405180910390a35b505050608090940151949350505050565b600060068260000151815481106140a1576140a1615478565b906000526020600020906004020190506000816003018360200151815481106140cc576140cc615478565b90600052602060002090600b02019050600060058260000154815481106140f5576140f5615478565b906000526020600020906005020160020160009054906101000a90046001600160a01b031690506000816001600160a01b0316634fe264fb8660000151876020015188606001518960a0015161414b91906158bf565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401602060405180830381865afa158015614194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141b8919061567a565b90506127108111156141c957506127105b60008360060186606001518760a001516141e391906158bf565b815481106141f3576141f3615478565b600091825260208220015460018601546001600160a01b0390911692506127109061421f9085906155ee565b614229919061561b565b6001600160a01b0383166000908152600760205260408120600201805492935083929091906142599084906154bd565b90915550506001600160a01b038216600090815260076020526040812060010154900361429957600154614297906001600160a01b03168383614993565b505b60006127108489604001518a608001516142b3919061561b565b6142bd91906155ee565b6142c7919061561b565b9050808660080160008282546142dd9190615667565b925050819055506000612710858a6040015189600201546142fe919061561b565b61430891906155ee565b614312919061561b565b9050808760070160008282546143289190615667565b9091555050600154614344906001600160a01b03168584614993565b5060098701546001600160a01b0316614382576040516001600160a01b0385169082156108fc029083906000818181858888f193505050505061439d565b600987015461439b906001600160a01b03168583614993565b505b6020890151895160098901546040516001600160a01b03888116927f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e7926143ed928c928a928a929091169061587c565b60405180910390a460018960600151600261440891906155ee565b61441291906154bd565b8960a001510361453457600087600801548a6080015161443291906154bd565b905060008860070154896002015461444a91906154bd565b90508115158061445957508015155b156117b657811561448357600054600154614481916001600160a01b03918216911684614993565b505b80156144ea5760098901546001600160a01b03166144c957600080546040516001600160a01b039091169183156108fc02918491818181858888f19350505050506144ea565b60005460098a01546144e8916001600160a01b03918216911683614993565b505b60208b01518b5160098b01546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49161266391879187916001600160a01b03909116906158a0565b505050505050505050565b600080600061454d8661490c565b92505091506004826001600160601b03168154811061456e5761456e615478565b60009182526020808320848452600a600c90930201919091019052604090205460ff166145ae5760405163b34eb75d60e01b815260040160405180910390fd5b600680546001810182556000918252600160601b33026001600160601b03851617600482027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101918255427ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190910155600580549296509092918490811061463957614639615478565b600091825260208220600260059092020101548354600480546001600160a01b039093169450916001600160601b0390911690811061467a5761467a615478565b60009182526020808320600387018054600181018255908552918420600c909302019350600b0201906001600160a01b038a16156146c5576146c08a8460040154611286565b6146cb565b82600401545b90506146d7818a61561b565b6003808401919091558683558301546002840154612710916146f8916155ee565b614702919061561b565b6001830155600282018990556009820180546001600160a01b0319166001600160a01b038c81169190911790915560035460405163d09f392d60e01b8152600481018b90526000602482015291169063d09f392d90604401600060405180830381600087803b15801561477457600080fd5b505af1158015614788573d6000803e3d6000fd5b50505050836001600160a01b031663b6ede540898e8e86600301546040518563ffffffff1660e01b81526004016147c2949392919061579b565b600060405180830381600087803b1580156147dc57600080fd5b505af11580156147f0573d6000803e3d6000fd5b50506040513392508a91507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505050949350505050565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b1790525161489591906156b7565b6000604051808303816000865af19150503d80600081146148d2576040519150601f19603f3d011682016040523d82523d6000602084013e6148d7565b606091505b509150915081801561490157508051158061490157508080602001905181019061490191906154d0565b979650505050505050565b60008060006040845110614981575050506020810151604082015160608301516001600160601b038316158061494d57506004546001600160601b03841610155b1561495757600192505b8160000361496457600391505b80158061497357506005548110155b1561497c575060015b61498c565b506001915060039050815b9193909250565b6040516001600160a01b03838116602483015260448201839052600091829182919087169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052516149f091906156b7565b6000604051808303816000865af19150503d8060008114614a2d576040519150601f19603f3d011682016040523d82523d6000602084013e614a32565b606091505b50915091508180156134f05750805115806134f05750808060200190518101906134f091906154d0565b60405180608001604052806004906020820280368337509192915050565b8260048101928215614aa8579160200282015b82811115614aa8578251825591602001919060010190614a8d565b50614ab4929150614af2565b5090565b828054828255906000526020600020908101928215614aa85791602002820182811115614aa8578251825591602001919060010190614a8d565b5b80821115614ab45760008155600101614af3565b6001600160a01b0381168114614b1c57600080fd5b50565b600060208284031215614b3157600080fd5b81356127a981614b07565b80356001600160601b0381168114614b5357600080fd5b919050565b600080600060608486031215614b6d57600080fd5b8335614b7881614b07565b9250614b8660208501614b3c565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614bd457614bd4614b96565b604052919050565b600082601f830112614bed57600080fd5b813560206001600160401b03821115614c0857614c08614b96565b8160051b614c17828201614bac565b9283528481018201928281019087851115614c3157600080fd5b83870192505b8483101561490157823582529183019190830190614c37565b8015158114614b1c57600080fd5b600080600060608486031215614c7357600080fd5b614c7c84614b3c565b925060208401356001600160401b03811115614c9757600080fd5b614ca386828701614bdc565b9250506040840135614cb481614c50565b809150509250925092565b600060208284031215614cd157600080fd5b5035919050565b60008060408385031215614ceb57600080fd5b8235614cf681614b07565b946020939093013593505050565b600080600060608486031215614d1957600080fd5b505081359360208301359350604090920135919050565b600060208284031215614d4257600080fd5b6127a982614b3c565b8060005b6004811015610b83578151845260209384019390910190600101614d4f565b608081016112dc8284614d4b565b600081518084526020808501945080840160005b83811015614dac57815187529582019590820190600101614d90565b509495945050505050565b6020815260006127a96020830184614d7c565b6020808252825182820181905260009190848201906040850190845b81811015614e0b5783516001600160601b031683529284019291840191600101614de6565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b60058110614e4b57634e487b7160e01b600052602160045260246000fd5b9052565b6001600160601b03861681526001600160a01b038516602082015260a08101614e7b6040830186614e2d565b9215156060820152608001529392505050565b600082601f830112614e9f57600080fd5b81356001600160401b03811115614eb857614eb8614b96565b614ecb601f8201601f1916602001614bac565b818152846020838601011115614ee057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614f1257600080fd5b8335614f1d81614b07565b92506020840135915060408401356001600160401b03811115614f3f57600080fd5b614f4b86828701614e8e565b9150509250925092565b60008060408385031215614f6857600080fd5b614cf683614b3c565b60008060408385031215614f8457600080fd5b8235614f8f81614b07565b91506020830135614f9f81614c50565b809150509250929050565b600080600060608486031215614fbf57600080fd5b8335614fca81614b07565b925060208401356001600160401b0381168114614fe657600080fd5b9150604084013560ff81168114614cb457600080fd5b600082601f83011261500d57600080fd5b604051608081018181106001600160401b038211171561502f5761502f614b96565b60405280608084018581111561504457600080fd5b845b8181101561505e578035835260209283019201615046565b509195945050505050565b6000806000806000806000610140888a03121561508557600080fd5b61508e88614b3c565b9650602088013561509e81614c50565b955060408801359450606088013593506080880135925060a088013591506150c98960c08a01614ffc565b905092959891949750929550565b600080604083850312156150ea57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b83811015614dac5781516001600160a01b03168752958201959082019060010161510d565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516101608060e085015261518d6101808501836150f9565b60e086015161010086810191909152860151610120808701919091528601519092506101406151c6818701836001600160a01b03169052565b959095015193019290925250919050565b60008060008060008060008060006101808a8c0312156151f657600080fd5b6151ff8a614b3c565b985060208a013561520f81614c50565b975060408a0135965060608a0135955060808a0135945060a08a0135935061523a8b60c08c01614ffc565b92506101408a01356001600160401b038082111561525757600080fd5b6152638d838e01614e8e565b93506101608c013591508082111561527a57600080fd5b506152878c828d01614bdc565b9150509295985092959850929598565b600080604083850312156152aa57600080fd5b8235915060208301356001600160401b038111156152c757600080fd5b6152d385828601614e8e565b9150509250929050565b6000806000606084860312156152f257600080fd5b833592506020840135915060408401356001600160401b03811115614f3f57600080fd5b6000806040838503121561532957600080fd5b823561533481614b07565b915061534260208401614b3c565b90509250929050565b60008083601f84011261535d57600080fd5b5081356001600160401b0381111561537457600080fd5b60208301915083602082850101111561538c57600080fd5b9250929050565b6000806000604084860312156153a857600080fd5b83356001600160401b038111156153be57600080fd5b6153ca8682870161534b565b9094509250506020840135614cb481614b07565b6000806000806000608086880312156153f657600080fd5b8535945060208601356001600160401b0381111561541357600080fd5b61541f8882890161534b565b909550935050604086013561543381614b07565b949793965091946060013592915050565b60006020828403121561545657600080fd5b81356001600160401b0381111561546c57600080fd5b6112d884828501614e8e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016154b6576154b661548e565b5060010190565b818103818111156112dc576112dc61548e565b6000602082840312156154e257600080fd5b81516127a981614c50565b602081016112dc8284614e2d565b600181815b8085111561553657816000190482111561551c5761551c61548e565b8085161561552957918102915b93841c9390800290615500565b509250929050565b60008261554d575060016112dc565b8161555a575060006112dc565b8160018114615570576002811461557a57615596565b60019150506112dc565b60ff84111561558b5761558b61548e565b50506001821b6112dc565b5060208310610133831016604e8410600b84101617156155b9575081810a6112dc565b6155c383836154fb565b80600019048211156155d7576155d761548e565b029392505050565b60006127a960ff84168361553e565b80820281158282048414176112dc576112dc61548e565b634e487b7160e01b600052601260045260246000fd5b60008261562a5761562a615605565b500490565b60008060006060848603121561564457600080fd5b83519250602084015161565681614c50565b6040850151909250614cb481614c50565b808201808211156112dc576112dc61548e565b60006020828403121561568c57600080fd5b5051919050565b60005b838110156156ae578181015183820152602001615696565b50506000910152565b600082516156c9818460208701615693565b9190910192915050565b600061012082019050871515825286602083015285604083015284606083015283608083015261490160a0830184614d4b565b6000815180845261571e816020860160208601615693565b601f01601f19169290920160200192915050565b8281526040602082015260006131796040830184615706565b6000610140891515835288602084015287604084015286606084015285608084015261577a60a0840186614d4b565b8061012084015261578d81840185614d7c565b9a9950505050505050505050565b8481528360208201526080604082015260006157ba6080830185615706565b905082606083015295945050505050565b6000602082840312156157dd57600080fd5b81516127a981614b07565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b60006020828403121561582457600080fd5b8151600381106127a957600080fd5b634e487b7160e01b600052603160045260246000fd5b6000816158585761585861548e565b506000190190565b6000600160ff1b82016158755761587561548e565b5060000390565b938452602084019290925260408301526001600160a01b0316606082015260800190565b92835260208301919091526001600160a01b0316604082015260600190565b6000826158ce576158ce615605565b50069056fea2646970667358221220a1b7e777a928415490dfa579be6d77a94db9f9647aced4e284a65f692843b1d764736f6c63430008120033", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x3483FA1b87792cd5BE4100822C4eCEC8D3E531ee", + "0x0000000000000000000000000000000000000000", + "0x6394A70cADD1376FdE5C38bA331761256DDd03E2", + false, + [ + { + "type": "BigNumber", + "hex": "0x0ad78ebc5ac6200000" + }, + 10000, + { + "type": "BigNumber", + "hex": "0x016345785d8a0000" + }, + 256 + ], + [ + 0, + 0, + 0, + 10 + ], + "0x05", + "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E" + ] + }, + "implementation": "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", "devdoc": { - "events": { - "AcceptedFeeToken(address,bool)": { - "details": "To be emitted when an ERC20 token is added or removed as a method to pay fees.", - "params": { - "_accepted": "Whether the token is accepted or not.", - "_token": "The ERC20 token." - } - }, - "DisputeCreation(uint256,address)": { - "details": "To be emitted when a dispute is created.", - "params": { - "_arbitrable": "The contract which created the dispute.", - "_disputeID": "The identifier of the dispute in the Arbitrator contract." - } - }, - "NewCurrencyRate(address,uint64,uint8)": { - "details": "To be emitted when the fee for a particular ERC20 token is updated.", - "params": { - "_feeToken": "The ERC20 token.", - "_rateDecimals": "The new decimals of the fee token rate.", - "_rateInEth": "The new rate of the fee token in ETH." - } - }, - "Ruling(address,uint256,uint256)": { - "details": "To be raised when a ruling is given.", - "params": { - "_arbitrable": "The arbitrable receiving the ruling.", - "_disputeID": "The identifier of the dispute in the Arbitrator contract.", - "_ruling": "The ruling which was given." - } - } - }, + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "addNewDisputeKit(address,uint256)": { - "details": "Add a new supported dispute kit module to the court.", - "params": { - "_disputeKitAddress": "The address of the dispute kit contract.", - "_parent": "The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court." - } - }, - "appeal(uint256,uint256,bytes)": { - "details": "Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.", - "params": { - "_disputeID": "The ID of the dispute.", - "_extraData": "Extradata for the dispute. Can be required during court jump.", - "_numberOfChoices": "Number of choices for the dispute. Can be required during court jump." - } - }, - "appealCost(uint256)": { - "details": "Gets the cost of appealing a specified dispute.", - "params": { - "_disputeID": "The ID of the dispute." - }, - "returns": { - "cost": "The appeal cost." - } - }, - "appealPeriod(uint256)": { - "details": "Gets the start and the end of a specified dispute's current appeal period.", - "params": { - "_disputeID": "The ID of the dispute." - }, - "returns": { - "end": "The end of the appeal period.", - "start": "The start of the appeal period." - } - }, - "arbitrationCost(bytes)": { - "details": "Compute the cost of arbitration denominated in ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes)." - }, - "returns": { - "cost": "The arbitration cost in ETH." - } - }, - "arbitrationCost(bytes,address)": { - "details": "Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_feeToken": "The ERC20 token used to pay fees." - }, - "returns": { - "cost": "The arbitration cost in `_feeToken`." - } - }, - "changeAcceptedFeeTokens(address,bool)": { - "details": "Changes the supported fee tokens.", - "params": { - "_accepted": "Whether the token is supported or not as a method of fee payment.", - "_feeToken": "The fee token." - } - }, - "changeCurrencyRates(address,uint64,uint8)": { - "details": "Changes the currency rate of a fee token.", - "params": { - "_feeToken": "The fee token.", - "_rateDecimals": "The new decimals of the fee token rate.", - "_rateInEth": "The new rate of the fee token in ETH." - } - }, - "changeGovernor(address)": { - "details": "Changes the `governor` storage variable.", - "params": { - "_governor": "The new value for the `governor` storage variable." - } - }, - "changeJurorProsecutionModule(address)": { - "details": "Changes the `jurorProsecutionModule` storage variable.", - "params": { - "_jurorProsecutionModule": "The new value for the `jurorProsecutionModule` storage variable." - } - }, - "changePinakion(address)": { - "details": "Changes the `pinakion` storage variable.", - "params": { - "_pinakion": "The new value for the `pinakion` storage variable." - } - }, - "changeSortitionModule(address)": { - "details": "Changes the `_sortitionModule` storage variable. Note that the new module should be initialized for all courts.", - "params": { - "_sortitionModule": "The new value for the `sortitionModule` storage variable." - } - }, "constructor": { - "details": "Constructor.", - "params": { - "_courtParameters": "Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).", - "_disputeKit": "The address of the default dispute kit.", - "_governor": "The governor's address.", - "_hiddenVotes": "The `hiddenVotes` property value of the general court.", - "_jurorProsecutionModule": "The address of the juror prosecution module.", - "_pinakion": "The address of the token contract.", - "_sortitionExtraData": "The extra data for sortition module.", - "_sortitionModuleAddress": "The sortition module responsible for sortition of the jurors.", - "_timesPerPeriod": "The `timesPerPeriod` property value of the general court." - } - }, - "createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],bytes,uint256[])": { - "details": "Creates a court under a specified parent court.", - "params": { - "_alpha": "The `alpha` property value of the court.", - "_feeForJuror": "The `feeForJuror` property value of the court.", - "_hiddenVotes": "The `hiddenVotes` property value of the court.", - "_jurorsForCourtJump": "The `jurorsForCourtJump` property value of the court.", - "_minStake": "The `minStake` property value of the court.", - "_parent": "The `parent` property value of the court.", - "_sortitionExtraData": "Extra data for sortition module.", - "_supportedDisputeKits": "Indexes of dispute kits that this court will support.", - "_timesPerPeriod": "The `timesPerPeriod` property value of the court." - } - }, - "createDispute(uint256,bytes)": { - "details": "Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." - }, - "returns": { - "disputeID": "The identifier of the dispute created." - } - }, - "createDispute(uint256,bytes,address,uint256)": { - "details": "Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_feeAmount": "Amount of the ERC20 token used to pay fees.", - "_feeToken": "The ERC20 token used to pay fees.", - "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." - }, - "returns": { - "disputeID": "The identifier of the dispute created." - } - }, - "currentRuling(uint256)": { - "details": "Gets the current ruling of a specified dispute.", - "params": { - "_disputeID": "The ID of the dispute." - }, - "returns": { - "overridden": "Whether the ruling was overridden by appeal funding or not.", - "ruling": "The current ruling.", - "tied": "Whether it's a tie or not." - } - }, - "draw(uint256,uint256)": { - "details": "Draws jurors for the dispute. Can be called in parts.", - "params": { - "_disputeID": "The ID of the dispute.", - "_iterations": "The number of iterations to run." - } - }, - "enableDisputeKits(uint96,uint256[],bool)": { - "details": "Adds/removes court's support for specified dispute kits.", - "params": { - "_courtID": "The ID of the court.", - "_disputeKitIDs": "The IDs of dispute kits which support should be added/removed.", - "_enable": "Whether add or remove the dispute kits from the court." - } - }, - "execute(uint256,uint256,uint256)": { - "details": "Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.", - "params": { - "_disputeID": "The ID of the dispute.", - "_iterations": "The number of iterations to run.", - "_round": "The appeal round." - } - }, - "executeGovernorProposal(address,uint256,bytes)": { - "details": "Allows the governor to call anything on behalf of the contract.", - "params": { - "_amount": "The value sent with the call.", - "_data": "The data sent with the call.", - "_destination": "The destination of the call." - } - }, - "executeRuling(uint256)": { - "details": "Executes a specified dispute's ruling.", - "params": { - "_disputeID": "The ID of the dispute." - } - }, - "getDisputeKit(uint256)": { - "details": "Gets the dispute kit for a specific `_disputeKitID`.", - "params": { - "_disputeKitID": "The ID of the dispute kit." - } - }, - "getDisputeKitChildren(uint256)": { - "details": "Gets non-primitive properties of a specified dispute kit node.", - "params": { - "_disputeKitID": "The ID of the dispute kit." - }, - "returns": { - "_0": "children Indexes of children of this DK." - } - }, - "getJurorCourtIDs(address)": { - "details": "Gets the court identifiers where a specific `_juror` has staked.", - "params": { - "_juror": "The address of the juror." - } - }, - "getNumberOfVotes(uint256)": { - "details": "Gets the number of votes permitted for the specified dispute in the latest round.", - "params": { - "_disputeID": "The ID of the dispute." - } - }, - "getTimesPerPeriod(uint96)": { - "details": "Gets the timesPerPeriod array for a given court.", - "params": { - "_courtID": "The ID of the court to get the times from." - }, - "returns": { - "timesPerPeriod": "The timesPerPeriod array for the given court." - } - }, - "isDisputeKitJumping(uint256)": { - "details": "Returns true if the dispute kit will be switched to a parent DK.", - "params": { - "_disputeID": "The ID of the dispute." - }, - "returns": { - "_0": "Whether DK will be switched or not." - } - }, - "passPeriod(uint256)": { - "details": "Passes the period of a specified dispute.", - "params": { - "_disputeID": "The ID of the dispute." - } - }, - "setStake(uint96,uint256)": { - "details": "Sets the caller's stake in a court.", - "params": { - "_courtID": "The ID of the court.", - "_newStake": "The new stake." - } + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" } }, - "title": "KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.", + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -2293,566 +2062,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 3043, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 3046, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "pinakion", - "offset": 0, - "slot": "1", - "type": "t_contract(IERC20)1042" - }, - { - "astId": 3048, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "jurorProsecutionModule", - "offset": 0, - "slot": "2", - "type": "t_address" - }, - { - "astId": 3051, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "sortitionModule", - "offset": 0, - "slot": "3", - "type": "t_contract(ISortitionModule)15653" - }, - { - "astId": 3055, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "courts", - "offset": 0, - "slot": "4", - "type": "t_array(t_struct(Court)2914_storage)dyn_storage" - }, - { - "astId": 3059, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disputeKitNodes", - "offset": 0, - "slot": "5", - "type": "t_array(t_struct(DisputeKitNode)2981_storage)dyn_storage" - }, - { - "astId": 3063, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disputes", - "offset": 0, - "slot": "6", - "type": "t_array(t_struct(Dispute)2931_storage)dyn_storage" - }, - { - "astId": 3068, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "jurors", - "offset": 0, - "slot": "7", - "type": "t_mapping(t_address,t_struct(Juror)2968_storage)" - }, - { - "astId": 3074, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "currencyRates", - "offset": 0, - "slot": "8", - "type": "t_mapping(t_contract(IERC20)1042,t_struct(CurrencyRate)3001_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_address)dyn_storage": { - "base": "t_address", - "encoding": "dynamic_array", - "label": "address[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(Court)2914_storage)dyn_storage": { - "base": "t_struct(Court)2914_storage", - "encoding": "dynamic_array", - "label": "struct KlerosCore.Court[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(Dispute)2931_storage)dyn_storage": { - "base": "t_struct(Dispute)2931_storage", - "encoding": "dynamic_array", - "label": "struct KlerosCore.Dispute[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(DisputeKitNode)2981_storage)dyn_storage": { - "base": "t_struct(DisputeKitNode)2981_storage", - "encoding": "dynamic_array", - "label": "struct KlerosCore.DisputeKitNode[]", - "numberOfBytes": "32" - }, - "t_array(t_struct(Round)2956_storage)dyn_storage": { - "base": "t_struct(Round)2956_storage", - "encoding": "dynamic_array", - "label": "struct KlerosCore.Round[]", - "numberOfBytes": "32" - }, - "t_array(t_uint256)4_storage": { - "base": "t_uint256", - "encoding": "inplace", - "label": "uint256[4]", - "numberOfBytes": "128" - }, - "t_array(t_uint256)dyn_storage": { - "base": "t_uint256", - "encoding": "dynamic_array", - "label": "uint256[]", - "numberOfBytes": "32" - }, - "t_array(t_uint96)dyn_storage": { - "base": "t_uint96", - "encoding": "dynamic_array", - "label": "uint96[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(IArbitrableV2)15295": { - "encoding": "inplace", - "label": "contract IArbitrableV2", - "numberOfBytes": "20" - }, - "t_contract(IDisputeKit)15534": { - "encoding": "inplace", - "label": "contract IDisputeKit", - "numberOfBytes": "20" - }, - "t_contract(IERC20)1042": { - "encoding": "inplace", - "label": "contract IERC20", - "numberOfBytes": "20" - }, - "t_contract(ISortitionModule)15653": { - "encoding": "inplace", - "label": "contract ISortitionModule", - "numberOfBytes": "20" - }, - "t_enum(Period)2888": { - "encoding": "inplace", - "label": "enum KlerosCore.Period", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_struct(Juror)2968_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct KlerosCore.Juror)", - "numberOfBytes": "32", - "value": "t_struct(Juror)2968_storage" - }, - "t_mapping(t_contract(IERC20)1042,t_struct(CurrencyRate)3001_storage)": { - "encoding": "mapping", - "key": "t_contract(IERC20)1042", - "label": "mapping(contract IERC20 => struct KlerosCore.CurrencyRate)", - "numberOfBytes": "32", - "value": "t_struct(CurrencyRate)3001_storage" - }, - "t_mapping(t_uint256,t_bool)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_uint96,t_uint256)": { - "encoding": "mapping", - "key": "t_uint96", - "label": "mapping(uint96 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(Court)2914_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.Court", - "members": [ - { - "astId": 2890, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "parent", - "offset": 0, - "slot": "0", - "type": "t_uint96" - }, - { - "astId": 2892, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "hiddenVotes", - "offset": 12, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 2895, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "children", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 2897, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "minStake", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2899, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "alpha", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 2901, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "feeForJuror", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 2903, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "jurorsForCourtJump", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 2907, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "timesPerPeriod", - "offset": 0, - "slot": "6", - "type": "t_array(t_uint256)4_storage" - }, - { - "astId": 2911, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "supportedDisputeKits", - "offset": 0, - "slot": "10", - "type": "t_mapping(t_uint256,t_bool)" - }, - { - "astId": 2913, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disabled", - "offset": 0, - "slot": "11", - "type": "t_bool" - } - ], - "numberOfBytes": "384" - }, - "t_struct(CurrencyRate)3001_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.CurrencyRate", - "members": [ - { - "astId": 2996, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "feePaymentAccepted", - "offset": 0, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 2998, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "rateInEth", - "offset": 1, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 3000, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "rateDecimals", - "offset": 9, - "slot": "0", - "type": "t_uint8" - } - ], - "numberOfBytes": "32" - }, - "t_struct(Dispute)2931_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.Dispute", - "members": [ - { - "astId": 2916, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "courtID", - "offset": 0, - "slot": "0", - "type": "t_uint96" - }, - { - "astId": 2919, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "arbitrated", - "offset": 12, - "slot": "0", - "type": "t_contract(IArbitrableV2)15295" - }, - { - "astId": 2922, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "period", - "offset": 0, - "slot": "1", - "type": "t_enum(Period)2888" - }, - { - "astId": 2924, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "ruled", - "offset": 1, - "slot": "1", - "type": "t_bool" - }, - { - "astId": 2926, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "lastPeriodChange", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2930, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "rounds", - "offset": 0, - "slot": "3", - "type": "t_array(t_struct(Round)2956_storage)dyn_storage" - } - ], - "numberOfBytes": "128" - }, - "t_struct(DisputeKitNode)2981_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.DisputeKitNode", - "members": [ - { - "astId": 2970, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "parent", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 2973, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "children", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 2976, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disputeKit", - "offset": 0, - "slot": "2", - "type": "t_contract(IDisputeKit)15534" - }, - { - "astId": 2978, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "depthLevel", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 2980, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disabled", - "offset": 0, - "slot": "4", - "type": "t_bool" - } - ], - "numberOfBytes": "160" - }, - "t_struct(Juror)2968_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.Juror", - "members": [ - { - "astId": 2959, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "courtIDs", - "offset": 0, - "slot": "0", - "type": "t_array(t_uint96)dyn_storage" - }, - { - "astId": 2961, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "stakedPnk", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 2963, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "lockedPnk", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2967, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "stakedPnkByCourt", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_uint96,t_uint256)" - } - ], - "numberOfBytes": "128" - }, - "t_struct(Round)2956_storage": { - "encoding": "inplace", - "label": "struct KlerosCore.Round", - "members": [ - { - "astId": 2933, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "disputeKitID", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 2935, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "pnkAtStakePerJuror", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 2937, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "totalFeesForJurors", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2939, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "nbVotes", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 2941, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "repartitions", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 2943, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "pnkPenalties", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 2946, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "drawnJurors", - "offset": 0, - "slot": "6", - "type": "t_array(t_address)dyn_storage" - }, - { - "astId": 2948, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "sumFeeRewardPaid", - "offset": 0, - "slot": "7", - "type": "t_uint256" - }, - { - "astId": 2950, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "sumPnkRewardPaid", - "offset": 0, - "slot": "8", - "type": "t_uint256" - }, - { - "astId": 2953, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "feeToken", - "offset": 0, - "slot": "9", - "type": "t_contract(IERC20)1042" - }, - { - "astId": 2955, - "contract": "src/arbitration/KlerosCore.sol:KlerosCore", - "label": "drawIterations", - "offset": 0, - "slot": "10", - "type": "t_uint256" - } - ], - "numberOfBytes": "352" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint8": { - "encoding": "inplace", - "label": "uint8", - "numberOfBytes": "1" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Implementation.json new file mode 100644 index 000000000..93cc53118 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Implementation.json @@ -0,0 +1,2860 @@ +{ + "address": "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "AppealFeesNotEnough", + "type": "error" + }, + { + "inputs": [], + "name": "AppealPeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "ArbitrationFeesNotEnough", + "type": "error" + }, + { + "inputs": [], + "name": "ArraysLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "CannotDisableRootDKInGeneral", + "type": "error" + }, + { + "inputs": [], + "name": "CommitPeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "DepthLevelMax", + "type": "error" + }, + { + "inputs": [], + "name": "DisputeKitNotSupportedByCourt", + "type": "error" + }, + { + "inputs": [], + "name": "DisputeKitOnly", + "type": "error" + }, + { + "inputs": [], + "name": "DisputeNotAppealable", + "type": "error" + }, + { + "inputs": [], + "name": "DisputePeriodIsFinal", + "type": "error" + }, + { + "inputs": [], + "name": "DisputeStillDrawing", + "type": "error" + }, + { + "inputs": [], + "name": "EvidenceNotPassedAndNotAppeal", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [], + "name": "GovernorOnly", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDisputKitParent", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidForkingCourtAsParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "MinStakeLowerThanParentCourt", + "type": "error" + }, + { + "inputs": [], + "name": "NotEvidencePeriod", + "type": "error" + }, + { + "inputs": [], + "name": "NotExecutionPeriod", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "RulingAlreadyExecuted", + "type": "error" + }, + { + "inputs": [], + "name": "StakingFailed", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotAccepted", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "inputs": [], + "name": "UnsuccessfulCall", + "type": "error" + }, + { + "inputs": [], + "name": "UnsupportedDisputeKit", + "type": "error" + }, + { + "inputs": [], + "name": "VotePeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "WrongCaller", + "type": "error" + }, + { + "inputs": [], + "name": "WrongDisputeKitIndex", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "_accepted", + "type": "bool" + } + ], + "name": "AcceptedFeeToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "AppealDecision", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "AppealPossible", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_courtID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint96", + "name": "_parent", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "_supportedDisputeKits", + "type": "uint256[]" + } + ], + "name": "CourtCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint96", + "name": "_fromCourtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "_toCourtID", + "type": "uint96" + } + ], + "name": "CourtJump", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + } + ], + "name": "CourtModified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IDisputeKit", + "name": "_disputeKitAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_parent", + "type": "uint256" + } + ], + "name": "DisputeKitCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bool", + "name": "_enable", + "type": "bool" + } + ], + "name": "DisputeKitEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_fromDisputeKitID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toDisputeKitID", + "type": "uint256" + } + ], + "name": "DisputeKitJump", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "Draw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_pnkAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + } + ], + "name": "LeftoverRewardSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_rateInEth", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "_rateDecimals", + "type": "uint8" + } + ], + "name": "NewCurrencyRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum KlerosCore.Period", + "name": "_period", + "type": "uint8" + } + ], + "name": "NewPeriod", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_courtID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "StakeDelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_courtID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "StakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_degreeOfCoherency", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "_pnkAmount", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "_feeAmount", + "type": "int256" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + } + ], + "name": "TokenAndETHShift", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IDisputeKit", + "name": "_disputeKitAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_parent", + "type": "uint256" + } + ], + "name": "addNewDisputeKit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "appeal", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "appealCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "appealPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_accepted", + "type": "bool" + } + ], + "name": "changeAcceptedFeeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + } + ], + "name": "changeCourtParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + }, + { + "internalType": "uint64", + "name": "_rateInEth", + "type": "uint64" + }, + { + "internalType": "uint8", + "name": "_rateDecimals", + "type": "uint8" + } + ], + "name": "changeCurrencyRates", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_jurorProsecutionModule", + "type": "address" + } + ], + "name": "changeJurorProsecutionModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_pinakion", + "type": "address" + } + ], + "name": "changePinakion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ISortitionModule", + "name": "_sortitionModule", + "type": "address" + } + ], + "name": "changeSortitionModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_toToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountInEth", + "type": "uint256" + } + ], + "name": "convertEthToTokenAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "courts", + "outputs": [ + { + "internalType": "uint96", + "name": "parent", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "minStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "alpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeForJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jurorsForCourtJump", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "disabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_parent", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "internalType": "bytes", + "name": "_sortitionExtraData", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "_supportedDisputeKits", + "type": "uint256[]" + } + ], + "name": "createCourt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_feeAmount", + "type": "uint256" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "name": "currencyRates", + "outputs": [ + { + "internalType": "bool", + "name": "feePaymentAccepted", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "rateInEth", + "type": "uint64" + }, + { + "internalType": "uint8", + "name": "rateDecimals", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "currentRuling", + "outputs": [ + { + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + }, + { + "internalType": "bool", + "name": "overridden", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputeKitNodes", + "outputs": [ + { + "internalType": "uint256", + "name": "parent", + "type": "uint256" + }, + { + "internalType": "contract IDisputeKit", + "name": "disputeKit", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depthLevel", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "disabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "uint96", + "name": "courtID", + "type": "uint96" + }, + { + "internalType": "contract IArbitrableV2", + "name": "arbitrated", + "type": "address" + }, + { + "internalType": "enum KlerosCore.Period", + "name": "period", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "ruled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "lastPeriodChange", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_iterations", + "type": "uint256" + } + ], + "name": "draw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256[]", + "name": "_disputeKitIDs", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "_enable", + "type": "bool" + } + ], + "name": "enableDisputeKits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_iterations", + "type": "uint256" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_destination", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "executeGovernorProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "executeRuling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + } + ], + "name": "getDisputeKit", + "outputs": [ + { + "internalType": "contract IDisputeKit", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + } + ], + "name": "getDisputeKitChildren", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDisputeKitNodesLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_juror", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + } + ], + "name": "getJurorBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "totalStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalLocked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakedInCourt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nbCourts", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_juror", + "type": "address" + } + ], + "name": "getJurorCourtIDs", + "outputs": [ + { + "internalType": "uint96[]", + "name": "", + "type": "uint96[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "getNumberOfRounds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "getNumberOfVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "getRoundInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "disputeKitID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pnkAtStakePerJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalFeesForJurors", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nbVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "repartitions", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pnkPenalties", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "drawnJurors", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "sumFeeRewardPaid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sumPnkRewardPaid", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "feeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "drawIterations", + "type": "uint256" + } + ], + "internalType": "struct KlerosCore.Round", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + } + ], + "name": "getTimesPerPeriod", + "outputs": [ + { + "internalType": "uint256[4]", + "name": "timesPerPeriod", + "type": "uint256[4]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_pinakion", + "type": "address" + }, + { + "internalType": "address", + "name": "_jurorProsecutionModule", + "type": "address" + }, + { + "internalType": "contract IDisputeKit", + "name": "_disputeKit", + "type": "address" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "_courtParameters", + "type": "uint256[4]" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "internalType": "bytes", + "name": "_sortitionExtraData", + "type": "bytes" + }, + { + "internalType": "contract ISortitionModule", + "name": "_sortitionModuleAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "isDisputeKitJumping", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + } + ], + "name": "isSupported", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "jurorProsecutionModule", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "passPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pinakion", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_newStake", + "type": "uint256" + } + ], + "name": "setStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_newStake", + "type": "uint256" + } + ], + "name": "setStakeBySortitionModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sortitionModule", + "outputs": [ + { + "internalType": "contract ISortitionModule", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x35655a3781f52eb135258161e27fb6e032ad5ad9953af3068a8bf48148ac3a14", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", + "transactionIndex": 3, + "gasUsed": "5334528", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1421f334b720c5c29d7db683b7f0d3fc60012a0c26f78ee592e3f1b8c0db3b4c", + "transactionHash": "0x35655a3781f52eb135258161e27fb6e032ad5ad9953af3068a8bf48148ac3a14", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 43823776, + "transactionHash": "0x35655a3781f52eb135258161e27fb6e032ad5ad9953af3068a8bf48148ac3a14", + "address": "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 9, + "blockHash": "0x1421f334b720c5c29d7db683b7f0d3fc60012a0c26f78ee592e3f1b8c0db3b4c" + } + ], + "blockNumber": 43823776, + "cumulativeGasUsed": "5985475", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "f16a94d75c83e5f4618a2f6097a17dcc", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AppealFeesNotEnough\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AppealPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ArbitrationFeesNotEnough\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ArraysLengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotDisableRootDKInGeneral\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CommitPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DepthLevelMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeKitNotSupportedByCourt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeKitOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeNotAppealable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodIsFinal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputeStillDrawing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EvidenceNotPassedAndNotAppeal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GovernorOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDisputKitParent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidForkingCourtAsParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinStakeLowerThanParentCourt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEvidencePeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotExecutionPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RulingAlreadyExecuted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StakingFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotAccepted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsuccessfulCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsupportedDisputeKit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VotePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WrongCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WrongDisputeKitIndex\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"AcceptedFeeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealDecision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealPossible\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"CourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromCourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toCourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"CourtModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"DisputeKitCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"DisputeKitEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_fromDisputeKitID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_toDisputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"Draw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_pnkAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"LeftoverRewardSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"NewCurrencyRate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum KlerosCore.Period\",\"name\":\"_period\",\"type\":\"uint8\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"StakeDelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"StakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_degreeOfCoherency\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_pnkAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_feeAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"TokenAndETHShift\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"addNewDisputeKit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"appeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"changeAcceptedFeeTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"changeCourtParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"changeCurrencyRates\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"}],\"name\":\"changeJurorProsecutionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"}],\"name\":\"changePinakion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ISortitionModule\",\"name\":\"_sortitionModule\",\"type\":\"address\"}],\"name\":\"changeSortitionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amountInEth\",\"type\":\"uint256\"}],\"name\":\"convertEthToTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"courts\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"disabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"bytes\",\"name\":\"_sortitionExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"createCourt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_feeAmount\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"currencyRates\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"feePaymentAccepted\",\"type\":\"bool\"},{\"internalType\":\"uint64\",\"name\":\"rateInEth\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"rateDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeKitNodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"parent\",\"type\":\"uint256\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"disputeKit\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depthLevel\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"disabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"contract IArbitrableV2\",\"name\":\"arbitrated\",\"type\":\"address\"},{\"internalType\":\"enum KlerosCore.Period\",\"name\":\"period\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lastPeriodChange\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[]\",\"name\":\"_disputeKitIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"enableDisputeKits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"executeRuling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKit\",\"outputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKitChildren\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputeKitNodesLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalLocked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakedInCourt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbCourts\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"}],\"name\":\"getJurorCourtIDs\",\"outputs\":[{\"internalType\":\"uint96[]\",\"name\":\"\",\"type\":\"uint96[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfRounds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"disputeKitID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pnkAtStakePerJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeesForJurors\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repartitions\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"pnkPenalties\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"drawnJurors\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"sumFeeRewardPaid\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sumPnkRewardPaid\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"drawIterations\",\"type\":\"uint256\"}],\"internalType\":\"struct KlerosCore.Round\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getTimesPerPeriod\",\"outputs\":[{\"internalType\":\"uint256[4]\",\"name\":\"timesPerPeriod\",\"type\":\"uint256[4]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKit\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256[4]\",\"name\":\"_courtParameters\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"bytes\",\"name\":\"_sortitionExtraData\",\"type\":\"bytes\"},{\"internalType\":\"contract ISortitionModule\",\"name\":\"_sortitionModuleAddress\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"isDisputeKitJumping\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"isSupported\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jurorProsecutionModule\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"passPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pinakion\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_newStake\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_newStake\",\"type\":\"uint256\"}],\"name\":\"setStakeBySortitionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sortitionModule\",\"outputs\":[{\"internalType\":\"contract ISortitionModule\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"AcceptedFeeToken(address,bool)\":{\"details\":\"To be emitted when an ERC20 token is added or removed as a method to pay fees.\",\"params\":{\"_accepted\":\"Whether the token is accepted or not.\",\"_token\":\"The ERC20 token.\"}},\"DisputeCreation(uint256,address)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_arbitrable\":\"The contract which created the dispute.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\"}},\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"NewCurrencyRate(address,uint64,uint8)\":{\"details\":\"To be emitted when the fee for a particular ERC20 token is updated.\",\"params\":{\"_feeToken\":\"The ERC20 token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrable\":\"The arbitrable receiving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"addNewDisputeKit(address,uint256)\":{\"details\":\"Add a new supported dispute kit module to the court.\",\"params\":{\"_disputeKitAddress\":\"The address of the dispute kit contract.\",\"_parent\":\"The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court.\"}},\"appeal(uint256,uint256,bytes)\":{\"details\":\"Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_extraData\":\"Extradata for the dispute. Can be required during court jump.\",\"_numberOfChoices\":\"Number of choices for the dispute. Can be required during court jump.\"}},\"appealCost(uint256)\":{\"details\":\"Gets the cost of appealing a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"cost\":\"The appeal cost.\"}},\"appealPeriod(uint256)\":{\"details\":\"Gets the start and the end of a specified dispute's current appeal period.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"end\":\"The end of the appeal period.\",\"start\":\"The start of the appeal period.\"}},\"arbitrationCost(bytes)\":{\"details\":\"Compute the cost of arbitration denominated in ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost in ETH.\"}},\"arbitrationCost(bytes,address)\":{\"details\":\"Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeToken\":\"The ERC20 token used to pay fees.\"},\"returns\":{\"cost\":\"The arbitration cost in `_feeToken`.\"}},\"changeAcceptedFeeTokens(address,bool)\":{\"details\":\"Changes the supported fee tokens.\",\"params\":{\"_accepted\":\"Whether the token is supported or not as a method of fee payment.\",\"_feeToken\":\"The fee token.\"}},\"changeCurrencyRates(address,uint64,uint8)\":{\"details\":\"Changes the currency rate of a fee token.\",\"params\":{\"_feeToken\":\"The fee token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeJurorProsecutionModule(address)\":{\"details\":\"Changes the `jurorProsecutionModule` storage variable.\",\"params\":{\"_jurorProsecutionModule\":\"The new value for the `jurorProsecutionModule` storage variable.\"}},\"changePinakion(address)\":{\"details\":\"Changes the `pinakion` storage variable.\",\"params\":{\"_pinakion\":\"The new value for the `pinakion` storage variable.\"}},\"changeSortitionModule(address)\":{\"details\":\"Changes the `_sortitionModule` storage variable. Note that the new module should be initialized for all courts.\",\"params\":{\"_sortitionModule\":\"The new value for the `sortitionModule` storage variable.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],bytes,uint256[])\":{\"details\":\"Creates a court under a specified parent court.\",\"params\":{\"_alpha\":\"The `alpha` property value of the court.\",\"_feeForJuror\":\"The `feeForJuror` property value of the court.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the court.\",\"_jurorsForCourtJump\":\"The `jurorsForCourtJump` property value of the court.\",\"_minStake\":\"The `minStake` property value of the court.\",\"_parent\":\"The `parent` property value of the court.\",\"_sortitionExtraData\":\"Extra data for sortition module.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this court will support.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the court.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"createDispute(uint256,bytes,address,uint256)\":{\"details\":\"Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeAmount\":\"Amount of the ERC20 token used to pay fees.\",\"_feeToken\":\"The ERC20 token used to pay fees.\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws jurors for the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\"}},\"enableDisputeKits(uint96,uint256[],bool)\":{\"details\":\"Adds/removes court's support for specified dispute kits.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the court.\"}},\"execute(uint256,uint256,uint256)\":{\"details\":\"Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\",\"_round\":\"The appeal round.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"executeRuling(uint256)\":{\"details\":\"Executes a specified dispute's ruling.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getDisputeKit(uint256)\":{\"details\":\"Gets the dispute kit for a specific `_disputeKitID`.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"}},\"getDisputeKitChildren(uint256)\":{\"details\":\"Gets non-primitive properties of a specified dispute kit node.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"},\"returns\":{\"_0\":\"children Indexes of children of this DK.\"}},\"getJurorCourtIDs(address)\":{\"details\":\"Gets the court identifiers where a specific `_juror` has staked.\",\"params\":{\"_juror\":\"The address of the juror.\"}},\"getNumberOfVotes(uint256)\":{\"details\":\"Gets the number of votes permitted for the specified dispute in the latest round.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getTimesPerPeriod(uint96)\":{\"details\":\"Gets the timesPerPeriod array for a given court.\",\"params\":{\"_courtID\":\"The ID of the court to get the times from.\"},\"returns\":{\"timesPerPeriod\":\"The timesPerPeriod array for the given court.\"}},\"initialize(address,address,address,address,bool,uint256[4],uint256[4],bytes,address)\":{\"details\":\"Initializer (constructor equivalent for upgradable contracts).\",\"params\":{\"_courtParameters\":\"Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\",\"_disputeKit\":\"The address of the default dispute kit.\",\"_governor\":\"The governor's address.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the general court.\",\"_jurorProsecutionModule\":\"The address of the juror prosecution module.\",\"_pinakion\":\"The address of the token contract.\",\"_sortitionExtraData\":\"The extra data for sortition module.\",\"_sortitionModuleAddress\":\"The sortition module responsible for sortition of the jurors.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the general court.\"}},\"isDisputeKitJumping(uint256)\":{\"details\":\"Returns true if the dispute kit will be switched to a parent DK.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"_0\":\"Whether DK will be switched or not.\"}},\"passPeriod(uint256)\":{\"details\":\"Passes the period of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"setStake(uint96,uint256)\":{\"details\":\"Sets the caller's stake in a court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_newStake\":\"The new stake.\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}}},\"title\":\"KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/KlerosCore.sol\":\"KlerosCore\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\nimport \\\"../libraries/Constants.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 private constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 private constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 private constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 private constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer (constructor equivalent for upgradable contracts).\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n function initialize(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) external initializer {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: Constants.NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(Constants.DISPUTE_KIT_CLASSIC, _disputeKit, Constants.NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(Constants.FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = Constants.FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(Constants.GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(Constants.GENERAL_COURT, Constants.DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /* @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != Constants.NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == Constants.NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(Constants.GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == Constants.FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n if (_courtID != Constants.GENERAL_COURT && courts[court.parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < court.children.length; i++) {\\n if (courts[court.children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n court.minStake = _minStake;\\n court.hiddenVotes = _hiddenVotes;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (\\n _courtID == Constants.GENERAL_COURT &&\\n disputeKitNodes[_disputeKitIDs[i]].parent == Constants.NULL_DISPUTE_KIT\\n ) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n currencyRates[_feeToken].rateInEth = _rateInEth;\\n currencyRates[_feeToken].rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n if (!_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount)) revert TransferFailed();\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != Constants.NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = Constants.GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == Constants.GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n timesPerPeriod = courts[_courtID].timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n return (_amountInEth * 10 ** currencyRates[_toToken].rateDecimals) / currencyRates[_toToken].rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == Constants.FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == Constants.FORKING_COURT || courtID >= courts.length) {\\n courtID = Constants.GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == Constants.NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = Constants.GENERAL_COURT;\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n error TransferFailed();\\n}\\n\",\"keccak256\":\"0x48e2706b2e795f745b6abc247c2ac9c8a789031f6b3a1fc3e195d48a7a06ef78\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n/// @title Constants\\nlibrary Constants {\\n // Courts\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n\\n // Dispute Kits\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n\\n // Defaults\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n}\\n\",\"keccak256\":\"0x0bc176ef4e0124e41a09f28f627a1b6458e06d17d65f4efa5f7de0d2f68ddc15\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000d9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff1615620000765760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b0390811614620000d65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051615f1262000103600039600081816117d90152818161180201526119f90152615f126000f3fe6080604052600436106102925760003560e01c80637934c0be1161015a578063c71f4253116100c1578063f12ada8b1161007a578063f12ada8b1461095f578063f6506db41461097f578063f7434ea91461099f578063fbf405b0146109bf578063fc6f8f16146109df578063fe524c39146109ff57600080fd5b8063c71f425314610841578063cf0c38f814610861578063d1c1df4814610881578063d2b8035a146108ff578063d98493f61461091f578063e4c0aaf41461093f57600080fd5b8063a072b86c11610113578063a072b86c14610786578063afe15cfb146107a6578063b0049637146107db578063c13517e1146107fb578063c258bb191461080e578063c35699021461082e57600080fd5b80637934c0be146106b957806382d02237146106d957806386541b24146106f95780638a9bb02a146107195780638bb0487514610746578063994b27af1461076657600080fd5b80632d29a47b116101fe578063543f8a36116101b7578063543f8a36146105e6578063564a565d1461061357806359ec827e146106445780635ea5c03814610664578063751accd0146106795780637717a6e81461069957600080fd5b80632d29a47b146105245780632e1daf2f146105445780633cfd11841461056457806343d4137f146105915780634f1ef286146105be57806352d1902d146105d157600080fd5b8063115d537611610250578063115d5376146103e85780631860592b146104085780631956b1f91461043657806319b81529146104565780631c3db16d146104865780631f5a0dd2146104c357600080fd5b8062f5822c146102975780630219da79146102b95780630761c14d146103315780630b7414bc146103515780630c340a24146103715780630d1b9d1a1461039e575b600080fd5b3480156102a357600080fd5b506102b76102b2366004614fe7565b610a1f565b005b3480156102c557600080fd5b506103046102d4366004614fe7565b60086020526000908152604090205460ff808216916001600160401b0361010082041691600160481b9091041683565b6040805193151584526001600160401b03909216602084015260ff16908201526060015b60405180910390f35b34801561033d57600080fd5b506102b761034c366004615020565b610a6c565b34801561035d57600080fd5b506102b761036c366004615126565b610aa8565b34801561037d57600080fd5b50600054610391906001600160a01b031681565b6040516103289190615187565b3480156103aa57600080fd5b506103be6103b936600461519b565b610c1d565b604080519485526001600160a01b0390931660208501529183015215156060820152608001610328565b3480156103f457600080fd5b506102b761040336600461519b565b610c63565b34801561041457600080fd5b506104286104233660046151b4565b6111a5565b604051908152602001610328565b34801561044257600080fd5b5061039161045136600461519b565b6111ff565b34801561046257600080fd5b5061047661047136600461519b565b611237565b6040519015158152602001610328565b34801561049257600080fd5b506104a66104a136600461519b565b611330565b604080519384529115156020840152151590820152606001610328565b3480156104cf57600080fd5b506104e36104de36600461519b565b611439565b604080516001600160601b0390981688529515156020880152948601939093526060850191909152608084015260a0830152151560c082015260e001610328565b34801561053057600080fd5b506102b761053f3660046151e0565b611498565b34801561055057600080fd5b50600354610391906001600160a01b031681565b34801561057057600080fd5b5061058461057f36600461520c565b6116e0565b604051610328919061524a565b34801561059d57600080fd5b506105b16105ac36600461519b565b61174b565b6040516103289190615293565b6102b76105cc366004615315565b6117c5565b3480156105dd57600080fd5b506104286119ec565b3480156105f257600080fd5b50610606610601366004614fe7565b611a4a565b6040516103289190615364565b34801561061f57600080fd5b5061063361062e36600461519b565b611ae6565b6040516103289594939291906153e9565b34801561065057600080fd5b5061042861065f36600461519b565b611b42565b34801561067057600080fd5b50600554610428565b34801561068557600080fd5b506102b7610694366004615428565b611c97565b3480156106a557600080fd5b506102b76106b4366004615480565b611d41565b3480156106c557600080fd5b506102b76106d436600461549c565b611d69565b3480156106e557600080fd5b506102b76106f43660046154d5565b611de8565b34801561070557600080fd5b506102b7610714366004615594565b611ea5565b34801561072557600080fd5b50610739610734366004615602565b61208c565b604051610328919061565d565b34801561075257600080fd5b506102b761076136600461519b565b612218565b34801561077257600080fd5b506102b7610781366004615702565b61237c565b34801561079257600080fd5b506102b76107a13660046157d6565b61280c565b3480156107b257600080fd5b506107c66107c136600461519b565b612b4b565b60408051928352602083019190915201610328565b3480156107e757600080fd5b506102b76107f6366004614fe7565b612bf7565b610428610809366004615896565b612c44565b34801561081a57600080fd5b506102b7610829366004614fe7565b612c7c565b6102b761083c3660046158c6565b612cc9565b34801561084d57600080fd5b5061042861085c36600461519b565b6132a2565b34801561086d57600080fd5b50600254610391906001600160a01b031681565b34801561088d57600080fd5b506108df61089c3660046158ff565b6001600160a01b039091166000908152600760209081526040808320600181015460028201546001600160601b0390961685526003820190935292205491549093565b604080519485526020850193909352918301526060820152608001610328565b34801561090b57600080fd5b506102b761091a366004615602565b61330a565b34801561092b57600080fd5b5061042861093a36600461597c565b6135f1565b34801561094b57600080fd5b506102b761095a366004614fe7565b61363e565b34801561096b57600080fd5b506102b761097a3660046151b4565b61368b565b34801561098b57600080fd5b5061042861099a3660046159c7565b6138ae565b3480156109ab57600080fd5b506104286109ba366004615a2d565b613992565b3480156109cb57600080fd5b50600154610391906001600160a01b031681565b3480156109eb57600080fd5b506104286109fa36600461519b565b6139de565b348015610a0b57600080fd5b50610476610a1a366004615480565b613a0d565b6000546001600160a01b03163314610a4a5760405163c383977560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314610a975760405163068690bf60e11b815260040160405180910390fd5b610aa2838383613a55565b50505050565b6000546001600160a01b03163314610ad35760405163c383977560e01b815260040160405180910390fd5b60005b8251811015610aa2578115610b7257828181518110610af757610af7615a61565b602002602001015160001480610b2a57506005548351849083908110610b1f57610b1f615a61565b602002602001015110155b15610b4857604051633d58a98960e11b815260040160405180910390fd5b610b6d84848381518110610b5e57610b5e615a61565b60200260200101516001613ffc565b610c0b565b6001600160601b0384166001148015610bc8575060006005848381518110610b9c57610b9c615a61565b602002602001015181548110610bb457610bb4615a61565b906000526020600020906005020160000154145b15610be657604051630c6e81c960e11b815260040160405180910390fd5b610c0b84848381518110610bfc57610bfc615a61565b60200260200101516000613ffc565b80610c1581615a8d565b915050610ad6565b60058181548110610c2d57600080fd5b600091825260209091206005909102018054600282015460038301546004909301549193506001600160a01b0316919060ff1684565b600060068281548110610c7857610c78615a61565b600091825260208220600491820201805482549194506001600160601b0316908110610ca657610ca6615a61565b6000918252602082206003850154600c909202019250610cc890600190615aa6565b90506000836003018281548110610ce157610ce1615a61565b600091825260208220600b909102019150600185015460ff166004811115610d0b57610d0b6153b1565b03610de65781158015610d5a57506001840154600684019060ff166004811115610d3757610d376153b1565b60048110610d4757610d47615a61565b01546002850154610d589042615aa6565b105b15610d7857604051633e9727df60e01b815260040160405180910390fd5b6003810154600682015414610da0576040516309e4486b60e41b815260040160405180910390fd5b8254600160601b900460ff16610db7576002610dba565b60015b60018086018054909160ff1990911690836004811115610ddc57610ddc6153b1565b0217905550611157565b60018085015460ff166004811115610e0057610e006153b1565b03610f18576001840154600684019060ff166004811115610e2357610e236153b1565b60048110610e3357610e33615a61565b01546002850154610e449042615aa6565b108015610ee357506005816000015481548110610e6357610e63615a61565b6000918252602090912060059091020160020154604051630baa64d160e01b8152600481018790526001600160a01b0390911690630baa64d190602401602060405180830381865afa158015610ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee19190615ab9565b155b15610f0157604051634dfa578560e11b815260040160405180910390fd5b6001808501805460029260ff199091169083610ddc565b6002600185015460ff166004811115610f3357610f336153b1565b03611089576001840154600684019060ff166004811115610f5657610f566153b1565b60048110610f6657610f66615a61565b01546002850154610f779042615aa6565b10801561101657506005816000015481548110610f9657610f96615a61565b60009182526020909120600590910201600201546040516336a66c7560e11b8152600481018790526001600160a01b0390911690636d4cd8ea90602401602060405180830381865afa158015610ff0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110149190615ab9565b155b1561103457604051631988dead60e31b815260040160405180910390fd5b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611157565b6003600185015460ff1660048111156110a4576110a46153b1565b0361111e576001840154600684019060ff1660048111156110c7576110c76153b1565b600481106110d7576110d7615a61565b015460028501546110e89042615aa6565b101561110757604051632f4dfd8760e01b815260040160405180910390fd5b6001808501805460049260ff199091169083610ddc565b6004600185015460ff166004811115611139576111396153b1565b03611157576040516307f38c8f60e11b815260040160405180910390fd5b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91916111969160ff1690615ad6565b60405180910390a25050505050565b6001600160a01b03821660009081526008602052604081205461010081046001600160401b0316906111e290600160481b900460ff16600a615bc8565b6111ec9084615bd7565b6111f69190615c04565b90505b92915050565b60006005828154811061121457611214615a61565b60009182526020909120600260059092020101546001600160a01b031692915050565b6000806006838154811061124d5761124d615a61565b600091825260208220600360049092020190810180549193509061127390600190615aa6565b8154811061128357611283615a61565b600091825260208220845460048054600b909402909201945090916001600160601b039091169081106112b8576112b8615a61565b90600052602060002090600c020190508060050154826003015410156112e357506000949350505050565b80546004805490916001600160601b031690811061130357611303615a61565b6000918252602080832094548352600a600c9092029094010190925250604090205460ff16159392505050565b6000806000806006858154811061134957611349615a61565b600091825260208220600360049092020190810180549193509061136f90600190615aa6565b8154811061137f5761137f615a61565b90600052602060002090600b02019050600060058260000154815481106113a8576113a8615a61565b6000918252602090912060059091020160020154604051631c3db16d60e01b8152600481018990526001600160a01b0390911691508190631c3db16d90602401606060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190615c18565b9199909850909650945050505050565b6004818154811061144957600080fd5b60009182526020909120600c9091020180546002820154600383015460048401546005850154600b909501546001600160601b038516965060ff600160601b9095048516959394929391921687565b6000600684815481106114ad576114ad615a61565b600091825260209091206004918202019150600182015460ff1660048111156114d8576114d86153b1565b146114f657604051638794ce4b60e01b815260040160405180910390fd5b600081600301848154811061150d5761150d615a61565b90600052602060002090600b020190506000600582600001548154811061153657611536615a61565b6000918252602082206002600590920201015460048401546001600160a01b039091169250906115668683615c50565b6005850154600686015460405163368efae360e21b8152600481018c9052602481018b905292935090916000906001600160a01b0387169063da3beb8c90604401602060405180830381865afa1580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e89190615c63565b90508060000361160357818411156115fe578193505b611623565b61160e826002615bd7565b84111561162357611620826002615bd7565b93505b60048701849055845b848110156116bf5782811015611678576116716040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614084565b93506116ad565b6116ad6040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614525565b806116b781615a8d565b91505061162c565b50828760050154146116d357600587018390555b5050505050505050505050565b6116e8614f27565b6004826001600160601b03168154811061170457611704615a61565b6000918252602090912060408051608081019182905292600c029091016006019060049082845b81548152602001906001019080831161172b575b50505050509050919050565b60606005828154811061176057611760615a61565b906000526020600020906005020160010180548060200260200160405190810160405280929190818152602001828054801561173f576020028201919060005260206000209081548152602001906001019080831161172b5750505050509050919050565b6117ce826149dc565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061184c57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611840600080516020615ebd8339815191525490565b6001600160a01b031614155b1561186a5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156118c4575060408051601f3d908101601f191682019092526118c191810190615c63565b60015b6118ec5781604051630c76093760e01b81526004016118e39190615187565b60405180910390fd5b600080516020615ebd833981519152811461191d57604051632a87526960e21b8152600481018290526024016118e3565b600080516020615ebd8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156119e6576000836001600160a01b0316836040516119849190615ca0565b600060405180830381855af49150503d80600081146119bf576040519150601f19603f3d011682016040523d82523d6000602084013e6119c4565b606091505b5050905080610aa2576040516339b21b5d60e11b815260040160405180910390fd5b505b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a375760405163703e46dd60e11b815260040160405180910390fd5b50600080516020615ebd83398151915290565b6001600160a01b03811660009081526007602090815260409182902080548351818402810184019094528084526060939283018282801561173f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b01049283019260010382029150808411611a99575094979650505050505050565b60068181548110611af657600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b60008060068381548110611b5857611b58615a61565b6000918252602082206003600490920201908101805491935090611b7e90600190615aa6565b81548110611b8e57611b8e615a61565b600091825260208220845460048054600b909402909201945090916001600160601b03909116908110611bc357611bc3615a61565b90600052602060002090600c020190508060050154826003015410611c625782546001600160601b031660001901611c04576001600160ff1b039350611c8f565b6003820154611c14906002615bd7565b611c1f906001615c50565b81546004805490916001600160601b0316908110611c3f57611c3f615a61565b90600052602060002090600c020160040154611c5b9190615bd7565b9350611c8f565b6003820154611c72906002615bd7565b611c7d906001615c50565b8160040154611c8c9190615bd7565b93505b505050919050565b6000546001600160a01b03163314611cc25760405163c383977560e01b815260040160405180910390fd5b6000836001600160a01b03168383604051611cdd9190615ca0565b60006040518083038185875af1925050503d8060008114611d1a576040519150601f19603f3d011682016040523d82523d6000602084013e611d1f565b606091505b5050905080610aa2576040516322092f2f60e11b815260040160405180910390fd5b611d4c338383613a55565b6119e85760405163a437293760e01b815260040160405180910390fd5b6000546001600160a01b03163314611d945760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038216600081815260086020526040808220805460ff191685151590811790915590519092917f541615e167511d757a7067a700eb54431b256bb458dfdce0ac58bf2ed0aefd4491a35050565b6000546001600160a01b03163314611e135760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038316600081815260086020908152604091829020805469ffffffffffffffffff0019166101006001600160401b03881690810260ff60481b191691909117600160481b60ff8816908102919091179092558351908152918201527fe6996b7f03e9bd02228b99d3d946932e3197f505f60542c4cfbc919441d8a4e6910160405180910390a2505050565b6000546001600160a01b03163314611ed05760405163c383977560e01b815260040160405180910390fd5b60006004886001600160601b031681548110611eee57611eee615a61565b90600052602060002090600c0201905060016001600160601b0316886001600160601b031614158015611f50575080546004805488926001600160601b0316908110611f3c57611f3c615a61565b90600052602060002090600c020160020154115b15611f6e57604051639717078960e01b815260040160405180910390fd5b60005b6001820154811015611ff357866004836001018381548110611f9557611f95615a61565b906000526020600020015481548110611fb057611fb0615a61565b90600052602060002090600c0201600201541015611fe157604051639717078960e01b815260040160405180910390fd5b80611feb81615a8d565b915050611f71565b5060028101869055805460ff60601b1916600160601b88151502178155600381018590556004808201859055600582018490556120369060068301908490614f45565b50876001600160601b03167f709b1f5fda58af9a4f52dacd1ec404840a8148455700cce155a2bd8cf127ef1a88888888888860405161207a96959493929190615cbc565b60405180910390a25050505050505050565b6120f260405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b6006838154811061210557612105615a61565b9060005260206000209060040201600301828154811061212757612127615a61565b90600052602060002090600b020160405180610160016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682018054806020026020016040519081016040528092919081815260200182805480156121d657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116121b8575b5050509183525050600782015460208201526008820154604082015260098201546001600160a01b03166060820152600a909101546080909101529392505050565b60006006828154811061222d5761222d615a61565b600091825260209091206004918202019150600182015460ff166004811115612258576122586153b1565b1461227657604051638794ce4b60e01b815260040160405180910390fd5b6001810154610100900460ff16156122a15760405163c977f8d360e01b815260040160405180910390fd5b60006122ac83611330565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561235f57600080fd5b505af1158015612373573d6000803e3d6000fd5b50505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e8054600160401b810460ff1615906001600160401b03168180156123ca57506001816001600160401b0316105b1580156123ec5750303b1580156123ea5750806001600160401b03166001145b155b156124095760405162dc149f60e41b815260040160405180910390fd5b825467ffffffffffffffff19166001178355811561243357825460ff60401b1916600160401b1783555b600080546001600160a01b03199081166001600160a01b038f81169190911783556001805483168f83161781556002805484168f841617905560038054909316918816919091179091556005805490910181558082526040805160a081018252838152815184815260208181019093529293909291830191905081526001600160a01b038c16602080830191909152600060408301819052606090920182905283546001818101865594835291819020835160059093020191825582810151805193949293612509938501929190910190614f83565b506040828101516002830180546001600160a01b0319166001600160a01b03928316179055606084015160038401556080909301516004909201805460ff191692151592909217909155516000918b16906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a460048054600101815560008181526003546040516311de995760e21b81526001600160a01b039091169263477a655c926125c09290918a9101615d1b565b600060405180830381600087803b1580156125da57600080fd5b505af11580156125ee573d6000803e3d6000fd5b5050600480546001810182556000918252600c027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160601b03191681556040805183815260208101909152909350915050805161265c916001840191602090910190614f83565b50805460ff60601b1916600160601b8a15150217815587516002820155602088015160038201556040880151600480830191909155606089015160058301556126ab9060068301908990614f45565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c906126df906001908a90600401615d1b565b600060405180830381600087803b1580156126f957600080fd5b505af115801561270d573d6000803e3d6000fd5b505082546001600160601b03169150600190507f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d8b8b600060200201518c600160200201518d600260200201518e600360200201518e600060405190808252806020026020018201604052801561278e578160200160208202803683370190505b506040516127a29796959493929190615d34565b60405180910390a36127b76001806001613ffc565b5081156127fe57825460ff60401b19168355604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050505050565b6000546001600160a01b031633146128375760405163c383977560e01b815260040160405180910390fd5b8660048a6001600160601b03168154811061285457612854615a61565b90600052602060002090600c020160020154111561288557604051639717078960e01b815260040160405180910390fd5b80516000036128a75760405163402585f560e01b815260040160405180910390fd5b6001600160601b0389166128ce57604051631ef4f64960e01b815260040160405180910390fd5b60048054600181018255600091825290600c82027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01905b83518110156129cc5783818151811061292157612921615a61565b6020026020010151600014806129545750600554845185908390811061294957612949615a61565b602002602001015110155b1561297257604051633d58a98960e11b815260040160405180910390fd5b600182600a01600086848151811061298c5761298c615a61565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806129c490615a8d565b915050612906565b5080546001600160601b0319166001600160601b038c161781556040805160008152602081019182905251612a05916001840191614f83565b50805460ff60601b1916600160601b8b1515021781556002810189905560038101889055600480820188905560058201879055612a489060068301908790614f45565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c90612a7b9085908890600401615d1b565b600060405180830381600087803b158015612a9557600080fd5b505af1158015612aa9573d6000803e3d6000fd5b5050505060048b6001600160601b031681548110612ac957612ac9615a61565b600091825260208083206001600c909302018201805492830181558352909120018290556040516001600160601b038c169083907f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d90612b36908e908e908e908e908e908e908d90615d34565b60405180910390a35050505050505050505050565b600080600060068481548110612b6357612b63615a61565b6000918252602090912060049091020190506003600182015460ff166004811115612b9057612b906153b1565b03612be8576002810154815460048054929550916001600160601b03909116908110612bbe57612bbe615a61565b600091825260209091206009600c9092020101546002820154612be19190615c50565b9150612bf1565b60009250600091505b50915091565b6000546001600160a01b03163314612c225760405163c383977560e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000612c4f82613992565b341015612c6f57604051630e3360f160e21b815260040160405180910390fd5b6111f68383600034614a0a565b6000546001600160a01b03163314612ca75760405163c383977560e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b612cd283611b42565b341015612cf257604051633191f8f160e01b815260040160405180910390fd5b600060068481548110612d0757612d07615a61565b6000918252602090912060049091020190506003600182015460ff166004811115612d3457612d346153b1565b14612d52576040516337cdefcb60e21b815260040160405180910390fd5b60038101805460009190612d6890600190615aa6565b81548110612d7857612d78615a61565b90600052602060002090600b020190506005816000015481548110612d9f57612d9f615a61565b60009182526020909120600590910201600201546001600160a01b03163314612ddb5760405163065f245f60e01b815260040160405180910390fd5b8154815460038401805460018101825560009182526020909120600480546001600160601b0390951694600b9093029091019184908110612e1e57612e1e615a61565b90600052602060002090600c02016005015484600301541061301c576004836001600160601b031681548110612e5657612e56615a61565b600091825260208220600c90910201546001600160601b031693505b600a811015612f61576004846001600160601b031681548110612e9757612e97615a61565b60009182526020808320868452600a600c90930201919091019052604090205460ff16612f6157600060058481548110612ed357612ed3615a61565b90600052602060002090600502016000015414612f165760058381548110612efd57612efd615a61565b9060005260206000209060050201600001549250612f4f565b6004846001600160601b031681548110612f3257612f32615a61565b60009182526020909120600c90910201546001600160601b031693505b80612f5981615a8d565b915050612e72565b506004836001600160601b031681548110612f7e57612f7e615a61565b60009182526020808320858452600a600c90930201919091019052604090205460ff16612faa57600192505b84546001600160601b0384811691161461301c57845460038601546001600160601b0390911690612fdd90600190615aa6565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff191690554260028701556004805460009290811061305f5761305f615a61565b90600052602060002090600c0201905080600401543461307f9190615c04565b82600301819055506127108160030154826002015461309e9190615bd7565b6130a89190615c04565b60018084019190915534600284015583835560038054908801546001600160a01b039091169163d09f392d918c916130df91615aa6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561311d57600080fd5b505af1158015613131573d6000803e3d6000fd5b50508654845414915061321f9050578454600387015461315390600190615aa6565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460058260000154815481106131a1576131a1615a61565b600091825260209091206002600590920201015460038301546040516302dbb79560e61b81526001600160a01b039092169163b6ede540916131ec918d918d918d9190600401615d84565b600060405180830381600087803b15801561320657600080fd5b505af115801561321a573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91600060405161328f9190615ad6565b60405180910390a2505050505050505050565b600080600683815481106132b8576132b8615a61565b9060005260206000209060040201905080600301600182600301805490506132e09190615aa6565b815481106132f0576132f0615a61565b90600052602060002090600b020160030154915050919050565b60006006838154811061331f5761331f615a61565b906000526020600020906004020190506000600182600301805490506133459190615aa6565b9050600082600301828154811061335e5761335e615a61565b600091825260208220600b909102019150600184015460ff166004811115613388576133886153b1565b146133a657604051638285c4ef60e01b815260040160405180910390fd5b600060058260000154815481106133bf576133bf615a61565b60009182526020822060026005909202010154600a8401546001600160a01b039091169250905b86811080156133fc575060038401546006850154105b156135ce5760006001600160a01b03841663d2b8035a8a8461341d81615a8d565b95506134299087615c50565b6040516001600160e01b031960e085901b168152600481019290925260248201526044016020604051808303816000875af115801561346c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134909190615db4565b90506001600160a01b0381166134a657506133e6565b60018501546001600160a01b038216600090815260076020526040812060020180549091906134d6908490615c50565b909155505060068501546040805188815260208101929092528a916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a36006850180546001810182556000828152602090200180546001600160a01b0319166001600160a01b03841617905560038601549054036135c857600354604051632e96bc2360e11b8152600481018b9052602481018890526001600160a01b0390911690635d2d784690604401600060405180830381600087803b1580156135af57600080fd5b505af11580156135c3573d6000803e3d6000fd5b505050505b506133e6565b8084600a0160008282546135e29190615c50565b90915550505050505050505050565b60006136368261042386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061399292505050565b949350505050565b6000546001600160a01b031633146136695760405163c383977560e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146136b65760405163c383977560e01b815260040160405180910390fd5b6005548082106136d957604051630becfec560e01b815260040160405180910390fd5b6000821561373457600583815481106136f4576136f4615a61565b90600052602060002090600502016003015460016137129190615c50565b9050600a8110613734576040516210d62560e51b815260040160405180910390fd5b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b0389169484019490945260608301859052608083018190526005805460018101825591819052835191027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0810191825591518051939491936137e5937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db101929190910190614f83565b5060408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080909101516004909101805460ff1916911515919091179055600580548490811061384457613844615a61565b600091825260208083206001600590930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482610aa257610aa26001836001613ffc565b6001600160a01b03821660009081526008602052604081205460ff166138e75760405163e51cf7bf60e01b815260040160405180910390fd5b6138f28585856135f1565b82101561391257604051630e3360f160e21b815260040160405180910390fd5b6139276001600160a01b038416333085614cfb565b613944576040516312171d8360e31b815260040160405180910390fd5b6139888686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250879150614a0a9050565b9695505050505050565b60008060006139a084614dd7565b5091509150806004836001600160601b0316815481106139c2576139c2615a61565b90600052602060002090600c0201600401546136369190615bd7565b6000600682815481106139f3576139f3615a61565b600091825260209091206003600490920201015492915050565b60006004836001600160601b031681548110613a2b57613a2b615a61565b60009182526020808320948352600c91909102909301600a0190925250604090205460ff16919050565b60006001600160601b0383161580613a7757506004546001600160601b038416115b15613a8457506000613ff5565b6001600160a01b03841660009081526007602090815260408083206001600160601b038716845260038101909252909120548315613b01576004856001600160601b031681548110613ad857613ad8615a61565b90600052602060002090600c020160020154841015613afc57600092505050613ff5565b613b14565b80600003613b1457600092505050613ff5565b60035460405163684fbf5f60e01b81526000916001600160a01b03169063684fbf5f90613b49908a908a908a90600401615dd1565b6020604051808303816000875af1158015613b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8c9190615dfb565b90506002816002811115613ba257613ba26153b1565b03613bb35760009350505050613ff5565b6001816002811115613bc757613bc76153b1565b03613c2557604080516001600160601b0388168152602081018790526001600160a01b038916917f64c1aa6f3a1b4d72ebddff4e415cd05929dd5af5d670f06dce76627211b49911910160405180910390a260019350505050613ff5565b6000828610613d05576000846001015485600201541015613c47576000613c5b565b84600101548560020154613c5b9190615aa6565b9050613c678185615c50565b871015613c75576000613c8a565b80613c808589615aa6565b613c8a9190615aa6565b91508115613cbc57600154613caa906001600160a01b03168a3085614cfb565b613cbc57600095505050505050613ff5565b83600003613cff578454600180820187556000878152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b50613eea565b6002840154613d148785615aa6565b613d1e9190615c50565b846001015410613d3957613d328684615aa6565b9050613d5f565b8360020154846001015410613d5f5783600201548460010154613d5c9190615aa6565b90505b8015613d8d57600154613d7c906001600160a01b03168983614e5e565b613d8d576000945050505050613ff5565b85600003613eea5783545b8015613ee8576001600160601b03881685613db4600184615aa6565b81548110613dc457613dc4615a61565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031603613ed65784548590613e0090600190615aa6565b81548110613e1057613e10615a61565b600091825260209091206002820401546001918216600c026101000a90046001600160601b0316908690613e449084615aa6565b81548110613e5457613e54615a61565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480613ea057613ea0615e1c565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055613ee8565b80613ee081615e32565b915050613d98565b505b8284600101541015613efc5785613f17565b85838560010154613f0d9190615aa6565b613f179190615c50565b60018501556001600160601b03871660009081526003808601602052604091829020889055549051631166238b60e21b81526001600160a01b03909116906345988e2c90613f6d908b908b908b90600401615dd1565b600060405180830381600087803b158015613f8757600080fd5b505af1158015613f9b573d6000803e3d6000fd5b5050604080516001600160601b038b168152602081018a90526001600160a01b038c1693507f4732545d01e38980276a17e6d394f01577ba63f2fea5eba41af0757d9c060c5c92500160405180910390a260019450505050505b9392505050565b806004846001600160601b03168154811061401957614019615a61565b60009182526020808320868452600c92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b600080600683600001518154811061409e5761409e615a61565b906000526020600020906004020190506000816003018460200151815481106140c9576140c9615a61565b90600052602060002090600b02019050600060058260000154815481106140f2576140f2615a61565b600091825260208083206005929092029091016002015487519188015160a0890151604051634fe264fb60e01b81526004810194909452602484019190915260448301526001600160a01b031692508290634fe264fb90606401602060405180830381865afa158015614169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061418d9190615c63565b905061271081111561419e57506127105b60006127106141ad8382615aa6565b85600101546141bc9190615bd7565b6141c69190615c04565b905080876080018181516141da9190615c50565b90525060a08701516006850180546000929081106141fa576141fa615a61565b60009182526020808320909101546001600160a01b0316808352600790915260408220600201805491935084929091614234908490615aa6565b90915550506001600160a01b0381166000908152600760205260409020600101548211614291576001600160a01b03811660009081526007602052604081206001018054849290614286908490615aa6565b909155506142ae9050565b6001600160a01b0381166000908152600760205260408120600101555b602088015188516001600160a01b0383167f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e7866142ea87615e49565b60098b015460405161430c9392916000916001600160a01b0390911690615e65565b60405180910390a48751602089015160a08a015160405163ba66fde760e01b81526004810193909352602483019190915260448201526001600160a01b0385169063ba66fde790606401602060405180830381865afa158015614373573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143979190615ab9565b6143fe5760035460405163b5d69e9960e01b81526001600160a01b039091169063b5d69e99906143cb908490600401615187565b600060405180830381600087803b1580156143e557600080fd5b505af11580156143f9573d6000803e3d6000fd5b505050505b6001886060015161440f9190615aa6565b8860a0015114801561442357506040880151155b156145145760098501546001600160a01b031661446c576000805460028701546040516001600160a01b039092169281156108fc029290818181858888f1935050505050614493565b60005460028601546009870154614491926001600160a01b0391821692911690614e5e565b505b60005460808901516001546144b6926001600160a01b0391821692911690614e5e565b506020880151885160808a0151600288015460098901546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49361450b93909290916001600160a01b0390911690615e89565b60405180910390a35b505050608090940151949350505050565b6000600682600001518154811061453e5761453e615a61565b9060005260206000209060040201905060008160030183602001518154811061456957614569615a61565b90600052602060002090600b020190506000600582600001548154811061459257614592615a61565b906000526020600020906005020160020160009054906101000a90046001600160a01b031690506000816001600160a01b0316634fe264fb8660000151876020015188606001518960a001516145e89190615ea8565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401602060405180830381865afa158015614631573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146559190615c63565b905061271081111561466657506127105b60008360060186606001518760a001516146809190615ea8565b8154811061469057614690615a61565b600091825260208220015460018601546001600160a01b039091169250612710906146bc908590615bd7565b6146c69190615c04565b6001600160a01b0383166000908152600760205260408120600201805492935083929091906146f6908490615aa6565b90915550506001600160a01b038216600090815260076020526040812060010154900361473657600154614734906001600160a01b03168383614e5e565b505b60006127108489604001518a608001516147509190615c04565b61475a9190615bd7565b6147649190615c04565b90508086600801600082825461477a9190615c50565b925050819055506000612710858a60400151896002015461479b9190615c04565b6147a59190615bd7565b6147af9190615c04565b9050808760070160008282546147c59190615c50565b90915550506001546147e1906001600160a01b03168584614e5e565b5060098701546001600160a01b031661481f576040516001600160a01b0385169082156108fc029083906000818181858888f193505050505061483a565b6009870154614838906001600160a01b03168583614e5e565b505b6020890151895160098901546040516001600160a01b03888116927f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e79261488a928c928a928a9290911690615e65565b60405180910390a46001896060015160026148a59190615bd7565b6148af9190615aa6565b8960a00151036149d157600087600801548a608001516148cf9190615aa6565b90506000886007015489600201546148e79190615aa6565b9050811515806148f657508015155b156116d35781156149205760005460015461491e916001600160a01b03918216911684614e5e565b505b80156149875760098901546001600160a01b031661496657600080546040516001600160a01b039091169183156108fc02918491818181858888f1935050505050614987565b60005460098a0154614985916001600160a01b03918216911683614e5e565b505b60208b01518b5160098b01546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf491612b3691879187916001600160a01b0390911690615e89565b505050505050505050565b6000546001600160a01b03163314614a075760405163c383977560e01b815260040160405180910390fd5b50565b6000806000614a1886614dd7565b92505091506004826001600160601b031681548110614a3957614a39615a61565b60009182526020808320848452600a600c90930201919091019052604090205460ff16614a795760405163b34eb75d60e01b815260040160405180910390fd5b600680546001810182556000918252600160601b33026001600160601b03851617600482027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101918255427ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d41909101556005805492965090929184908110614b0457614b04615a61565b600091825260208220600260059092020101548354600480546001600160a01b039093169450916001600160601b03909116908110614b4557614b45615a61565b60009182526020808320600387018054600181018255908552918420600c909302019350600b0201906001600160a01b038a1615614b9057614b8b8a84600401546111a5565b614b96565b82600401545b9050614ba2818a615c04565b600380840191909155868355830154600284015461271091614bc391615bd7565b614bcd9190615c04565b6001830155600282018990556009820180546001600160a01b0319166001600160a01b038c81169190911790915560035460405163d09f392d60e01b8152600481018b90526000602482015291169063d09f392d90604401600060405180830381600087803b158015614c3f57600080fd5b505af1158015614c53573d6000803e3d6000fd5b50505050836001600160a01b031663b6ede540898e8e86600301546040518563ffffffff1660e01b8152600401614c8d9493929190615d84565b600060405180830381600087803b158015614ca757600080fd5b505af1158015614cbb573d6000803e3d6000fd5b50506040513392508a91507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505050949350505050565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251614d609190615ca0565b6000604051808303816000865af19150503d8060008114614d9d576040519150601f19603f3d011682016040523d82523d6000602084013e614da2565b606091505b5091509150818015614dcc575080511580614dcc575080806020019051810190614dcc9190615ab9565b979650505050505050565b60008060006040845110614e4c575050506020810151604082015160608301516001600160601b0383161580614e1857506004546001600160601b03841610155b15614e2257600192505b81600003614e2f57600391505b801580614e3e57506005548110155b15614e47575060015b614e57565b506001915060039050815b9193909250565b6040516001600160a01b03838116602483015260448201839052600091829182919087169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b17905251614ebb9190615ca0565b6000604051808303816000865af19150503d8060008114614ef8576040519150601f19603f3d011682016040523d82523d6000602084013e614efd565b606091505b50915091508180156139885750805115806139885750808060200190518101906139889190615ab9565b60405180608001604052806004906020820280368337509192915050565b8260048101928215614f73579160200282015b82811115614f73578251825591602001919060010190614f58565b50614f7f929150614fbd565b5090565b828054828255906000526020600020908101928215614f735791602002820182811115614f73578251825591602001919060010190614f58565b5b80821115614f7f5760008155600101614fbe565b6001600160a01b0381168114614a0757600080fd5b600060208284031215614ff957600080fd5b8135613ff581614fd2565b80356001600160601b038116811461501b57600080fd5b919050565b60008060006060848603121561503557600080fd5b833561504081614fd2565b925061504e60208501615004565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561509c5761509c61505e565b604052919050565b600082601f8301126150b557600080fd5b813560206001600160401b038211156150d0576150d061505e565b8160051b6150df828201615074565b92835284810182019282810190878511156150f957600080fd5b83870192505b84831015614dcc578235825291830191908301906150ff565b8015158114614a0757600080fd5b60008060006060848603121561513b57600080fd5b61514484615004565b925060208401356001600160401b0381111561515f57600080fd5b61516b868287016150a4565b925050604084013561517c81615118565b809150509250925092565b6001600160a01b0391909116815260200190565b6000602082840312156151ad57600080fd5b5035919050565b600080604083850312156151c757600080fd5b82356151d281614fd2565b946020939093013593505050565b6000806000606084860312156151f557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561521e57600080fd5b6111f682615004565b8060005b6004811015610aa257815184526020938401939091019060010161522b565b608081016111f98284615227565b600081518084526020808501945080840160005b838110156152885781518752958201959082019060010161526c565b509495945050505050565b6020815260006111f66020830184615258565b600082601f8301126152b757600080fd5b81356001600160401b038111156152d0576152d061505e565b6152e3601f8201601f1916602001615074565b8181528460208386010111156152f857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561532857600080fd5b823561533381614fd2565b915060208301356001600160401b0381111561534e57600080fd5b61535a858286016152a6565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156153a55783516001600160601b031683529284019291840191600101615380565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106153e557634e487b7160e01b600052602160045260246000fd5b9052565b6001600160601b03861681526001600160a01b038516602082015260a0810161541560408301866153c7565b9215156060820152608001529392505050565b60008060006060848603121561543d57600080fd5b833561544881614fd2565b92506020840135915060408401356001600160401b0381111561546a57600080fd5b615476868287016152a6565b9150509250925092565b6000806040838503121561549357600080fd5b6151d283615004565b600080604083850312156154af57600080fd5b82356154ba81614fd2565b915060208301356154ca81615118565b809150509250929050565b6000806000606084860312156154ea57600080fd5b83356154f581614fd2565b925060208401356001600160401b038116811461551157600080fd5b9150604084013560ff8116811461517c57600080fd5b600082601f83011261553857600080fd5b604051608081018181106001600160401b038211171561555a5761555a61505e565b60405280608084018581111561556f57600080fd5b845b81811015615589578035835260209283019201615571565b509195945050505050565b6000806000806000806000610140888a0312156155b057600080fd5b6155b988615004565b965060208801356155c981615118565b955060408801359450606088013593506080880135925060a088013591506155f48960c08a01615527565b905092959891949750929550565b6000806040838503121561561557600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156152885781516001600160a01b031687529582019590820190600101615638565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516101608060e08501526156b8610180850183615624565b60e086015161010086810191909152860151610120808701919091528601519092506101406156f1818701836001600160a01b03169052565b959095015193019290925250919050565b60008060008060008060008060006101e08a8c03121561572157600080fd5b893561572c81614fd2565b985060208a013561573c81614fd2565b975060408a013561574c81614fd2565b965060608a013561575c81614fd2565b955060808a013561576c81615118565b945061577b8b60a08c01615527565b935061578b8b6101208c01615527565b92506101a08a01356001600160401b038111156157a757600080fd5b6157b38c828d016152a6565b9250506101c08a01356157c581614fd2565b809150509295985092959850929598565b60008060008060008060008060006101808a8c0312156157f557600080fd5b6157fe8a615004565b985060208a013561580e81615118565b975060408a0135965060608a0135955060808a0135945060a08a013593506158398b60c08c01615527565b92506101408a01356001600160401b038082111561585657600080fd5b6158628d838e016152a6565b93506101608c013591508082111561587957600080fd5b506158868c828d016150a4565b9150509295985092959850929598565b600080604083850312156158a957600080fd5b8235915060208301356001600160401b0381111561534e57600080fd5b6000806000606084860312156158db57600080fd5b833592506020840135915060408401356001600160401b0381111561546a57600080fd5b6000806040838503121561591257600080fd5b823561591d81614fd2565b915061592b60208401615004565b90509250929050565b60008083601f84011261594657600080fd5b5081356001600160401b0381111561595d57600080fd5b60208301915083602082850101111561597557600080fd5b9250929050565b60008060006040848603121561599157600080fd5b83356001600160401b038111156159a757600080fd5b6159b386828701615934565b909450925050602084013561517c81614fd2565b6000806000806000608086880312156159df57600080fd5b8535945060208601356001600160401b038111156159fc57600080fd5b615a0888828901615934565b9095509350506040860135615a1c81614fd2565b949793965091946060013592915050565b600060208284031215615a3f57600080fd5b81356001600160401b03811115615a5557600080fd5b613636848285016152a6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a9f57615a9f615a77565b5060010190565b818103818111156111f9576111f9615a77565b600060208284031215615acb57600080fd5b8151613ff581615118565b602081016111f982846153c7565b600181815b80851115615b1f578160001904821115615b0557615b05615a77565b80851615615b1257918102915b93841c9390800290615ae9565b509250929050565b600082615b36575060016111f9565b81615b43575060006111f9565b8160018114615b595760028114615b6357615b7f565b60019150506111f9565b60ff841115615b7457615b74615a77565b50506001821b6111f9565b5060208310610133831016604e8410600b8410161715615ba2575081810a6111f9565b615bac8383615ae4565b8060001904821115615bc057615bc0615a77565b029392505050565b60006111f660ff841683615b27565b80820281158282048414176111f9576111f9615a77565b634e487b7160e01b600052601260045260246000fd5b600082615c1357615c13615bee565b500490565b600080600060608486031215615c2d57600080fd5b835192506020840151615c3f81615118565b604085015190925061517c81615118565b808201808211156111f9576111f9615a77565b600060208284031215615c7557600080fd5b5051919050565b60005b83811015615c97578181015183820152602001615c7f565b50506000910152565b60008251615cb2818460208701615c7c565b9190910192915050565b6000610120820190508715158252866020830152856040830152846060830152836080830152614dcc60a0830184615227565b60008151808452615d07816020860160208601615c7c565b601f01601f19169290920160200192915050565b8281526040602082015260006136366040830184615cef565b60006101408915158352886020840152876040840152866060840152856080840152615d6360a0840186615227565b80610120840152615d7681840185615258565b9a9950505050505050505050565b848152836020820152608060408201526000615da36080830185615cef565b905082606083015295945050505050565b600060208284031215615dc657600080fd5b8151613ff581614fd2565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b600060208284031215615e0d57600080fd5b815160038110613ff557600080fd5b634e487b7160e01b600052603160045260246000fd5b600081615e4157615e41615a77565b506000190190565b6000600160ff1b8201615e5e57615e5e615a77565b5060000390565b938452602084019290925260408301526001600160a01b0316606082015260800190565b92835260208301919091526001600160a01b0316604082015260600190565b600082615eb757615eb7615bee565b50069056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203d85178189de7f92100ad796e1019b44ed5644447b36f0d926a5b377a5afa13e64736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106102925760003560e01c80637934c0be1161015a578063c71f4253116100c1578063f12ada8b1161007a578063f12ada8b1461095f578063f6506db41461097f578063f7434ea91461099f578063fbf405b0146109bf578063fc6f8f16146109df578063fe524c39146109ff57600080fd5b8063c71f425314610841578063cf0c38f814610861578063d1c1df4814610881578063d2b8035a146108ff578063d98493f61461091f578063e4c0aaf41461093f57600080fd5b8063a072b86c11610113578063a072b86c14610786578063afe15cfb146107a6578063b0049637146107db578063c13517e1146107fb578063c258bb191461080e578063c35699021461082e57600080fd5b80637934c0be146106b957806382d02237146106d957806386541b24146106f95780638a9bb02a146107195780638bb0487514610746578063994b27af1461076657600080fd5b80632d29a47b116101fe578063543f8a36116101b7578063543f8a36146105e6578063564a565d1461061357806359ec827e146106445780635ea5c03814610664578063751accd0146106795780637717a6e81461069957600080fd5b80632d29a47b146105245780632e1daf2f146105445780633cfd11841461056457806343d4137f146105915780634f1ef286146105be57806352d1902d146105d157600080fd5b8063115d537611610250578063115d5376146103e85780631860592b146104085780631956b1f91461043657806319b81529146104565780631c3db16d146104865780631f5a0dd2146104c357600080fd5b8062f5822c146102975780630219da79146102b95780630761c14d146103315780630b7414bc146103515780630c340a24146103715780630d1b9d1a1461039e575b600080fd5b3480156102a357600080fd5b506102b76102b2366004614fe7565b610a1f565b005b3480156102c557600080fd5b506103046102d4366004614fe7565b60086020526000908152604090205460ff808216916001600160401b0361010082041691600160481b9091041683565b6040805193151584526001600160401b03909216602084015260ff16908201526060015b60405180910390f35b34801561033d57600080fd5b506102b761034c366004615020565b610a6c565b34801561035d57600080fd5b506102b761036c366004615126565b610aa8565b34801561037d57600080fd5b50600054610391906001600160a01b031681565b6040516103289190615187565b3480156103aa57600080fd5b506103be6103b936600461519b565b610c1d565b604080519485526001600160a01b0390931660208501529183015215156060820152608001610328565b3480156103f457600080fd5b506102b761040336600461519b565b610c63565b34801561041457600080fd5b506104286104233660046151b4565b6111a5565b604051908152602001610328565b34801561044257600080fd5b5061039161045136600461519b565b6111ff565b34801561046257600080fd5b5061047661047136600461519b565b611237565b6040519015158152602001610328565b34801561049257600080fd5b506104a66104a136600461519b565b611330565b604080519384529115156020840152151590820152606001610328565b3480156104cf57600080fd5b506104e36104de36600461519b565b611439565b604080516001600160601b0390981688529515156020880152948601939093526060850191909152608084015260a0830152151560c082015260e001610328565b34801561053057600080fd5b506102b761053f3660046151e0565b611498565b34801561055057600080fd5b50600354610391906001600160a01b031681565b34801561057057600080fd5b5061058461057f36600461520c565b6116e0565b604051610328919061524a565b34801561059d57600080fd5b506105b16105ac36600461519b565b61174b565b6040516103289190615293565b6102b76105cc366004615315565b6117c5565b3480156105dd57600080fd5b506104286119ec565b3480156105f257600080fd5b50610606610601366004614fe7565b611a4a565b6040516103289190615364565b34801561061f57600080fd5b5061063361062e36600461519b565b611ae6565b6040516103289594939291906153e9565b34801561065057600080fd5b5061042861065f36600461519b565b611b42565b34801561067057600080fd5b50600554610428565b34801561068557600080fd5b506102b7610694366004615428565b611c97565b3480156106a557600080fd5b506102b76106b4366004615480565b611d41565b3480156106c557600080fd5b506102b76106d436600461549c565b611d69565b3480156106e557600080fd5b506102b76106f43660046154d5565b611de8565b34801561070557600080fd5b506102b7610714366004615594565b611ea5565b34801561072557600080fd5b50610739610734366004615602565b61208c565b604051610328919061565d565b34801561075257600080fd5b506102b761076136600461519b565b612218565b34801561077257600080fd5b506102b7610781366004615702565b61237c565b34801561079257600080fd5b506102b76107a13660046157d6565b61280c565b3480156107b257600080fd5b506107c66107c136600461519b565b612b4b565b60408051928352602083019190915201610328565b3480156107e757600080fd5b506102b76107f6366004614fe7565b612bf7565b610428610809366004615896565b612c44565b34801561081a57600080fd5b506102b7610829366004614fe7565b612c7c565b6102b761083c3660046158c6565b612cc9565b34801561084d57600080fd5b5061042861085c36600461519b565b6132a2565b34801561086d57600080fd5b50600254610391906001600160a01b031681565b34801561088d57600080fd5b506108df61089c3660046158ff565b6001600160a01b039091166000908152600760209081526040808320600181015460028201546001600160601b0390961685526003820190935292205491549093565b604080519485526020850193909352918301526060820152608001610328565b34801561090b57600080fd5b506102b761091a366004615602565b61330a565b34801561092b57600080fd5b5061042861093a36600461597c565b6135f1565b34801561094b57600080fd5b506102b761095a366004614fe7565b61363e565b34801561096b57600080fd5b506102b761097a3660046151b4565b61368b565b34801561098b57600080fd5b5061042861099a3660046159c7565b6138ae565b3480156109ab57600080fd5b506104286109ba366004615a2d565b613992565b3480156109cb57600080fd5b50600154610391906001600160a01b031681565b3480156109eb57600080fd5b506104286109fa36600461519b565b6139de565b348015610a0b57600080fd5b50610476610a1a366004615480565b613a0d565b6000546001600160a01b03163314610a4a5760405163c383977560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314610a975760405163068690bf60e11b815260040160405180910390fd5b610aa2838383613a55565b50505050565b6000546001600160a01b03163314610ad35760405163c383977560e01b815260040160405180910390fd5b60005b8251811015610aa2578115610b7257828181518110610af757610af7615a61565b602002602001015160001480610b2a57506005548351849083908110610b1f57610b1f615a61565b602002602001015110155b15610b4857604051633d58a98960e11b815260040160405180910390fd5b610b6d84848381518110610b5e57610b5e615a61565b60200260200101516001613ffc565b610c0b565b6001600160601b0384166001148015610bc8575060006005848381518110610b9c57610b9c615a61565b602002602001015181548110610bb457610bb4615a61565b906000526020600020906005020160000154145b15610be657604051630c6e81c960e11b815260040160405180910390fd5b610c0b84848381518110610bfc57610bfc615a61565b60200260200101516000613ffc565b80610c1581615a8d565b915050610ad6565b60058181548110610c2d57600080fd5b600091825260209091206005909102018054600282015460038301546004909301549193506001600160a01b0316919060ff1684565b600060068281548110610c7857610c78615a61565b600091825260208220600491820201805482549194506001600160601b0316908110610ca657610ca6615a61565b6000918252602082206003850154600c909202019250610cc890600190615aa6565b90506000836003018281548110610ce157610ce1615a61565b600091825260208220600b909102019150600185015460ff166004811115610d0b57610d0b6153b1565b03610de65781158015610d5a57506001840154600684019060ff166004811115610d3757610d376153b1565b60048110610d4757610d47615a61565b01546002850154610d589042615aa6565b105b15610d7857604051633e9727df60e01b815260040160405180910390fd5b6003810154600682015414610da0576040516309e4486b60e41b815260040160405180910390fd5b8254600160601b900460ff16610db7576002610dba565b60015b60018086018054909160ff1990911690836004811115610ddc57610ddc6153b1565b0217905550611157565b60018085015460ff166004811115610e0057610e006153b1565b03610f18576001840154600684019060ff166004811115610e2357610e236153b1565b60048110610e3357610e33615a61565b01546002850154610e449042615aa6565b108015610ee357506005816000015481548110610e6357610e63615a61565b6000918252602090912060059091020160020154604051630baa64d160e01b8152600481018790526001600160a01b0390911690630baa64d190602401602060405180830381865afa158015610ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee19190615ab9565b155b15610f0157604051634dfa578560e11b815260040160405180910390fd5b6001808501805460029260ff199091169083610ddc565b6002600185015460ff166004811115610f3357610f336153b1565b03611089576001840154600684019060ff166004811115610f5657610f566153b1565b60048110610f6657610f66615a61565b01546002850154610f779042615aa6565b10801561101657506005816000015481548110610f9657610f96615a61565b60009182526020909120600590910201600201546040516336a66c7560e11b8152600481018790526001600160a01b0390911690636d4cd8ea90602401602060405180830381865afa158015610ff0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110149190615ab9565b155b1561103457604051631988dead60e31b815260040160405180910390fd5b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611157565b6003600185015460ff1660048111156110a4576110a46153b1565b0361111e576001840154600684019060ff1660048111156110c7576110c76153b1565b600481106110d7576110d7615a61565b015460028501546110e89042615aa6565b101561110757604051632f4dfd8760e01b815260040160405180910390fd5b6001808501805460049260ff199091169083610ddc565b6004600185015460ff166004811115611139576111396153b1565b03611157576040516307f38c8f60e11b815260040160405180910390fd5b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91916111969160ff1690615ad6565b60405180910390a25050505050565b6001600160a01b03821660009081526008602052604081205461010081046001600160401b0316906111e290600160481b900460ff16600a615bc8565b6111ec9084615bd7565b6111f69190615c04565b90505b92915050565b60006005828154811061121457611214615a61565b60009182526020909120600260059092020101546001600160a01b031692915050565b6000806006838154811061124d5761124d615a61565b600091825260208220600360049092020190810180549193509061127390600190615aa6565b8154811061128357611283615a61565b600091825260208220845460048054600b909402909201945090916001600160601b039091169081106112b8576112b8615a61565b90600052602060002090600c020190508060050154826003015410156112e357506000949350505050565b80546004805490916001600160601b031690811061130357611303615a61565b6000918252602080832094548352600a600c9092029094010190925250604090205460ff16159392505050565b6000806000806006858154811061134957611349615a61565b600091825260208220600360049092020190810180549193509061136f90600190615aa6565b8154811061137f5761137f615a61565b90600052602060002090600b02019050600060058260000154815481106113a8576113a8615a61565b6000918252602090912060059091020160020154604051631c3db16d60e01b8152600481018990526001600160a01b0390911691508190631c3db16d90602401606060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190615c18565b9199909850909650945050505050565b6004818154811061144957600080fd5b60009182526020909120600c9091020180546002820154600383015460048401546005850154600b909501546001600160601b038516965060ff600160601b9095048516959394929391921687565b6000600684815481106114ad576114ad615a61565b600091825260209091206004918202019150600182015460ff1660048111156114d8576114d86153b1565b146114f657604051638794ce4b60e01b815260040160405180910390fd5b600081600301848154811061150d5761150d615a61565b90600052602060002090600b020190506000600582600001548154811061153657611536615a61565b6000918252602082206002600590920201015460048401546001600160a01b039091169250906115668683615c50565b6005850154600686015460405163368efae360e21b8152600481018c9052602481018b905292935090916000906001600160a01b0387169063da3beb8c90604401602060405180830381865afa1580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e89190615c63565b90508060000361160357818411156115fe578193505b611623565b61160e826002615bd7565b84111561162357611620826002615bd7565b93505b60048701849055845b848110156116bf5782811015611678576116716040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614084565b93506116ad565b6116ad6040518060c001604052808e81526020018d815260200184815260200185815260200186815260200183815250614525565b806116b781615a8d565b91505061162c565b50828760050154146116d357600587018390555b5050505050505050505050565b6116e8614f27565b6004826001600160601b03168154811061170457611704615a61565b6000918252602090912060408051608081019182905292600c029091016006019060049082845b81548152602001906001019080831161172b575b50505050509050919050565b60606005828154811061176057611760615a61565b906000526020600020906005020160010180548060200260200160405190810160405280929190818152602001828054801561173f576020028201919060005260206000209081548152602001906001019080831161172b5750505050509050919050565b6117ce826149dc565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061184c57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611840600080516020615ebd8339815191525490565b6001600160a01b031614155b1561186a5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156118c4575060408051601f3d908101601f191682019092526118c191810190615c63565b60015b6118ec5781604051630c76093760e01b81526004016118e39190615187565b60405180910390fd5b600080516020615ebd833981519152811461191d57604051632a87526960e21b8152600481018290526024016118e3565b600080516020615ebd8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156119e6576000836001600160a01b0316836040516119849190615ca0565b600060405180830381855af49150503d80600081146119bf576040519150601f19603f3d011682016040523d82523d6000602084013e6119c4565b606091505b5050905080610aa2576040516339b21b5d60e11b815260040160405180910390fd5b505b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a375760405163703e46dd60e11b815260040160405180910390fd5b50600080516020615ebd83398151915290565b6001600160a01b03811660009081526007602090815260409182902080548351818402810184019094528084526060939283018282801561173f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b01049283019260010382029150808411611a99575094979650505050505050565b60068181548110611af657600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b60008060068381548110611b5857611b58615a61565b6000918252602082206003600490920201908101805491935090611b7e90600190615aa6565b81548110611b8e57611b8e615a61565b600091825260208220845460048054600b909402909201945090916001600160601b03909116908110611bc357611bc3615a61565b90600052602060002090600c020190508060050154826003015410611c625782546001600160601b031660001901611c04576001600160ff1b039350611c8f565b6003820154611c14906002615bd7565b611c1f906001615c50565b81546004805490916001600160601b0316908110611c3f57611c3f615a61565b90600052602060002090600c020160040154611c5b9190615bd7565b9350611c8f565b6003820154611c72906002615bd7565b611c7d906001615c50565b8160040154611c8c9190615bd7565b93505b505050919050565b6000546001600160a01b03163314611cc25760405163c383977560e01b815260040160405180910390fd5b6000836001600160a01b03168383604051611cdd9190615ca0565b60006040518083038185875af1925050503d8060008114611d1a576040519150601f19603f3d011682016040523d82523d6000602084013e611d1f565b606091505b5050905080610aa2576040516322092f2f60e11b815260040160405180910390fd5b611d4c338383613a55565b6119e85760405163a437293760e01b815260040160405180910390fd5b6000546001600160a01b03163314611d945760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038216600081815260086020526040808220805460ff191685151590811790915590519092917f541615e167511d757a7067a700eb54431b256bb458dfdce0ac58bf2ed0aefd4491a35050565b6000546001600160a01b03163314611e135760405163c383977560e01b815260040160405180910390fd5b6001600160a01b038316600081815260086020908152604091829020805469ffffffffffffffffff0019166101006001600160401b03881690810260ff60481b191691909117600160481b60ff8816908102919091179092558351908152918201527fe6996b7f03e9bd02228b99d3d946932e3197f505f60542c4cfbc919441d8a4e6910160405180910390a2505050565b6000546001600160a01b03163314611ed05760405163c383977560e01b815260040160405180910390fd5b60006004886001600160601b031681548110611eee57611eee615a61565b90600052602060002090600c0201905060016001600160601b0316886001600160601b031614158015611f50575080546004805488926001600160601b0316908110611f3c57611f3c615a61565b90600052602060002090600c020160020154115b15611f6e57604051639717078960e01b815260040160405180910390fd5b60005b6001820154811015611ff357866004836001018381548110611f9557611f95615a61565b906000526020600020015481548110611fb057611fb0615a61565b90600052602060002090600c0201600201541015611fe157604051639717078960e01b815260040160405180910390fd5b80611feb81615a8d565b915050611f71565b5060028101869055805460ff60601b1916600160601b88151502178155600381018590556004808201859055600582018490556120369060068301908490614f45565b50876001600160601b03167f709b1f5fda58af9a4f52dacd1ec404840a8148455700cce155a2bd8cf127ef1a88888888888860405161207a96959493929190615cbc565b60405180910390a25050505050505050565b6120f260405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b6006838154811061210557612105615a61565b9060005260206000209060040201600301828154811061212757612127615a61565b90600052602060002090600b020160405180610160016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682018054806020026020016040519081016040528092919081815260200182805480156121d657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116121b8575b5050509183525050600782015460208201526008820154604082015260098201546001600160a01b03166060820152600a909101546080909101529392505050565b60006006828154811061222d5761222d615a61565b600091825260209091206004918202019150600182015460ff166004811115612258576122586153b1565b1461227657604051638794ce4b60e01b815260040160405180910390fd5b6001810154610100900460ff16156122a15760405163c977f8d360e01b815260040160405180910390fd5b60006122ac83611330565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561235f57600080fd5b505af1158015612373573d6000803e3d6000fd5b50505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e8054600160401b810460ff1615906001600160401b03168180156123ca57506001816001600160401b0316105b1580156123ec5750303b1580156123ea5750806001600160401b03166001145b155b156124095760405162dc149f60e41b815260040160405180910390fd5b825467ffffffffffffffff19166001178355811561243357825460ff60401b1916600160401b1783555b600080546001600160a01b03199081166001600160a01b038f81169190911783556001805483168f83161781556002805484168f841617905560038054909316918816919091179091556005805490910181558082526040805160a081018252838152815184815260208181019093529293909291830191905081526001600160a01b038c16602080830191909152600060408301819052606090920182905283546001818101865594835291819020835160059093020191825582810151805193949293612509938501929190910190614f83565b506040828101516002830180546001600160a01b0319166001600160a01b03928316179055606084015160038401556080909301516004909201805460ff191692151592909217909155516000918b16906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a460048054600101815560008181526003546040516311de995760e21b81526001600160a01b039091169263477a655c926125c09290918a9101615d1b565b600060405180830381600087803b1580156125da57600080fd5b505af11580156125ee573d6000803e3d6000fd5b5050600480546001810182556000918252600c027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160601b03191681556040805183815260208101909152909350915050805161265c916001840191602090910190614f83565b50805460ff60601b1916600160601b8a15150217815587516002820155602088015160038201556040880151600480830191909155606089015160058301556126ab9060068301908990614f45565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c906126df906001908a90600401615d1b565b600060405180830381600087803b1580156126f957600080fd5b505af115801561270d573d6000803e3d6000fd5b505082546001600160601b03169150600190507f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d8b8b600060200201518c600160200201518d600260200201518e600360200201518e600060405190808252806020026020018201604052801561278e578160200160208202803683370190505b506040516127a29796959493929190615d34565b60405180910390a36127b76001806001613ffc565b5081156127fe57825460ff60401b19168355604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050505050565b6000546001600160a01b031633146128375760405163c383977560e01b815260040160405180910390fd5b8660048a6001600160601b03168154811061285457612854615a61565b90600052602060002090600c020160020154111561288557604051639717078960e01b815260040160405180910390fd5b80516000036128a75760405163402585f560e01b815260040160405180910390fd5b6001600160601b0389166128ce57604051631ef4f64960e01b815260040160405180910390fd5b60048054600181018255600091825290600c82027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01905b83518110156129cc5783818151811061292157612921615a61565b6020026020010151600014806129545750600554845185908390811061294957612949615a61565b602002602001015110155b1561297257604051633d58a98960e11b815260040160405180910390fd5b600182600a01600086848151811061298c5761298c615a61565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806129c490615a8d565b915050612906565b5080546001600160601b0319166001600160601b038c161781556040805160008152602081019182905251612a05916001840191614f83565b50805460ff60601b1916600160601b8b1515021781556002810189905560038101889055600480820188905560058201879055612a489060068301908790614f45565b506003546040516311de995760e21b81526001600160a01b039091169063477a655c90612a7b9085908890600401615d1b565b600060405180830381600087803b158015612a9557600080fd5b505af1158015612aa9573d6000803e3d6000fd5b5050505060048b6001600160601b031681548110612ac957612ac9615a61565b600091825260208083206001600c909302018201805492830181558352909120018290556040516001600160601b038c169083907f3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d90612b36908e908e908e908e908e908e908d90615d34565b60405180910390a35050505050505050505050565b600080600060068481548110612b6357612b63615a61565b6000918252602090912060049091020190506003600182015460ff166004811115612b9057612b906153b1565b03612be8576002810154815460048054929550916001600160601b03909116908110612bbe57612bbe615a61565b600091825260209091206009600c9092020101546002820154612be19190615c50565b9150612bf1565b60009250600091505b50915091565b6000546001600160a01b03163314612c225760405163c383977560e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000612c4f82613992565b341015612c6f57604051630e3360f160e21b815260040160405180910390fd5b6111f68383600034614a0a565b6000546001600160a01b03163314612ca75760405163c383977560e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b612cd283611b42565b341015612cf257604051633191f8f160e01b815260040160405180910390fd5b600060068481548110612d0757612d07615a61565b6000918252602090912060049091020190506003600182015460ff166004811115612d3457612d346153b1565b14612d52576040516337cdefcb60e21b815260040160405180910390fd5b60038101805460009190612d6890600190615aa6565b81548110612d7857612d78615a61565b90600052602060002090600b020190506005816000015481548110612d9f57612d9f615a61565b60009182526020909120600590910201600201546001600160a01b03163314612ddb5760405163065f245f60e01b815260040160405180910390fd5b8154815460038401805460018101825560009182526020909120600480546001600160601b0390951694600b9093029091019184908110612e1e57612e1e615a61565b90600052602060002090600c02016005015484600301541061301c576004836001600160601b031681548110612e5657612e56615a61565b600091825260208220600c90910201546001600160601b031693505b600a811015612f61576004846001600160601b031681548110612e9757612e97615a61565b60009182526020808320868452600a600c90930201919091019052604090205460ff16612f6157600060058481548110612ed357612ed3615a61565b90600052602060002090600502016000015414612f165760058381548110612efd57612efd615a61565b9060005260206000209060050201600001549250612f4f565b6004846001600160601b031681548110612f3257612f32615a61565b60009182526020909120600c90910201546001600160601b031693505b80612f5981615a8d565b915050612e72565b506004836001600160601b031681548110612f7e57612f7e615a61565b60009182526020808320858452600a600c90930201919091019052604090205460ff16612faa57600192505b84546001600160601b0384811691161461301c57845460038601546001600160601b0390911690612fdd90600190615aa6565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff191690554260028701556004805460009290811061305f5761305f615a61565b90600052602060002090600c0201905080600401543461307f9190615c04565b82600301819055506127108160030154826002015461309e9190615bd7565b6130a89190615c04565b60018084019190915534600284015583835560038054908801546001600160a01b039091169163d09f392d918c916130df91615aa6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561311d57600080fd5b505af1158015613131573d6000803e3d6000fd5b50508654845414915061321f9050578454600387015461315390600190615aa6565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460058260000154815481106131a1576131a1615a61565b600091825260209091206002600590920201015460038301546040516302dbb79560e61b81526001600160a01b039092169163b6ede540916131ec918d918d918d9190600401615d84565b600060405180830381600087803b15801561320657600080fd5b505af115801561321a573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b91600060405161328f9190615ad6565b60405180910390a2505050505050505050565b600080600683815481106132b8576132b8615a61565b9060005260206000209060040201905080600301600182600301805490506132e09190615aa6565b815481106132f0576132f0615a61565b90600052602060002090600b020160030154915050919050565b60006006838154811061331f5761331f615a61565b906000526020600020906004020190506000600182600301805490506133459190615aa6565b9050600082600301828154811061335e5761335e615a61565b600091825260208220600b909102019150600184015460ff166004811115613388576133886153b1565b146133a657604051638285c4ef60e01b815260040160405180910390fd5b600060058260000154815481106133bf576133bf615a61565b60009182526020822060026005909202010154600a8401546001600160a01b039091169250905b86811080156133fc575060038401546006850154105b156135ce5760006001600160a01b03841663d2b8035a8a8461341d81615a8d565b95506134299087615c50565b6040516001600160e01b031960e085901b168152600481019290925260248201526044016020604051808303816000875af115801561346c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134909190615db4565b90506001600160a01b0381166134a657506133e6565b60018501546001600160a01b038216600090815260076020526040812060020180549091906134d6908490615c50565b909155505060068501546040805188815260208101929092528a916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a36006850180546001810182556000828152602090200180546001600160a01b0319166001600160a01b03841617905560038601549054036135c857600354604051632e96bc2360e11b8152600481018b9052602481018890526001600160a01b0390911690635d2d784690604401600060405180830381600087803b1580156135af57600080fd5b505af11580156135c3573d6000803e3d6000fd5b505050505b506133e6565b8084600a0160008282546135e29190615c50565b90915550505050505050505050565b60006136368261042386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061399292505050565b949350505050565b6000546001600160a01b031633146136695760405163c383977560e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146136b65760405163c383977560e01b815260040160405180910390fd5b6005548082106136d957604051630becfec560e01b815260040160405180910390fd5b6000821561373457600583815481106136f4576136f4615a61565b90600052602060002090600502016003015460016137129190615c50565b9050600a8110613734576040516210d62560e51b815260040160405180910390fd5b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b0389169484019490945260608301859052608083018190526005805460018101825591819052835191027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0810191825591518051939491936137e5937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db101929190910190614f83565b5060408201516002820180546001600160a01b0319166001600160a01b03909216919091179055606082015160038201556080909101516004909101805460ff1916911515919091179055600580548490811061384457613844615a61565b600091825260208083206001600590930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482610aa257610aa26001836001613ffc565b6001600160a01b03821660009081526008602052604081205460ff166138e75760405163e51cf7bf60e01b815260040160405180910390fd5b6138f28585856135f1565b82101561391257604051630e3360f160e21b815260040160405180910390fd5b6139276001600160a01b038416333085614cfb565b613944576040516312171d8360e31b815260040160405180910390fd5b6139888686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250879150614a0a9050565b9695505050505050565b60008060006139a084614dd7565b5091509150806004836001600160601b0316815481106139c2576139c2615a61565b90600052602060002090600c0201600401546136369190615bd7565b6000600682815481106139f3576139f3615a61565b600091825260209091206003600490920201015492915050565b60006004836001600160601b031681548110613a2b57613a2b615a61565b60009182526020808320948352600c91909102909301600a0190925250604090205460ff16919050565b60006001600160601b0383161580613a7757506004546001600160601b038416115b15613a8457506000613ff5565b6001600160a01b03841660009081526007602090815260408083206001600160601b038716845260038101909252909120548315613b01576004856001600160601b031681548110613ad857613ad8615a61565b90600052602060002090600c020160020154841015613afc57600092505050613ff5565b613b14565b80600003613b1457600092505050613ff5565b60035460405163684fbf5f60e01b81526000916001600160a01b03169063684fbf5f90613b49908a908a908a90600401615dd1565b6020604051808303816000875af1158015613b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8c9190615dfb565b90506002816002811115613ba257613ba26153b1565b03613bb35760009350505050613ff5565b6001816002811115613bc757613bc76153b1565b03613c2557604080516001600160601b0388168152602081018790526001600160a01b038916917f64c1aa6f3a1b4d72ebddff4e415cd05929dd5af5d670f06dce76627211b49911910160405180910390a260019350505050613ff5565b6000828610613d05576000846001015485600201541015613c47576000613c5b565b84600101548560020154613c5b9190615aa6565b9050613c678185615c50565b871015613c75576000613c8a565b80613c808589615aa6565b613c8a9190615aa6565b91508115613cbc57600154613caa906001600160a01b03168a3085614cfb565b613cbc57600095505050505050613ff5565b83600003613cff578454600180820187556000878152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b50613eea565b6002840154613d148785615aa6565b613d1e9190615c50565b846001015410613d3957613d328684615aa6565b9050613d5f565b8360020154846001015410613d5f5783600201548460010154613d5c9190615aa6565b90505b8015613d8d57600154613d7c906001600160a01b03168983614e5e565b613d8d576000945050505050613ff5565b85600003613eea5783545b8015613ee8576001600160601b03881685613db4600184615aa6565b81548110613dc457613dc4615a61565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031603613ed65784548590613e0090600190615aa6565b81548110613e1057613e10615a61565b600091825260209091206002820401546001918216600c026101000a90046001600160601b0316908690613e449084615aa6565b81548110613e5457613e54615a61565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480613ea057613ea0615e1c565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055613ee8565b80613ee081615e32565b915050613d98565b505b8284600101541015613efc5785613f17565b85838560010154613f0d9190615aa6565b613f179190615c50565b60018501556001600160601b03871660009081526003808601602052604091829020889055549051631166238b60e21b81526001600160a01b03909116906345988e2c90613f6d908b908b908b90600401615dd1565b600060405180830381600087803b158015613f8757600080fd5b505af1158015613f9b573d6000803e3d6000fd5b5050604080516001600160601b038b168152602081018a90526001600160a01b038c1693507f4732545d01e38980276a17e6d394f01577ba63f2fea5eba41af0757d9c060c5c92500160405180910390a260019450505050505b9392505050565b806004846001600160601b03168154811061401957614019615a61565b60009182526020808320868452600c92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b600080600683600001518154811061409e5761409e615a61565b906000526020600020906004020190506000816003018460200151815481106140c9576140c9615a61565b90600052602060002090600b02019050600060058260000154815481106140f2576140f2615a61565b600091825260208083206005929092029091016002015487519188015160a0890151604051634fe264fb60e01b81526004810194909452602484019190915260448301526001600160a01b031692508290634fe264fb90606401602060405180830381865afa158015614169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061418d9190615c63565b905061271081111561419e57506127105b60006127106141ad8382615aa6565b85600101546141bc9190615bd7565b6141c69190615c04565b905080876080018181516141da9190615c50565b90525060a08701516006850180546000929081106141fa576141fa615a61565b60009182526020808320909101546001600160a01b0316808352600790915260408220600201805491935084929091614234908490615aa6565b90915550506001600160a01b0381166000908152600760205260409020600101548211614291576001600160a01b03811660009081526007602052604081206001018054849290614286908490615aa6565b909155506142ae9050565b6001600160a01b0381166000908152600760205260408120600101555b602088015188516001600160a01b0383167f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e7866142ea87615e49565b60098b015460405161430c9392916000916001600160a01b0390911690615e65565b60405180910390a48751602089015160a08a015160405163ba66fde760e01b81526004810193909352602483019190915260448201526001600160a01b0385169063ba66fde790606401602060405180830381865afa158015614373573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143979190615ab9565b6143fe5760035460405163b5d69e9960e01b81526001600160a01b039091169063b5d69e99906143cb908490600401615187565b600060405180830381600087803b1580156143e557600080fd5b505af11580156143f9573d6000803e3d6000fd5b505050505b6001886060015161440f9190615aa6565b8860a0015114801561442357506040880151155b156145145760098501546001600160a01b031661446c576000805460028701546040516001600160a01b039092169281156108fc029290818181858888f1935050505050614493565b60005460028601546009870154614491926001600160a01b0391821692911690614e5e565b505b60005460808901516001546144b6926001600160a01b0391821692911690614e5e565b506020880151885160808a0151600288015460098901546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf49361450b93909290916001600160a01b0390911690615e89565b60405180910390a35b505050608090940151949350505050565b6000600682600001518154811061453e5761453e615a61565b9060005260206000209060040201905060008160030183602001518154811061456957614569615a61565b90600052602060002090600b020190506000600582600001548154811061459257614592615a61565b906000526020600020906005020160020160009054906101000a90046001600160a01b031690506000816001600160a01b0316634fe264fb8660000151876020015188606001518960a001516145e89190615ea8565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401602060405180830381865afa158015614631573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146559190615c63565b905061271081111561466657506127105b60008360060186606001518760a001516146809190615ea8565b8154811061469057614690615a61565b600091825260208220015460018601546001600160a01b039091169250612710906146bc908590615bd7565b6146c69190615c04565b6001600160a01b0383166000908152600760205260408120600201805492935083929091906146f6908490615aa6565b90915550506001600160a01b038216600090815260076020526040812060010154900361473657600154614734906001600160a01b03168383614e5e565b505b60006127108489604001518a608001516147509190615c04565b61475a9190615bd7565b6147649190615c04565b90508086600801600082825461477a9190615c50565b925050819055506000612710858a60400151896002015461479b9190615c04565b6147a59190615bd7565b6147af9190615c04565b9050808760070160008282546147c59190615c50565b90915550506001546147e1906001600160a01b03168584614e5e565b5060098701546001600160a01b031661481f576040516001600160a01b0385169082156108fc029083906000818181858888f193505050505061483a565b6009870154614838906001600160a01b03168583614e5e565b505b6020890151895160098901546040516001600160a01b03888116927f8975b837fe0d18616c65abb8b843726a32b552ee4feca009944fa658bbb282e79261488a928c928a928a9290911690615e65565b60405180910390a46001896060015160026148a59190615bd7565b6148af9190615aa6565b8960a00151036149d157600087600801548a608001516148cf9190615aa6565b90506000886007015489600201546148e79190615aa6565b9050811515806148f657508015155b156116d35781156149205760005460015461491e916001600160a01b03918216911684614e5e565b505b80156149875760098901546001600160a01b031661496657600080546040516001600160a01b039091169183156108fc02918491818181858888f1935050505050614987565b60005460098a0154614985916001600160a01b03918216911683614e5e565b505b60208b01518b5160098b01546040517f6cecfd3ec56289ccb16e30eb194f9a87dfdc12630b9abbc31fc69af5a0b0eaf491612b3691879187916001600160a01b0390911690615e89565b505050505050505050565b6000546001600160a01b03163314614a075760405163c383977560e01b815260040160405180910390fd5b50565b6000806000614a1886614dd7565b92505091506004826001600160601b031681548110614a3957614a39615a61565b60009182526020808320848452600a600c90930201919091019052604090205460ff16614a795760405163b34eb75d60e01b815260040160405180910390fd5b600680546001810182556000918252600160601b33026001600160601b03851617600482027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101918255427ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d41909101556005805492965090929184908110614b0457614b04615a61565b600091825260208220600260059092020101548354600480546001600160a01b039093169450916001600160601b03909116908110614b4557614b45615a61565b60009182526020808320600387018054600181018255908552918420600c909302019350600b0201906001600160a01b038a1615614b9057614b8b8a84600401546111a5565b614b96565b82600401545b9050614ba2818a615c04565b600380840191909155868355830154600284015461271091614bc391615bd7565b614bcd9190615c04565b6001830155600282018990556009820180546001600160a01b0319166001600160a01b038c81169190911790915560035460405163d09f392d60e01b8152600481018b90526000602482015291169063d09f392d90604401600060405180830381600087803b158015614c3f57600080fd5b505af1158015614c53573d6000803e3d6000fd5b50505050836001600160a01b031663b6ede540898e8e86600301546040518563ffffffff1660e01b8152600401614c8d9493929190615d84565b600060405180830381600087803b158015614ca757600080fd5b505af1158015614cbb573d6000803e3d6000fd5b50506040513392508a91507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505050949350505050565b6040516001600160a01b038481166024830152838116604483015260648201839052600091829182919088169060840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251614d609190615ca0565b6000604051808303816000865af19150503d8060008114614d9d576040519150601f19603f3d011682016040523d82523d6000602084013e614da2565b606091505b5091509150818015614dcc575080511580614dcc575080806020019051810190614dcc9190615ab9565b979650505050505050565b60008060006040845110614e4c575050506020810151604082015160608301516001600160601b0383161580614e1857506004546001600160601b03841610155b15614e2257600192505b81600003614e2f57600391505b801580614e3e57506005548110155b15614e47575060015b614e57565b506001915060039050815b9193909250565b6040516001600160a01b03838116602483015260448201839052600091829182919087169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b17905251614ebb9190615ca0565b6000604051808303816000865af19150503d8060008114614ef8576040519150601f19603f3d011682016040523d82523d6000602084013e614efd565b606091505b50915091508180156139885750805115806139885750808060200190518101906139889190615ab9565b60405180608001604052806004906020820280368337509192915050565b8260048101928215614f73579160200282015b82811115614f73578251825591602001919060010190614f58565b50614f7f929150614fbd565b5090565b828054828255906000526020600020908101928215614f735791602002820182811115614f73578251825591602001919060010190614f58565b5b80821115614f7f5760008155600101614fbe565b6001600160a01b0381168114614a0757600080fd5b600060208284031215614ff957600080fd5b8135613ff581614fd2565b80356001600160601b038116811461501b57600080fd5b919050565b60008060006060848603121561503557600080fd5b833561504081614fd2565b925061504e60208501615004565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561509c5761509c61505e565b604052919050565b600082601f8301126150b557600080fd5b813560206001600160401b038211156150d0576150d061505e565b8160051b6150df828201615074565b92835284810182019282810190878511156150f957600080fd5b83870192505b84831015614dcc578235825291830191908301906150ff565b8015158114614a0757600080fd5b60008060006060848603121561513b57600080fd5b61514484615004565b925060208401356001600160401b0381111561515f57600080fd5b61516b868287016150a4565b925050604084013561517c81615118565b809150509250925092565b6001600160a01b0391909116815260200190565b6000602082840312156151ad57600080fd5b5035919050565b600080604083850312156151c757600080fd5b82356151d281614fd2565b946020939093013593505050565b6000806000606084860312156151f557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561521e57600080fd5b6111f682615004565b8060005b6004811015610aa257815184526020938401939091019060010161522b565b608081016111f98284615227565b600081518084526020808501945080840160005b838110156152885781518752958201959082019060010161526c565b509495945050505050565b6020815260006111f66020830184615258565b600082601f8301126152b757600080fd5b81356001600160401b038111156152d0576152d061505e565b6152e3601f8201601f1916602001615074565b8181528460208386010111156152f857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561532857600080fd5b823561533381614fd2565b915060208301356001600160401b0381111561534e57600080fd5b61535a858286016152a6565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156153a55783516001600160601b031683529284019291840191600101615380565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106153e557634e487b7160e01b600052602160045260246000fd5b9052565b6001600160601b03861681526001600160a01b038516602082015260a0810161541560408301866153c7565b9215156060820152608001529392505050565b60008060006060848603121561543d57600080fd5b833561544881614fd2565b92506020840135915060408401356001600160401b0381111561546a57600080fd5b615476868287016152a6565b9150509250925092565b6000806040838503121561549357600080fd5b6151d283615004565b600080604083850312156154af57600080fd5b82356154ba81614fd2565b915060208301356154ca81615118565b809150509250929050565b6000806000606084860312156154ea57600080fd5b83356154f581614fd2565b925060208401356001600160401b038116811461551157600080fd5b9150604084013560ff8116811461517c57600080fd5b600082601f83011261553857600080fd5b604051608081018181106001600160401b038211171561555a5761555a61505e565b60405280608084018581111561556f57600080fd5b845b81811015615589578035835260209283019201615571565b509195945050505050565b6000806000806000806000610140888a0312156155b057600080fd5b6155b988615004565b965060208801356155c981615118565b955060408801359450606088013593506080880135925060a088013591506155f48960c08a01615527565b905092959891949750929550565b6000806040838503121561561557600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156152885781516001600160a01b031687529582019590820190600101615638565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c0820152600060c08301516101608060e08501526156b8610180850183615624565b60e086015161010086810191909152860151610120808701919091528601519092506101406156f1818701836001600160a01b03169052565b959095015193019290925250919050565b60008060008060008060008060006101e08a8c03121561572157600080fd5b893561572c81614fd2565b985060208a013561573c81614fd2565b975060408a013561574c81614fd2565b965060608a013561575c81614fd2565b955060808a013561576c81615118565b945061577b8b60a08c01615527565b935061578b8b6101208c01615527565b92506101a08a01356001600160401b038111156157a757600080fd5b6157b38c828d016152a6565b9250506101c08a01356157c581614fd2565b809150509295985092959850929598565b60008060008060008060008060006101808a8c0312156157f557600080fd5b6157fe8a615004565b985060208a013561580e81615118565b975060408a0135965060608a0135955060808a0135945060a08a013593506158398b60c08c01615527565b92506101408a01356001600160401b038082111561585657600080fd5b6158628d838e016152a6565b93506101608c013591508082111561587957600080fd5b506158868c828d016150a4565b9150509295985092959850929598565b600080604083850312156158a957600080fd5b8235915060208301356001600160401b0381111561534e57600080fd5b6000806000606084860312156158db57600080fd5b833592506020840135915060408401356001600160401b0381111561546a57600080fd5b6000806040838503121561591257600080fd5b823561591d81614fd2565b915061592b60208401615004565b90509250929050565b60008083601f84011261594657600080fd5b5081356001600160401b0381111561595d57600080fd5b60208301915083602082850101111561597557600080fd5b9250929050565b60008060006040848603121561599157600080fd5b83356001600160401b038111156159a757600080fd5b6159b386828701615934565b909450925050602084013561517c81614fd2565b6000806000806000608086880312156159df57600080fd5b8535945060208601356001600160401b038111156159fc57600080fd5b615a0888828901615934565b9095509350506040860135615a1c81614fd2565b949793965091946060013592915050565b600060208284031215615a3f57600080fd5b81356001600160401b03811115615a5557600080fd5b613636848285016152a6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a9f57615a9f615a77565b5060010190565b818103818111156111f9576111f9615a77565b600060208284031215615acb57600080fd5b8151613ff581615118565b602081016111f982846153c7565b600181815b80851115615b1f578160001904821115615b0557615b05615a77565b80851615615b1257918102915b93841c9390800290615ae9565b509250929050565b600082615b36575060016111f9565b81615b43575060006111f9565b8160018114615b595760028114615b6357615b7f565b60019150506111f9565b60ff841115615b7457615b74615a77565b50506001821b6111f9565b5060208310610133831016604e8410600b8410161715615ba2575081810a6111f9565b615bac8383615ae4565b8060001904821115615bc057615bc0615a77565b029392505050565b60006111f660ff841683615b27565b80820281158282048414176111f9576111f9615a77565b634e487b7160e01b600052601260045260246000fd5b600082615c1357615c13615bee565b500490565b600080600060608486031215615c2d57600080fd5b835192506020840151615c3f81615118565b604085015190925061517c81615118565b808201808211156111f9576111f9615a77565b600060208284031215615c7557600080fd5b5051919050565b60005b83811015615c97578181015183820152602001615c7f565b50506000910152565b60008251615cb2818460208701615c7c565b9190910192915050565b6000610120820190508715158252866020830152856040830152846060830152836080830152614dcc60a0830184615227565b60008151808452615d07816020860160208601615c7c565b601f01601f19169290920160200192915050565b8281526040602082015260006136366040830184615cef565b60006101408915158352886020840152876040840152866060840152856080840152615d6360a0840186615227565b80610120840152615d7681840185615258565b9a9950505050505050505050565b848152836020820152608060408201526000615da36080830185615cef565b905082606083015295945050505050565b600060208284031215615dc657600080fd5b8151613ff581614fd2565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b600060208284031215615e0d57600080fd5b815160038110613ff557600080fd5b634e487b7160e01b600052603160045260246000fd5b600081615e4157615e41615a77565b506000190190565b6000600160ff1b8201615e5e57615e5e615a77565b5060000390565b938452602084019290925260408301526001600160a01b0316606082015260800190565b92835260208301919091526001600160a01b0316604082015260600190565b600082615eb757615eb7615bee565b50069056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203d85178189de7f92100ad796e1019b44ed5644447b36f0d926a5b377a5afa13e64736f6c63430008120033", + "devdoc": { + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "AcceptedFeeToken(address,bool)": { + "details": "To be emitted when an ERC20 token is added or removed as a method to pay fees.", + "params": { + "_accepted": "Whether the token is accepted or not.", + "_token": "The ERC20 token." + } + }, + "DisputeCreation(uint256,address)": { + "details": "To be emitted when a dispute is created.", + "params": { + "_arbitrable": "The contract which created the dispute.", + "_disputeID": "The identifier of the dispute in the Arbitrator contract." + } + }, + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "NewCurrencyRate(address,uint64,uint8)": { + "details": "To be emitted when the fee for a particular ERC20 token is updated.", + "params": { + "_feeToken": "The ERC20 token.", + "_rateDecimals": "The new decimals of the fee token rate.", + "_rateInEth": "The new rate of the fee token in ETH." + } + }, + "Ruling(address,uint256,uint256)": { + "details": "To be raised when a ruling is given.", + "params": { + "_arbitrable": "The arbitrable receiving the ruling.", + "_disputeID": "The identifier of the dispute in the Arbitrator contract.", + "_ruling": "The ruling which was given." + } + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "addNewDisputeKit(address,uint256)": { + "details": "Add a new supported dispute kit module to the court.", + "params": { + "_disputeKitAddress": "The address of the dispute kit contract.", + "_parent": "The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court." + } + }, + "appeal(uint256,uint256,bytes)": { + "details": "Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.", + "params": { + "_disputeID": "The ID of the dispute.", + "_extraData": "Extradata for the dispute. Can be required during court jump.", + "_numberOfChoices": "Number of choices for the dispute. Can be required during court jump." + } + }, + "appealCost(uint256)": { + "details": "Gets the cost of appealing a specified dispute.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "cost": "The appeal cost." + } + }, + "appealPeriod(uint256)": { + "details": "Gets the start and the end of a specified dispute's current appeal period.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "end": "The end of the appeal period.", + "start": "The start of the appeal period." + } + }, + "arbitrationCost(bytes)": { + "details": "Compute the cost of arbitration denominated in ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes)." + }, + "returns": { + "cost": "The arbitration cost in ETH." + } + }, + "arbitrationCost(bytes,address)": { + "details": "Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_feeToken": "The ERC20 token used to pay fees." + }, + "returns": { + "cost": "The arbitration cost in `_feeToken`." + } + }, + "changeAcceptedFeeTokens(address,bool)": { + "details": "Changes the supported fee tokens.", + "params": { + "_accepted": "Whether the token is supported or not as a method of fee payment.", + "_feeToken": "The fee token." + } + }, + "changeCurrencyRates(address,uint64,uint8)": { + "details": "Changes the currency rate of a fee token.", + "params": { + "_feeToken": "The fee token.", + "_rateDecimals": "The new decimals of the fee token rate.", + "_rateInEth": "The new rate of the fee token in ETH." + } + }, + "changeGovernor(address)": { + "details": "Changes the `governor` storage variable.", + "params": { + "_governor": "The new value for the `governor` storage variable." + } + }, + "changeJurorProsecutionModule(address)": { + "details": "Changes the `jurorProsecutionModule` storage variable.", + "params": { + "_jurorProsecutionModule": "The new value for the `jurorProsecutionModule` storage variable." + } + }, + "changePinakion(address)": { + "details": "Changes the `pinakion` storage variable.", + "params": { + "_pinakion": "The new value for the `pinakion` storage variable." + } + }, + "changeSortitionModule(address)": { + "details": "Changes the `_sortitionModule` storage variable. Note that the new module should be initialized for all courts.", + "params": { + "_sortitionModule": "The new value for the `sortitionModule` storage variable." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],bytes,uint256[])": { + "details": "Creates a court under a specified parent court.", + "params": { + "_alpha": "The `alpha` property value of the court.", + "_feeForJuror": "The `feeForJuror` property value of the court.", + "_hiddenVotes": "The `hiddenVotes` property value of the court.", + "_jurorsForCourtJump": "The `jurorsForCourtJump` property value of the court.", + "_minStake": "The `minStake` property value of the court.", + "_parent": "The `parent` property value of the court.", + "_sortitionExtraData": "Extra data for sortition module.", + "_supportedDisputeKits": "Indexes of dispute kits that this court will support.", + "_timesPerPeriod": "The `timesPerPeriod` property value of the court." + } + }, + "createDispute(uint256,bytes)": { + "details": "Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." + }, + "returns": { + "disputeID": "The identifier of the dispute created." + } + }, + "createDispute(uint256,bytes,address,uint256)": { + "details": "Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_feeAmount": "Amount of the ERC20 token used to pay fees.", + "_feeToken": "The ERC20 token used to pay fees.", + "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." + }, + "returns": { + "disputeID": "The identifier of the dispute created." + } + }, + "currentRuling(uint256)": { + "details": "Gets the current ruling of a specified dispute.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "overridden": "Whether the ruling was overridden by appeal funding or not.", + "ruling": "The current ruling.", + "tied": "Whether it's a tie or not." + } + }, + "draw(uint256,uint256)": { + "details": "Draws jurors for the dispute. Can be called in parts.", + "params": { + "_disputeID": "The ID of the dispute.", + "_iterations": "The number of iterations to run." + } + }, + "enableDisputeKits(uint96,uint256[],bool)": { + "details": "Adds/removes court's support for specified dispute kits.", + "params": { + "_courtID": "The ID of the court.", + "_disputeKitIDs": "The IDs of dispute kits which support should be added/removed.", + "_enable": "Whether add or remove the dispute kits from the court." + } + }, + "execute(uint256,uint256,uint256)": { + "details": "Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.", + "params": { + "_disputeID": "The ID of the dispute.", + "_iterations": "The number of iterations to run.", + "_round": "The appeal round." + } + }, + "executeGovernorProposal(address,uint256,bytes)": { + "details": "Allows the governor to call anything on behalf of the contract.", + "params": { + "_amount": "The value sent with the call.", + "_data": "The data sent with the call.", + "_destination": "The destination of the call." + } + }, + "executeRuling(uint256)": { + "details": "Executes a specified dispute's ruling.", + "params": { + "_disputeID": "The ID of the dispute." + } + }, + "getDisputeKit(uint256)": { + "details": "Gets the dispute kit for a specific `_disputeKitID`.", + "params": { + "_disputeKitID": "The ID of the dispute kit." + } + }, + "getDisputeKitChildren(uint256)": { + "details": "Gets non-primitive properties of a specified dispute kit node.", + "params": { + "_disputeKitID": "The ID of the dispute kit." + }, + "returns": { + "_0": "children Indexes of children of this DK." + } + }, + "getJurorCourtIDs(address)": { + "details": "Gets the court identifiers where a specific `_juror` has staked.", + "params": { + "_juror": "The address of the juror." + } + }, + "getNumberOfVotes(uint256)": { + "details": "Gets the number of votes permitted for the specified dispute in the latest round.", + "params": { + "_disputeID": "The ID of the dispute." + } + }, + "getTimesPerPeriod(uint96)": { + "details": "Gets the timesPerPeriod array for a given court.", + "params": { + "_courtID": "The ID of the court to get the times from." + }, + "returns": { + "timesPerPeriod": "The timesPerPeriod array for the given court." + } + }, + "initialize(address,address,address,address,bool,uint256[4],uint256[4],bytes,address)": { + "details": "Initializer (constructor equivalent for upgradable contracts).", + "params": { + "_courtParameters": "Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).", + "_disputeKit": "The address of the default dispute kit.", + "_governor": "The governor's address.", + "_hiddenVotes": "The `hiddenVotes` property value of the general court.", + "_jurorProsecutionModule": "The address of the juror prosecution module.", + "_pinakion": "The address of the token contract.", + "_sortitionExtraData": "The extra data for sortition module.", + "_sortitionModuleAddress": "The sortition module responsible for sortition of the jurors.", + "_timesPerPeriod": "The `timesPerPeriod` property value of the general court." + } + }, + "isDisputeKitJumping(uint256)": { + "details": "Returns true if the dispute kit will be switched to a parent DK.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "_0": "Whether DK will be switched or not." + } + }, + "passPeriod(uint256)": { + "details": "Passes the period of a specified dispute.", + "params": { + "_disputeID": "The ID of the dispute." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "setStake(uint96,uint256)": { + "details": "Sets the caller's stake in a court.", + "params": { + "_courtID": "The ID of the court.", + "_newStake": "The new stake." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + } + }, + "title": "KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 245, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 248, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "pinakion", + "offset": 0, + "slot": "1", + "type": "t_contract(IERC20)77" + }, + { + "astId": 250, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurorProsecutionModule", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 253, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "sortitionModule", + "offset": 0, + "slot": "3", + "type": "t_contract(ISortitionModule)9478" + }, + { + "astId": 257, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "courts", + "offset": 0, + "slot": "4", + "type": "t_array(t_struct(Court)131_storage)dyn_storage" + }, + { + "astId": 261, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKitNodes", + "offset": 0, + "slot": "5", + "type": "t_array(t_struct(DisputeKitNode)198_storage)dyn_storage" + }, + { + "astId": 265, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputes", + "offset": 0, + "slot": "6", + "type": "t_array(t_struct(Dispute)148_storage)dyn_storage" + }, + { + "astId": 270, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurors", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_struct(Juror)185_storage)" + }, + { + "astId": 276, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "currencyRates", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_contract(IERC20)77,t_struct(CurrencyRate)218_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Court)131_storage)dyn_storage": { + "base": "t_struct(Court)131_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Court[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Dispute)148_storage)dyn_storage": { + "base": "t_struct(Dispute)148_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(DisputeKitNode)198_storage)dyn_storage": { + "base": "t_struct(DisputeKitNode)198_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.DisputeKitNode[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)173_storage)dyn_storage": { + "base": "t_struct(Round)173_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)4_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[4]", + "numberOfBytes": "128" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_array(t_uint96)dyn_storage": { + "base": "t_uint96", + "encoding": "dynamic_array", + "label": "uint96[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IArbitrableV2)9147": { + "encoding": "inplace", + "label": "contract IArbitrableV2", + "numberOfBytes": "20" + }, + "t_contract(IDisputeKit)9386": { + "encoding": "inplace", + "label": "contract IDisputeKit", + "numberOfBytes": "20" + }, + "t_contract(IERC20)77": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(ISortitionModule)9478": { + "encoding": "inplace", + "label": "contract ISortitionModule", + "numberOfBytes": "20" + }, + "t_enum(Period)105": { + "encoding": "inplace", + "label": "enum KlerosCore.Period", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_struct(Juror)185_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct KlerosCore.Juror)", + "numberOfBytes": "32", + "value": "t_struct(Juror)185_storage" + }, + "t_mapping(t_contract(IERC20)77,t_struct(CurrencyRate)218_storage)": { + "encoding": "mapping", + "key": "t_contract(IERC20)77", + "label": "mapping(contract IERC20 => struct KlerosCore.CurrencyRate)", + "numberOfBytes": "32", + "value": "t_struct(CurrencyRate)218_storage" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint96,t_uint256)": { + "encoding": "mapping", + "key": "t_uint96", + "label": "mapping(uint96 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Court)131_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Court", + "members": [ + { + "astId": 107, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "parent", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 109, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "hiddenVotes", + "offset": 12, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 112, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "children", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 114, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "minStake", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 116, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "alpha", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 118, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "feeForJuror", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 120, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurorsForCourtJump", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 124, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "timesPerPeriod", + "offset": 0, + "slot": "6", + "type": "t_array(t_uint256)4_storage" + }, + { + "astId": 128, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "supportedDisputeKits", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 130, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disabled", + "offset": 0, + "slot": "11", + "type": "t_bool" + } + ], + "numberOfBytes": "384" + }, + "t_struct(CurrencyRate)218_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.CurrencyRate", + "members": [ + { + "astId": 213, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "feePaymentAccepted", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 215, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "rateInEth", + "offset": 1, + "slot": "0", + "type": "t_uint64" + }, + { + "astId": 217, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "rateDecimals", + "offset": 9, + "slot": "0", + "type": "t_uint8" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Dispute)148_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Dispute", + "members": [ + { + "astId": 133, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "courtID", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 136, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "arbitrated", + "offset": 12, + "slot": "0", + "type": "t_contract(IArbitrableV2)9147" + }, + { + "astId": 139, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "period", + "offset": 0, + "slot": "1", + "type": "t_enum(Period)105" + }, + { + "astId": 141, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "ruled", + "offset": 1, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 143, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "lastPeriodChange", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 147, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "rounds", + "offset": 0, + "slot": "3", + "type": "t_array(t_struct(Round)173_storage)dyn_storage" + } + ], + "numberOfBytes": "128" + }, + "t_struct(DisputeKitNode)198_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.DisputeKitNode", + "members": [ + { + "astId": 187, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "parent", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 190, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "children", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 193, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKit", + "offset": 0, + "slot": "2", + "type": "t_contract(IDisputeKit)9386" + }, + { + "astId": 195, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "depthLevel", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 197, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disabled", + "offset": 0, + "slot": "4", + "type": "t_bool" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Juror)185_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Juror", + "members": [ + { + "astId": 176, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "courtIDs", + "offset": 0, + "slot": "0", + "type": "t_array(t_uint96)dyn_storage" + }, + { + "astId": 178, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "stakedPnk", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 180, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "lockedPnk", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 184, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "stakedPnkByCourt", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint96,t_uint256)" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Round)173_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Round", + "members": [ + { + "astId": 150, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKitID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 152, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "pnkAtStakePerJuror", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 154, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "totalFeesForJurors", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 156, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "nbVotes", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 158, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "repartitions", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 160, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "pnkPenalties", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 163, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "drawnJurors", + "offset": 0, + "slot": "6", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 165, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "sumFeeRewardPaid", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 167, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "sumPnkRewardPaid", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 170, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "feeToken", + "offset": 0, + "slot": "9", + "type": "t_contract(IERC20)77" + }, + { + "astId": 172, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "drawIterations", + "offset": 0, + "slot": "10", + "type": "t_uint256" + } + ], + "numberOfBytes": "352" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Proxy.json new file mode 100644 index 000000000..0286f435f --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/KlerosCore_Proxy.json @@ -0,0 +1,137 @@ +{ + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "transactionIndex": 2, + "gasUsed": "566267", + "logsBloom": "0x00002000000000000000000000080000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000040000000000000000000000000000020000100000000000000800400000000000000008000000000000000000000000000000004800000000040000000000000080000000000000000000000000000000000008000000000000000000040000000000000000000000000000000008000000000000000000000000000000000004000000000000000061000004001001000000000000000000000000000000000000000000000000000000", + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c", + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "topics": [ + "0x7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000006394a70cadd1376fde5c38ba331761256ddd03e2", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x", + "logIndex": 8, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" + }, + { + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "topics": [ + "0x3475f0ed7216dd7d453db663a1c3024e4f36cc925521d54edb9d13e022cbee3d", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000", + "logIndex": 9, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" + }, + { + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "topics": [ + "0xb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc79", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 10, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" + }, + { + "transactionIndex": 2, + "blockNumber": 43823780, + "transactionHash": "0x6e2d3230b3fde2fe29c3d99ee5b5ad1ac0960e4b20a7a35478bb05edfc2650cd", + "address": "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 11, + "blockHash": "0x24b970c6e64e945e2bb4d52e8e2dc5464027984ca048819381e203376e091a5c" + } + ], + "blockNumber": 43823780, + "cumulativeGasUsed": "817492", + "status": 1, + "byzantium": true + }, + "args": [ + "0xEE08d6427F4f23E602C4114B8F2B7f6d6D3F4206", + "0x994b27af000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a30000000000000000000000003483fa1b87792cd5be4100822c4ecec8d3e531ee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000006394a70cadd1376fde5c38ba331761256ddd03e2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000a7e5d4c3e6c593cf6a367c3a415bb8e4a065e62e00000000000000000000000000000000000000000000000000000000000000010500000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry.json b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry.json index 60d4be190..7d34479b9 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry.json +++ b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry.json @@ -1,16 +1,68 @@ { - "address": "0xa3556bF00c4f9ea235D6D4Bcb1B1c32121C0e935", + "address": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [ { "internalType": "address", - "name": "_governor", + "name": "implementation", "type": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" }, { "anonymous": false, @@ -37,6 +89,19 @@ "name": "PolicyUpdate", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, { "inputs": [ { @@ -63,6 +128,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -82,6 +160,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -104,68 +195,102 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0x6c7d2007f37ea540af02852d0d91811156c4cda8e50c73b24f890a121a37e3b9", + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xa3556bF00c4f9ea235D6D4Bcb1B1c32121C0e935", + "contractAddress": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", "transactionIndex": 1, - "gasUsed": "1880042", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc21db81d98afef80f2bd5d6e4346bd91b25cfeb4c816629209d2e4090e035f62", - "transactionHash": "0x6c7d2007f37ea540af02852d0d91811156c4cda8e50c73b24f890a121a37e3b9", - "logs": [], - "blockNumber": 33427288, - "cumulativeGasUsed": "1880042", + "gasUsed": "175177", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000004000000000000000000000000000000000000000000000000000000080000000000000000000000000000", + "blockHash": "0x49550877f8e5e507f741b57e1509aad8a0b62fbd1387813c4ae2161445c6d783", + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823685, + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", + "address": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x49550877f8e5e507f741b57e1509aad8a0b62fbd1387813c4ae2161445c6d783" + } + ], + "blockNumber": 43823685, + "cumulativeGasUsed": "175177", "status": 1, "byzantium": true }, "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", + "0xc4d66de8000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" ], "numDeployments": 1, - "solcInputHash": "6129c561c66d7822e8192cb0cd803360", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"PolicyUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"policies\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"setPolicy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A contract to maintain a policy for each court.\",\"events\":{\"PolicyUpdate(uint256,string,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_courtID\":\"The ID of the policy's court.\",\"_courtName\":\"The name of the policy's court.\",\"_policy\":\"The URI of the policy JSON.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructs the `PolicyRegistry` contract.\",\"params\":{\"_governor\":\"The governor's address.\"}},\"setPolicy(uint256,string,string)\":{\"details\":\"Sets the policy for the specified court.\",\"params\":{\"_courtID\":\"The ID of the specified court.\",\"_courtName\":\"The name of the specified court.\",\"_policy\":\"The URI of the policy JSON.\"}}},\"title\":\"PolicyRegistry\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/PolicyRegistry.sol\":\"PolicyRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/arbitration/PolicyRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\n/// @title PolicyRegistry\\n/// @dev A contract to maintain a policy for each court.\\ncontract PolicyRegistry {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /// @dev Emitted when a policy is updated.\\n /// @param _courtID The ID of the policy's court.\\n /// @param _courtName The name of the policy's court.\\n /// @param _policy The URI of the policy JSON.\\n event PolicyUpdate(uint256 indexed _courtID, string _courtName, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint256 => string) public policies;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /// @dev Requires that the sender is the governor.\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"No allowed: governor only\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructs the `PolicyRegistry` contract.\\n /// @param _governor The governor's address.\\n constructor(address _governor) {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the policy for the specified court.\\n /// @param _courtID The ID of the specified court.\\n /// @param _courtName The name of the specified court.\\n /// @param _policy The URI of the policy JSON.\\n function setPolicy(uint256 _courtID, string calldata _courtName, string calldata _policy) external onlyByGovernor {\\n policies[_courtID] = _policy;\\n emit PolicyUpdate(_courtID, _courtName, policies[_courtID]);\\n }\\n}\\n\",\"keccak256\":\"0x6ecc230c6ccad6834a29dcfc8ce00ed4c0878fc77602d6b3e6ccdb157f0fad1e\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516106c13803806106c183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61062e806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063bdf7378014610081578063d3e8948314610096578063e4c0aaf4146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f36600461029a565b6100c9565b005b6100a96100a4366004610314565b61016b565b604051610078919061032d565b6100946100c436600461037b565b610205565b6000546001600160a01b031633146100fc5760405162461bcd60e51b81526004016100f3906103ab565b60405180910390fd5b600085815260016020526040902061011582848361047d565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161015c9392919061053e565b60405180910390a25050505050565b60016020526000908152604090208054610184906103f4565b80601f01602080910402602001604051908101604052809291908181526020018280546101b0906103f4565b80156101fd5780601f106101d2576101008083540402835291602001916101fd565b820191906000526020600020905b8154815290600101906020018083116101e057829003601f168201915b505050505081565b6000546001600160a01b0316331461022f5760405162461bcd60e51b81526004016100f3906103ab565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008083601f84011261026357600080fd5b50813567ffffffffffffffff81111561027b57600080fd5b60208301915083602082850101111561029357600080fd5b9250929050565b6000806000806000606086880312156102b257600080fd5b85359450602086013567ffffffffffffffff808211156102d157600080fd5b6102dd89838a01610251565b909650945060408801359150808211156102f657600080fd5b5061030388828901610251565b969995985093965092949392505050565b60006020828403121561032657600080fd5b5035919050565b600060208083528351808285015260005b8181101561035a5785810183015185820160400152820161033e565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561038d57600080fd5b81356001600160a01b03811681146103a457600080fd5b9392505050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061040857607f821691505b60208210810361042857634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561047857600081815260208120601f850160051c810160208610156104555750805b601f850160051c820191505b8181101561047457828155600101610461565b5050505b505050565b67ffffffffffffffff831115610495576104956103de565b6104a9836104a383546103f4565b8361042e565b6000601f8411600181146104dd57600085156104c55750838201355b600019600387901b1c1916600186901b178355610537565b600083815260209020601f19861690835b8281101561050e57868501358255602094850194600190920191016104ee565b508682101561052b5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60408152826040820152828460608301376000606084830101526000601f19601f85011682016020606084830301818501526000855461057d816103f4565b806060860152608060018084166000811461059f57600181146105b9576105e7565b60ff1985168884015283151560051b8801830195506105e7565b8a6000528660002060005b858110156105df5781548a82018601529083019088016105c4565b890184019650505b50939b9a505050505050505050505056fea2646970667358221220ded02758e37026cc7d35ee774dce739e91eb50e5baf879a906f8f0f18a5cc33664736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063bdf7378014610081578063d3e8948314610096578063e4c0aaf4146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f36600461029a565b6100c9565b005b6100a96100a4366004610314565b61016b565b604051610078919061032d565b6100946100c436600461037b565b610205565b6000546001600160a01b031633146100fc5760405162461bcd60e51b81526004016100f3906103ab565b60405180910390fd5b600085815260016020526040902061011582848361047d565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161015c9392919061053e565b60405180910390a25050505050565b60016020526000908152604090208054610184906103f4565b80601f01602080910402602001604051908101604052809291908181526020018280546101b0906103f4565b80156101fd5780601f106101d2576101008083540402835291602001916101fd565b820191906000526020600020905b8154815290600101906020018083116101e057829003601f168201915b505050505081565b6000546001600160a01b0316331461022f5760405162461bcd60e51b81526004016100f3906103ab565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008083601f84011261026357600080fd5b50813567ffffffffffffffff81111561027b57600080fd5b60208301915083602082850101111561029357600080fd5b9250929050565b6000806000806000606086880312156102b257600080fd5b85359450602086013567ffffffffffffffff808211156102d157600080fd5b6102dd89838a01610251565b909650945060408801359150808211156102f657600080fd5b5061030388828901610251565b969995985093965092949392505050565b60006020828403121561032657600080fd5b5035919050565b600060208083528351808285015260005b8181101561035a5785810183015185820160400152820161033e565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561038d57600080fd5b81356001600160a01b03811681146103a457600080fd5b9392505050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061040857607f821691505b60208210810361042857634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561047857600081815260208120601f850160051c810160208610156104555750805b601f850160051c820191505b8181101561047457828155600101610461565b5050505b505050565b67ffffffffffffffff831115610495576104956103de565b6104a9836104a383546103f4565b8361042e565b6000601f8411600181146104dd57600085156104c55750838201355b600019600387901b1c1916600186901b178355610537565b600083815260209020601f19861690835b8281101561050e57868501358255602094850194600190920191016104ee565b508682101561052b5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60408152826040820152828460608301376000606084830101526000601f19601f85011682016020606084830301818501526000855461057d816103f4565b806060860152608060018084166000811461059f57600181146105b9576105e7565b60ff1985168884015283151560051b8801830195506105e7565b8a6000528660002060005b858110156105df5781548a82018601529083019088016105c4565b890184019650505b50939b9a505050505050505050505056fea2646970667358221220ded02758e37026cc7d35ee774dce739e91eb50e5baf879a906f8f0f18a5cc33664736f6c63430008120033", + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + ] + }, + "implementation": "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", "devdoc": { - "details": "A contract to maintain a policy for each court.", - "events": { - "PolicyUpdate(uint256,string,string)": { - "details": "Emitted when a policy is updated.", - "params": { - "_courtID": "The ID of the policy's court.", - "_courtName": "The name of the policy's court.", - "_policy": "The URI of the policy JSON." - } - } - }, + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "changeGovernor(address)": { - "details": "Changes the `governor` storage variable.", - "params": { - "_governor": "The new value for the `governor` storage variable." - } - }, "constructor": { - "details": "Constructs the `PolicyRegistry` contract.", - "params": { - "_governor": "The governor's address." - } - }, - "setPolicy(uint256,string,string)": { - "details": "Sets the policy for the specified court.", - "params": { - "_courtID": "The ID of the specified court.", - "_courtName": "The name of the specified court.", - "_policy": "The URI of the policy JSON." - } + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" } }, - "title": "PolicyRegistry", + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -174,47 +299,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 13, - "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 17, - "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", - "label": "policies", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_uint256,t_string_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_mapping(t_uint256,t_string_storage)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => string)", - "numberOfBytes": "32", - "value": "t_string_storage" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Implementation.json new file mode 100644 index 000000000..cb36c1d39 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Implementation.json @@ -0,0 +1,397 @@ +{ + "address": "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_courtID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "_courtName", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "_policy", + "type": "string" + } + ], + "name": "PolicyUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "policies", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_courtID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_courtName", + "type": "string" + }, + { + "internalType": "string", + "name": "_policy", + "type": "string" + } + ], + "name": "setPolicy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x7cb594904e7b3cfedaa058d4f5d271ab9149246ceb1d53709fd621b8cfdfa309", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", + "transactionIndex": 1, + "gasUsed": "718485", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000080080000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x47acba98eedac84708939f15517c6034dff15dee4213f683f9a0e9361d07f920", + "transactionHash": "0x7cb594904e7b3cfedaa058d4f5d271ab9149246ceb1d53709fd621b8cfdfa309", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823676, + "transactionHash": "0x7cb594904e7b3cfedaa058d4f5d271ab9149246ceb1d53709fd621b8cfdfa309", + "address": "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 0, + "blockHash": "0x47acba98eedac84708939f15517c6034dff15dee4213f683f9a0e9361d07f920" + } + ], + "blockNumber": 43823676, + "cumulativeGasUsed": "718485", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"PolicyUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"policies\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"setPolicy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A contract to maintain a policy for each court.\",\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"PolicyUpdate(uint256,string,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_courtID\":\"The ID of the policy's court.\",\"_courtName\":\"The name of the policy's court.\",\"_policy\":\"The URI of the policy JSON.\"}},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"initialize(address)\":{\"details\":\"Constructs the `PolicyRegistry` contract.\",\"params\":{\"_governor\":\"The governor's address.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"setPolicy(uint256,string,string)\":{\"details\":\"Sets the policy for the specified court.\",\"params\":{\"_courtID\":\"The ID of the specified court.\",\"_courtName\":\"The name of the specified court.\",\"_policy\":\"The URI of the policy JSON.\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}}},\"title\":\"PolicyRegistry\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/PolicyRegistry.sol\":\"PolicyRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/arbitration/PolicyRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// @title PolicyRegistry\\n/// @dev A contract to maintain a policy for each court.\\ncontract PolicyRegistry is UUPSProxiable, Initializable {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /// @dev Emitted when a policy is updated.\\n /// @param _courtID The ID of the policy's court.\\n /// @param _courtName The name of the policy's court.\\n /// @param _policy The URI of the policy JSON.\\n event PolicyUpdate(uint256 indexed _courtID, string _courtName, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint256 => string) public policies;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /// @dev Requires that the sender is the governor.\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"No allowed: governor only\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Constructs the `PolicyRegistry` contract.\\n /// @param _governor The governor's address.\\n function initialize(address _governor) external reinitializer(1) {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the policy for the specified court.\\n /// @param _courtID The ID of the specified court.\\n /// @param _courtName The name of the specified court.\\n /// @param _policy The URI of the policy JSON.\\n function setPolicy(uint256 _courtID, string calldata _courtName, string calldata _policy) external onlyByGovernor {\\n policies[_courtID] = _policy;\\n emit PolicyUpdate(_courtID, _courtName, policies[_courtID]);\\n }\\n}\\n\",\"keccak256\":\"0x24154360b94aa45b0699b65d31087e475f9d43b42771c62440f3d5741f7419a4\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff16156100715760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051610b926100fc6000396000818161017b015281816101a401526103a10152610b926000f3fe6080604052600436106100605760003560e01c80630c340a24146100655780634f1ef286146100a257806352d1902d146100b7578063bdf73780146100da578063c4d66de8146100fa578063d3e894831461011a578063e4c0aaf414610147575b600080fd5b34801561007157600080fd5b50600054610085906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b56100b03660046106ba565b610167565b005b3480156100c357600080fd5b506100cc610394565b604051908152602001610099565b3480156100e657600080fd5b506100b56100f53660046107c5565b6103f2565b34801561010657600080fd5b506100b561011536600461083f565b61048b565b34801561012657600080fd5b5061013a610135366004610861565b610575565b604051610099919061089e565b34801561015357600080fd5b506100b561016236600461083f565b61060f565b6101708261065b565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806101ee57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166101e2600080516020610b3d8339815191525490565b6001600160a01b031614155b1561020c5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610266575060408051601f3d908101601f19168201909252610263918101906108d1565b60015b61029357604051630c76093760e01b81526001600160a01b03831660048201526024015b60405180910390fd5b600080516020610b3d83398151915281146102c457604051632a87526960e21b81526004810182905260240161028a565b600080516020610b3d8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561038f576000836001600160a01b03168360405161032b91906108ea565b600060405180830381855af49150503d8060008114610366576040519150601f19603f3d011682016040523d82523d6000602084013e61036b565b606091505b505090508061038d576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103df5760405163703e46dd60e11b815260040160405180910390fd5b50600080516020610b3d83398151915290565b6000546001600160a01b0316331461041c5760405162461bcd60e51b815260040161028a90610906565b60008581526001602052604090206104358284836109c1565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161047c93929190610a82565b60405180910390a25050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806104d55750805467ffffffffffffffff808416911610155b156104f25760405162dc149f60e41b815260040160405180910390fd5b8054600160401b67ffffffffffffffff841668ffffffffffffffffff199092168217178255600080546001600160a01b0319166001600160a01b038616179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b6001602052600090815260409020805461058e90610939565b80601f01602080910402602001604051908101604052809291908181526020018280546105ba90610939565b80156106075780601f106105dc57610100808354040283529160200191610607565b820191906000526020600020905b8154815290600101906020018083116105ea57829003601f168201915b505050505081565b6000546001600160a01b031633146106395760405162461bcd60e51b815260040161028a90610906565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161028a90610906565b50565b80356001600160a01b038116811461069f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156106cd57600080fd5b6106d683610688565b9150602083013567ffffffffffffffff808211156106f357600080fd5b818501915085601f83011261070757600080fd5b813581811115610719576107196106a4565b604051601f8201601f19908116603f01168101908382118183101715610741576107416106a4565b8160405282815288602084870101111561075a57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008083601f84011261078e57600080fd5b50813567ffffffffffffffff8111156107a657600080fd5b6020830191508360208285010111156107be57600080fd5b9250929050565b6000806000806000606086880312156107dd57600080fd5b85359450602086013567ffffffffffffffff808211156107fc57600080fd5b61080889838a0161077c565b9096509450604088013591508082111561082157600080fd5b5061082e8882890161077c565b969995985093965092949392505050565b60006020828403121561085157600080fd5b61085a82610688565b9392505050565b60006020828403121561087357600080fd5b5035919050565b60005b8381101561089557818101518382015260200161087d565b50506000910152565b60208152600082518060208401526108bd81604085016020870161087a565b601f01601f19169190910160400192915050565b6000602082840312156108e357600080fd5b5051919050565b600082516108fc81846020870161087a565b9190910192915050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b600181811c9082168061094d57607f821691505b60208210810361096d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561038f57600081815260208120601f850160051c8101602086101561099a5750805b601f850160051c820191505b818110156109b9578281556001016109a6565b505050505050565b67ffffffffffffffff8311156109d9576109d96106a4565b6109ed836109e78354610939565b83610973565b6000601f841160018114610a215760008515610a095750838201355b600019600387901b1c1916600186901b178355610a7b565b600083815260209020601f19861690835b82811015610a525786850135825560209485019460019092019101610a32565b5086821015610a6f5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160206060848303018185015260008554610ac181610939565b8060608601526080600180841660008114610ae35760018114610afd57610b2b565b60ff1985168884015283151560051b880183019550610b2b565b8a6000528660002060005b85811015610b235781548a8201860152908301908801610b08565b890184019650505b50939b9a505050505050505050505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212207aa6d088cbf55ecfedf51bcaebd424eea575ea522a50daacc884dbb31803348964736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106100605760003560e01c80630c340a24146100655780634f1ef286146100a257806352d1902d146100b7578063bdf73780146100da578063c4d66de8146100fa578063d3e894831461011a578063e4c0aaf414610147575b600080fd5b34801561007157600080fd5b50600054610085906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b56100b03660046106ba565b610167565b005b3480156100c357600080fd5b506100cc610394565b604051908152602001610099565b3480156100e657600080fd5b506100b56100f53660046107c5565b6103f2565b34801561010657600080fd5b506100b561011536600461083f565b61048b565b34801561012657600080fd5b5061013a610135366004610861565b610575565b604051610099919061089e565b34801561015357600080fd5b506100b561016236600461083f565b61060f565b6101708261065b565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806101ee57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166101e2600080516020610b3d8339815191525490565b6001600160a01b031614155b1561020c5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610266575060408051601f3d908101601f19168201909252610263918101906108d1565b60015b61029357604051630c76093760e01b81526001600160a01b03831660048201526024015b60405180910390fd5b600080516020610b3d83398151915281146102c457604051632a87526960e21b81526004810182905260240161028a565b600080516020610b3d8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561038f576000836001600160a01b03168360405161032b91906108ea565b600060405180830381855af49150503d8060008114610366576040519150601f19603f3d011682016040523d82523d6000602084013e61036b565b606091505b505090508061038d576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103df5760405163703e46dd60e11b815260040160405180910390fd5b50600080516020610b3d83398151915290565b6000546001600160a01b0316331461041c5760405162461bcd60e51b815260040161028a90610906565b60008581526001602052604090206104358284836109c1565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161047c93929190610a82565b60405180910390a25050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806104d55750805467ffffffffffffffff808416911610155b156104f25760405162dc149f60e41b815260040160405180910390fd5b8054600160401b67ffffffffffffffff841668ffffffffffffffffff199092168217178255600080546001600160a01b0319166001600160a01b038616179055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050565b6001602052600090815260409020805461058e90610939565b80601f01602080910402602001604051908101604052809291908181526020018280546105ba90610939565b80156106075780601f106105dc57610100808354040283529160200191610607565b820191906000526020600020905b8154815290600101906020018083116105ea57829003601f168201915b505050505081565b6000546001600160a01b031633146106395760405162461bcd60e51b815260040161028a90610906565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161028a90610906565b50565b80356001600160a01b038116811461069f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156106cd57600080fd5b6106d683610688565b9150602083013567ffffffffffffffff808211156106f357600080fd5b818501915085601f83011261070757600080fd5b813581811115610719576107196106a4565b604051601f8201601f19908116603f01168101908382118183101715610741576107416106a4565b8160405282815288602084870101111561075a57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008083601f84011261078e57600080fd5b50813567ffffffffffffffff8111156107a657600080fd5b6020830191508360208285010111156107be57600080fd5b9250929050565b6000806000806000606086880312156107dd57600080fd5b85359450602086013567ffffffffffffffff808211156107fc57600080fd5b61080889838a0161077c565b9096509450604088013591508082111561082157600080fd5b5061082e8882890161077c565b969995985093965092949392505050565b60006020828403121561085157600080fd5b61085a82610688565b9392505050565b60006020828403121561087357600080fd5b5035919050565b60005b8381101561089557818101518382015260200161087d565b50506000910152565b60208152600082518060208401526108bd81604085016020870161087a565b601f01601f19169190910160400192915050565b6000602082840312156108e357600080fd5b5051919050565b600082516108fc81846020870161087a565b9190910192915050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b600181811c9082168061094d57607f821691505b60208210810361096d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561038f57600081815260208120601f850160051c8101602086101561099a5750805b601f850160051c820191505b818110156109b9578281556001016109a6565b505050505050565b67ffffffffffffffff8311156109d9576109d96106a4565b6109ed836109e78354610939565b83610973565b6000601f841160018114610a215760008515610a095750838201355b600019600387901b1c1916600186901b178355610a7b565b600083815260209020601f19861690835b82811015610a525786850135825560209485019460019092019101610a32565b5086821015610a6f5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160206060848303018185015260008554610ac181610939565b8060608601526080600180841660008114610ae35760018114610afd57610b2b565b60ff1985168884015283151560051b880183019550610b2b565b8a6000528660002060005b85811015610b235781548a8201860152908301908801610b08565b890184019650505b50939b9a505050505050505050505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212207aa6d088cbf55ecfedf51bcaebd424eea575ea522a50daacc884dbb31803348964736f6c63430008120033", + "devdoc": { + "details": "A contract to maintain a policy for each court.", + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "PolicyUpdate(uint256,string,string)": { + "details": "Emitted when a policy is updated.", + "params": { + "_courtID": "The ID of the policy's court.", + "_courtName": "The name of the policy's court.", + "_policy": "The URI of the policy JSON." + } + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "changeGovernor(address)": { + "details": "Changes the `governor` storage variable.", + "params": { + "_governor": "The new value for the `governor` storage variable." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "initialize(address)": { + "details": "Constructs the `PolicyRegistry` contract.", + "params": { + "_governor": "The governor's address." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "setPolicy(uint256,string,string)": { + "details": "Sets the policy for the specified court.", + "params": { + "_courtID": "The ID of the specified court.", + "_courtName": "The name of the specified court.", + "_policy": "The URI of the policy JSON." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + } + }, + "title": "PolicyRegistry", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 8228, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 8232, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "policies", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_string_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Proxy.json new file mode 100644 index 000000000..939b71528 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/PolicyRegistry_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", + "transactionIndex": 1, + "gasUsed": "175177", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000004000000000000000000000000000000000000000000000000000000080000000000000000000000000000", + "blockHash": "0x49550877f8e5e507f741b57e1509aad8a0b62fbd1387813c4ae2161445c6d783", + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823685, + "transactionHash": "0xc3a624dd9f47c2bf30e73691f3e38fb8b52ac33d935095d596ab7f5a8a7d3280", + "address": "0x0d7EeA661C1f9cB1AD389c9Df90B3beDE86a1529", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x49550877f8e5e507f741b57e1509aad8a0b62fbd1387813c4ae2161445c6d783" + } + ], + "blockNumber": 43823685, + "cumulativeGasUsed": "175177", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF9128Ae440A9d4BABc6B66f9385C5Ba6ADf11D89", + "0xc4d66de8000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG.json b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG.json index 016a81dcc..8b00f4b10 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG.json +++ b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG.json @@ -1,21 +1,81 @@ { - "address": "0x0FE3869EA01Febb895Bc76DaB143858F84C67024", + "address": "0xF67D956988cb11449db7aeA80E6339b95b160593", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [ { - "internalType": "contract IRandomizer", - "name": "_randomizer", + "internalType": "address", + "name": "implementation", "type": "address" - }, + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, "internalType": "address", - "name": "_governor", + "name": "newImplementation", "type": "address" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "Upgraded", + "type": "event" }, { "inputs": [], @@ -56,6 +116,37 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "contract IRandomizer", + "name": "_randomizer", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -195,81 +286,103 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0x574a9d24e8e36561c80797ee886b3878c01e41067da05252fa9f28d09f1bfabf", + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x0FE3869EA01Febb895Bc76DaB143858F84C67024", + "contractAddress": "0xF67D956988cb11449db7aeA80E6339b95b160593", "transactionIndex": 1, - "gasUsed": "1627084", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x4fc82dfb9bfce25c0265e14cb3146cecc78a52c0771f008b1aeb77c27e5061e5", - "transactionHash": "0x574a9d24e8e36561c80797ee886b3878c01e41067da05252fa9f28d09f1bfabf", - "logs": [], - "blockNumber": 33427296, - "cumulativeGasUsed": "1627084", + "gasUsed": "220046", + "logsBloom": "0x00000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080400000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x82a42c7e6d4befb9948292a39e817c3ea7b3404b3ca26e8357c0db0cb78be588", + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823711, + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", + "address": "0xF67D956988cb11449db7aeA80E6339b95b160593", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x82a42c7e6d4befb9948292a39e817c3ea7b3404b3ca26e8357c0db0cb78be588" + } + ], + "blockNumber": 43823711, + "cumulativeGasUsed": "220046", "status": 1, "byzantium": true }, "args": [ - "0x923096Da90a3b60eb7E12723fA2E1547BA9236Bc", - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", + "0x485cc955000000000000000000000000923096da90a3b60eb7e12723fa2e1547ba9236bc000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" ], "numDeployments": 1, - "solcInputHash": "fd61600fd663df29806d398dd28b09df", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"_randomizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"callbackGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"randomNumbers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomizer\",\"outputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"randomizerCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"randomizerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receiveRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"randomNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"requesterToID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_callbackGasLimit\",\"type\":\"uint256\"}],\"name\":\"setCallbackGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_randomizer\",\"type\":\"address\"}],\"name\":\"setRandomizer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor of the contract.\",\"params\":{\"_governor\":\"The new governor.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_governor\":\"Governor of the contract.\",\"_randomizer\":\"Randomizer contract.\"}},\"randomizerCallback(uint256,bytes32)\":{\"details\":\"Callback function called by the randomizer contract when the random value is generated.\"},\"randomizerWithdraw(uint256)\":{\"details\":\"Allows the governor to withdraw randomizer funds.\",\"params\":{\"_amount\":\"Amount to withdraw in wei.\"}},\"receiveRandomness(uint256)\":{\"details\":\"Return the random number.\",\"returns\":{\"randomNumber\":\"The random number or 0 if it is not ready or has not been requested.\"}},\"requestRandomness(uint256)\":{\"details\":\"Request a random number. The id of the request is tied to the sender.\"},\"setCallbackGasLimit(uint256)\":{\"details\":\"Change the Randomizer callback gas limit.\",\"params\":{\"_callbackGasLimit\":\"the new limit.\"}},\"setRandomizer(address)\":{\"details\":\"Change the Randomizer address.\",\"params\":{\"_randomizer\":\"the new Randomizer address.\"}}},\"title\":\"Random Number Generator that uses Randomizer.ai https://randomizer.ai/\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/RandomizerRNG.sol\":\"RandomizerRNG\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/rng/IRandomizer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n// Randomizer protocol interface\\ninterface IRandomizer {\\n function request(uint256 callbackGasLimit) external returns (uint256);\\n\\n function clientWithdrawTo(address _to, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0xe71bbdd9470eeb89f5d10aee07fda95b6ccc13aa845c0d8c0bc7a9ec20b6356e\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\ninterface RNG {\\n /// @dev Request a random number.\\n /// @param _block Block linked to the request.\\n function requestRandomness(uint256 _block) external;\\n\\n /// @dev Receive the random number.\\n /// @param _block Block the random number is linked to.\\n /// @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x5afe7121f49aebe72218df356bd91b66c2171b9ad15e7945a15a091784291a43\",\"license\":\"MIT\"},\"src/rng/RandomizerRNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./RNG.sol\\\";\\nimport \\\"./IRandomizer.sol\\\";\\n\\n/// @title Random Number Generator that uses Randomizer.ai\\n/// https://randomizer.ai/\\ncontract RandomizerRNG is RNG {\\n address public governor; // The address that can withdraw funds.\\n uint256 public callbackGasLimit = 50000; // Gas limit for the randomizer callback\\n\\n IRandomizer public randomizer; // Randomizer address.\\n mapping(uint256 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise.\\n mapping(address => uint256) public requesterToID; // Maps the requester to his latest request ID.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /// @dev Constructor.\\n /// @param _randomizer Randomizer contract.\\n /// @param _governor Governor of the contract.\\n constructor(IRandomizer _randomizer, address _governor) {\\n randomizer = _randomizer;\\n governor = _governor;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /// @dev Changes the governor of the contract.\\n /// @param _governor The new governor.\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Change the Randomizer callback gas limit.\\n /// @param _callbackGasLimit the new limit.\\n function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyByGovernor {\\n callbackGasLimit = _callbackGasLimit;\\n }\\n\\n /// @dev Change the Randomizer address.\\n /// @param _randomizer the new Randomizer address.\\n function setRandomizer(address _randomizer) external onlyByGovernor {\\n randomizer = IRandomizer(_randomizer);\\n }\\n\\n /// @dev Allows the governor to withdraw randomizer funds.\\n /// @param _amount Amount to withdraw in wei.\\n function randomizerWithdraw(uint256 _amount) external onlyByGovernor {\\n randomizer.clientWithdrawTo(msg.sender, _amount);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Request a random number. The id of the request is tied to the sender.\\n function requestRandomness(uint256 /*_block*/) external override {\\n uint256 id = randomizer.request(callbackGasLimit);\\n requesterToID[msg.sender] = id;\\n }\\n\\n /// @dev Callback function called by the randomizer contract when the random value is generated.\\n function randomizerCallback(uint256 _id, bytes32 _value) external {\\n require(msg.sender == address(randomizer), \\\"Randomizer only\\\");\\n randomNumbers[_id] = uint256(_value);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Return the random number.\\n /// @return randomNumber The random number or 0 if it is not ready or has not been requested.\\n function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) {\\n // Get the latest request ID for this requester.\\n uint256 id = requesterToID[msg.sender];\\n randomNumber = randomNumbers[id];\\n }\\n}\\n\",\"keccak256\":\"0xe6f1715191d3884c292c2b58200980f08de8cf6c5b32fffdaecc4483919c59ff\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405261c35060015534801561001657600080fd5b506040516105e53803806105e58339810160408190526100359161007e565b600280546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556100b8565b6001600160a01b038116811461007b57600080fd5b50565b6000806040838503121561009157600080fd5b825161009c81610066565b60208401519092506100ad81610066565b809150509250929050565b61051e806100c76000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80637363ae1f116100715780637363ae1f14610184578063767bcab5146101975780638a54942f146101aa578063e4c0aaf4146101bd578063ebe93caf146101d0578063f10fb584146101e357600080fd5b80630c340a24146100b957806313cf9054146100e957806324f74697146101265780634e07c9391461012f5780635257cd901461014457806371d4b00b14610164575b600080fd5b6000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101186100f736600461043d565b50336000908152600460209081526040808320548352600390915290205490565b6040519081526020016100e0565b61011860015481565b61014261013d36600461043d565b6101f6565b005b61011861015236600461043d565b60036020526000908152604090205481565b610118610172366004610456565b60046020526000908152604090205481565b61014261019236600461043d565b610290565b6101426101a5366004610456565b610318565b6101426101b836600461043d565b610364565b6101426101cb366004610456565b610393565b6101426101de366004610486565b6103df565b6002546100cc906001600160a01b031681565b6000546001600160a01b031633146102295760405162461bcd60e51b8152600401610220906104a8565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b5050505050565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b3906024016020604051808303816000875af11580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906104cf565b336000908152600460205260409020555050565b6000546001600160a01b031633146103425760405162461bcd60e51b8152600401610220906104a8565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461038e5760405162461bcd60e51b8152600401610220906104a8565b600155565b6000546001600160a01b031633146103bd5760405162461bcd60e51b8152600401610220906104a8565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461042b5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b6044820152606401610220565b60009182526003602052604090912055565b60006020828403121561044f57600080fd5b5035919050565b60006020828403121561046857600080fd5b81356001600160a01b038116811461047f57600080fd5b9392505050565b6000806040838503121561049957600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104e157600080fd5b505191905056fea26469706673582212205b33a6522e7c4e0416761df88ff2507b8c756e59f022c624aba9af96f194573264736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80637363ae1f116100715780637363ae1f14610184578063767bcab5146101975780638a54942f146101aa578063e4c0aaf4146101bd578063ebe93caf146101d0578063f10fb584146101e357600080fd5b80630c340a24146100b957806313cf9054146100e957806324f74697146101265780634e07c9391461012f5780635257cd901461014457806371d4b00b14610164575b600080fd5b6000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101186100f736600461043d565b50336000908152600460209081526040808320548352600390915290205490565b6040519081526020016100e0565b61011860015481565b61014261013d36600461043d565b6101f6565b005b61011861015236600461043d565b60036020526000908152604090205481565b610118610172366004610456565b60046020526000908152604090205481565b61014261019236600461043d565b610290565b6101426101a5366004610456565b610318565b6101426101b836600461043d565b610364565b6101426101cb366004610456565b610393565b6101426101de366004610486565b6103df565b6002546100cc906001600160a01b031681565b6000546001600160a01b031633146102295760405162461bcd60e51b8152600401610220906104a8565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b5050505050565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b3906024016020604051808303816000875af11580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906104cf565b336000908152600460205260409020555050565b6000546001600160a01b031633146103425760405162461bcd60e51b8152600401610220906104a8565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461038e5760405162461bcd60e51b8152600401610220906104a8565b600155565b6000546001600160a01b031633146103bd5760405162461bcd60e51b8152600401610220906104a8565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461042b5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b6044820152606401610220565b60009182526003602052604090912055565b60006020828403121561044f57600080fd5b5035919050565b60006020828403121561046857600080fd5b81356001600160a01b038116811461047f57600080fd5b9392505050565b6000806040838503121561049957600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104e157600080fd5b505191905056fea26469706673582212205b33a6522e7c4e0416761df88ff2507b8c756e59f022c624aba9af96f194573264736f6c63430008120033", + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0x923096Da90a3b60eb7E12723fA2E1547BA9236Bc", + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + ] + }, + "implementation": "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "changeGovernor(address)": { - "details": "Changes the governor of the contract.", - "params": { - "_governor": "The new governor." - } - }, "constructor": { - "details": "Constructor.", - "params": { - "_governor": "Governor of the contract.", - "_randomizer": "Randomizer contract." - } - }, - "randomizerCallback(uint256,bytes32)": { - "details": "Callback function called by the randomizer contract when the random value is generated." - }, - "randomizerWithdraw(uint256)": { - "details": "Allows the governor to withdraw randomizer funds.", - "params": { - "_amount": "Amount to withdraw in wei." - } - }, - "receiveRandomness(uint256)": { - "details": "Return the random number.", - "returns": { - "randomNumber": "The random number or 0 if it is not ready or has not been requested." - } - }, - "requestRandomness(uint256)": { - "details": "Request a random number. The id of the request is tied to the sender." - }, - "setCallbackGasLimit(uint256)": { - "details": "Change the Randomizer callback gas limit.", - "params": { - "_callbackGasLimit": "the new limit." - } - }, - "setRandomizer(address)": { - "details": "Change the Randomizer address.", - "params": { - "_randomizer": "the new Randomizer address." - } + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." } }, - "title": "Random Number Generator that uses Randomizer.ai https://randomizer.ai/", + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -278,78 +391,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 21566, - "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 21569, - "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "callbackGasLimit", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 21572, - "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "randomizer", - "offset": 0, - "slot": "2", - "type": "t_contract(IRandomizer)21500" - }, - { - "astId": 21576, - "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "randomNumbers", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_uint256,t_uint256)" - }, - { - "astId": 21580, - "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "requesterToID", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(IRandomizer)21500": { - "encoding": "inplace", - "label": "contract IRandomizer", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_uint256,t_uint256)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Implementation.json new file mode 100644 index 000000000..c31be4524 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Implementation.json @@ -0,0 +1,533 @@ +{ + "address": "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "callbackGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IRandomizer", + "name": "_randomizer", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "randomNumbers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "randomizer", + "outputs": [ + { + "internalType": "contract IRandomizer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_id", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "name": "randomizerCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "randomizerWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "receiveRandomness", + "outputs": [ + { + "internalType": "uint256", + "name": "randomNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "requestRandomness", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "requesterToID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_callbackGasLimit", + "type": "uint256" + } + ], + "name": "setCallbackGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_randomizer", + "type": "address" + } + ], + "name": "setRandomizer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0xaaba752398076a9d432549c0ac3f421c61d9e1b6efc8d874ab4166cb6947847b", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", + "transactionIndex": 1, + "gasUsed": "699434", + "logsBloom": "0x00000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf8822866ef2098c27fae2e62b98549cabf9541a972f004f3a05d0bbf797787d9", + "transactionHash": "0xaaba752398076a9d432549c0ac3f421c61d9e1b6efc8d874ab4166cb6947847b", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823700, + "transactionHash": "0xaaba752398076a9d432549c0ac3f421c61d9e1b6efc8d874ab4166cb6947847b", + "address": "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 0, + "blockHash": "0xf8822866ef2098c27fae2e62b98549cabf9541a972f004f3a05d0bbf797787d9" + } + ], + "blockNumber": 43823700, + "cumulativeGasUsed": "699434", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"callbackGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"_randomizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"randomNumbers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomizer\",\"outputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"randomizerCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"randomizerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receiveRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"randomNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"requesterToID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_callbackGasLimit\",\"type\":\"uint256\"}],\"name\":\"setCallbackGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_randomizer\",\"type\":\"address\"}],\"name\":\"setRandomizer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor of the contract.\",\"params\":{\"_governor\":\"The new governor.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"initialize(address,address)\":{\"details\":\"Initializer\",\"params\":{\"_governor\":\"Governor of the contract.\",\"_randomizer\":\"Randomizer contract.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"randomizerCallback(uint256,bytes32)\":{\"details\":\"Callback function called by the randomizer contract when the random value is generated.\"},\"randomizerWithdraw(uint256)\":{\"details\":\"Allows the governor to withdraw randomizer funds.\",\"params\":{\"_amount\":\"Amount to withdraw in wei.\"}},\"receiveRandomness(uint256)\":{\"details\":\"Return the random number.\",\"returns\":{\"randomNumber\":\"The random number or 0 if it is not ready or has not been requested.\"}},\"requestRandomness(uint256)\":{\"details\":\"Request a random number. The id of the request is tied to the sender.\"},\"setCallbackGasLimit(uint256)\":{\"details\":\"Change the Randomizer callback gas limit.\",\"params\":{\"_callbackGasLimit\":\"the new limit.\"}},\"setRandomizer(address)\":{\"details\":\"Change the Randomizer address.\",\"params\":{\"_randomizer\":\"the new Randomizer address.\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}}},\"title\":\"Random Number Generator that uses Randomizer.ai https://randomizer.ai/\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/RandomizerRNG.sol\":\"RandomizerRNG\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"},\"src/rng/IRandomizer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n// Randomizer protocol interface\\ninterface IRandomizer {\\n function request(uint256 callbackGasLimit) external returns (uint256);\\n\\n function clientWithdrawTo(address _to, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0xe71bbdd9470eeb89f5d10aee07fda95b6ccc13aa845c0d8c0bc7a9ec20b6356e\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\ninterface RNG {\\n /// @dev Request a random number.\\n /// @param _block Block linked to the request.\\n function requestRandomness(uint256 _block) external;\\n\\n /// @dev Receive the random number.\\n /// @param _block Block the random number is linked to.\\n /// @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x5afe7121f49aebe72218df356bd91b66c2171b9ad15e7945a15a091784291a43\",\"license\":\"MIT\"},\"src/rng/RandomizerRNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./RNG.sol\\\";\\nimport \\\"./IRandomizer.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// @title Random Number Generator that uses Randomizer.ai\\n/// https://randomizer.ai/\\ncontract RandomizerRNG is RNG, UUPSProxiable, Initializable {\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The address that can withdraw funds.\\n uint256 public callbackGasLimit; // Gas limit for the randomizer callback\\n IRandomizer public randomizer; // Randomizer address.\\n mapping(uint256 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise.\\n mapping(address => uint256) public requesterToID; // Maps the requester to his latest request ID.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer\\n /// @param _randomizer Randomizer contract.\\n /// @param _governor Governor of the contract.\\n function initialize(IRandomizer _randomizer, address _governor) external reinitializer(1) {\\n randomizer = _randomizer;\\n governor = _governor;\\n callbackGasLimit = 50000;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Changes the governor of the contract.\\n /// @param _governor The new governor.\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Change the Randomizer callback gas limit.\\n /// @param _callbackGasLimit the new limit.\\n function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyByGovernor {\\n callbackGasLimit = _callbackGasLimit;\\n }\\n\\n /// @dev Change the Randomizer address.\\n /// @param _randomizer the new Randomizer address.\\n function setRandomizer(address _randomizer) external onlyByGovernor {\\n randomizer = IRandomizer(_randomizer);\\n }\\n\\n /// @dev Allows the governor to withdraw randomizer funds.\\n /// @param _amount Amount to withdraw in wei.\\n function randomizerWithdraw(uint256 _amount) external onlyByGovernor {\\n randomizer.clientWithdrawTo(msg.sender, _amount);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Request a random number. The id of the request is tied to the sender.\\n function requestRandomness(uint256 /*_block*/) external override {\\n uint256 id = randomizer.request(callbackGasLimit);\\n requesterToID[msg.sender] = id;\\n }\\n\\n /// @dev Callback function called by the randomizer contract when the random value is generated.\\n function randomizerCallback(uint256 _id, bytes32 _value) external {\\n require(msg.sender == address(randomizer), \\\"Randomizer only\\\");\\n randomNumbers[_id] = uint256(_value);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Return the random number.\\n /// @return randomNumber The random number or 0 if it is not ready or has not been requested.\\n function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) {\\n // Get the latest request ID for this requester.\\n uint256 id = requesterToID[msg.sender];\\n randomNumber = randomNumbers[id];\\n }\\n}\\n\",\"keccak256\":\"0x4285391be2975df0c7d1fa2fcdcd8abe8458e3228961ba32dec1e97325598df0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff16156100715760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051610b396100fc600039600081816104a1015281816104ca01526106c20152610b396000f3fe6080604052600436106100c85760003560e01c806352d1902d1161007a57806352d1902d146101ec57806371d4b00b146102015780637363ae1f1461022e578063767bcab51461024e5780638a54942f1461026e578063e4c0aaf41461028e578063ebe93caf146102ae578063f10fb584146102ce57600080fd5b80630c340a24146100cd57806313cf90541461010a57806324f7469714610154578063485cc9551461016a5780634e07c9391461018c5780634f1ef286146101ac5780635257cd90146101bf575b600080fd5b3480156100d957600080fd5b506000546100ed906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011657600080fd5b506101466101253660046108ed565b50336000908152600460209081526040808320548352600390915290205490565b604051908152602001610101565b34801561016057600080fd5b5061014660015481565b34801561017657600080fd5b5061018a61018536600461091b565b6102ee565b005b34801561019857600080fd5b5061018a6101a73660046108ed565b6103f3565b61018a6101ba36600461096a565b61048d565b3480156101cb57600080fd5b506101466101da3660046108ed565b60036020526000908152604090205481565b3480156101f857600080fd5b506101466106b5565b34801561020d57600080fd5b5061014661021c366004610a2e565b60046020526000908152604090205481565b34801561023a57600080fd5b5061018a6102493660046108ed565b610713565b34801561025a57600080fd5b5061018a610269366004610a2e565b61079b565b34801561027a57600080fd5b5061018a6102893660046108ed565b6107e7565b34801561029a57600080fd5b5061018a6102a9366004610a2e565b610816565b3480156102ba57600080fd5b5061018a6102c9366004610a52565b610862565b3480156102da57600080fd5b506002546100ed906001600160a01b031681565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806103385750805467ffffffffffffffff808416911610155b156103555760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff8316908117600160401b178255600280546001600160a01b038781166001600160a01b031992831617909255600080549287169290911691909117905561c350600155815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b6000546001600160a01b031633146104265760405162461bcd60e51b815260040161041d90610a74565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561047257600080fd5b505af1158015610486573d6000803e3d6000fd5b5050505050565b610496826108c0565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061051457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610508600080516020610ae48339815191525490565b6001600160a01b031614155b156105325760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561058c575060408051601f3d908101601f1916820190925261058991810190610a9b565b60015b6105b457604051630c76093760e01b81526001600160a01b038316600482015260240161041d565b600080516020610ae483398151915281146105e557604051632a87526960e21b81526004810182905260240161041d565b600080516020610ae48339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156106b0576000836001600160a01b03168360405161064c9190610ab4565b600060405180830381855af49150503d8060008114610687576040519150601f19603f3d011682016040523d82523d6000602084013e61068c565b606091505b50509050806106ae576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107005760405163703e46dd60e11b815260040160405180910390fd5b50600080516020610ae483398151915290565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b3906024016020604051808303816000875af1158015610763573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107879190610a9b565b336000908152600460205260409020555050565b6000546001600160a01b031633146107c55760405162461bcd60e51b815260040161041d90610a74565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108115760405162461bcd60e51b815260040161041d90610a74565b600155565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161041d90610a74565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146108ae5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b604482015260640161041d565b60009182526003602052604090912055565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161041d90610a74565b50565b6000602082840312156108ff57600080fd5b5035919050565b6001600160a01b03811681146108ea57600080fd5b6000806040838503121561092e57600080fd5b823561093981610906565b9150602083013561094981610906565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561097d57600080fd5b823561098881610906565b9150602083013567ffffffffffffffff808211156109a557600080fd5b818501915085601f8301126109b957600080fd5b8135818111156109cb576109cb610954565b604051601f8201601f19908116603f011681019083821181831017156109f3576109f3610954565b81604052828152886020848701011115610a0c57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215610a4057600080fd5b8135610a4b81610906565b9392505050565b60008060408385031215610a6557600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b600060208284031215610aad57600080fd5b5051919050565b6000825160005b81811015610ad55760208186018101518583015201610abb565b50600092019182525091905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203a1d3c5353c9b0d8d4d5bf99c8e25bc1253bce822d66840d9ceaadb82101c72164736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106100c85760003560e01c806352d1902d1161007a57806352d1902d146101ec57806371d4b00b146102015780637363ae1f1461022e578063767bcab51461024e5780638a54942f1461026e578063e4c0aaf41461028e578063ebe93caf146102ae578063f10fb584146102ce57600080fd5b80630c340a24146100cd57806313cf90541461010a57806324f7469714610154578063485cc9551461016a5780634e07c9391461018c5780634f1ef286146101ac5780635257cd90146101bf575b600080fd5b3480156100d957600080fd5b506000546100ed906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011657600080fd5b506101466101253660046108ed565b50336000908152600460209081526040808320548352600390915290205490565b604051908152602001610101565b34801561016057600080fd5b5061014660015481565b34801561017657600080fd5b5061018a61018536600461091b565b6102ee565b005b34801561019857600080fd5b5061018a6101a73660046108ed565b6103f3565b61018a6101ba36600461096a565b61048d565b3480156101cb57600080fd5b506101466101da3660046108ed565b60036020526000908152604090205481565b3480156101f857600080fd5b506101466106b5565b34801561020d57600080fd5b5061014661021c366004610a2e565b60046020526000908152604090205481565b34801561023a57600080fd5b5061018a6102493660046108ed565b610713565b34801561025a57600080fd5b5061018a610269366004610a2e565b61079b565b34801561027a57600080fd5b5061018a6102893660046108ed565b6107e7565b34801561029a57600080fd5b5061018a6102a9366004610a2e565b610816565b3480156102ba57600080fd5b5061018a6102c9366004610a52565b610862565b3480156102da57600080fd5b506002546100ed906001600160a01b031681565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff16806103385750805467ffffffffffffffff808416911610155b156103555760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff8316908117600160401b178255600280546001600160a01b038781166001600160a01b031992831617909255600080549287169290911691909117905561c350600155815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b6000546001600160a01b031633146104265760405162461bcd60e51b815260040161041d90610a74565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561047257600080fd5b505af1158015610486573d6000803e3d6000fd5b5050505050565b610496826108c0565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061051457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610508600080516020610ae48339815191525490565b6001600160a01b031614155b156105325760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561058c575060408051601f3d908101601f1916820190925261058991810190610a9b565b60015b6105b457604051630c76093760e01b81526001600160a01b038316600482015260240161041d565b600080516020610ae483398151915281146105e557604051632a87526960e21b81526004810182905260240161041d565b600080516020610ae48339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156106b0576000836001600160a01b03168360405161064c9190610ab4565b600060405180830381855af49150503d8060008114610687576040519150601f19603f3d011682016040523d82523d6000602084013e61068c565b606091505b50509050806106ae576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107005760405163703e46dd60e11b815260040160405180910390fd5b50600080516020610ae483398151915290565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b3906024016020604051808303816000875af1158015610763573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107879190610a9b565b336000908152600460205260409020555050565b6000546001600160a01b031633146107c55760405162461bcd60e51b815260040161041d90610a74565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108115760405162461bcd60e51b815260040161041d90610a74565b600155565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161041d90610a74565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146108ae5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b604482015260640161041d565b60009182526003602052604090912055565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161041d90610a74565b50565b6000602082840312156108ff57600080fd5b5035919050565b6001600160a01b03811681146108ea57600080fd5b6000806040838503121561092e57600080fd5b823561093981610906565b9150602083013561094981610906565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561097d57600080fd5b823561098881610906565b9150602083013567ffffffffffffffff808211156109a557600080fd5b818501915085601f8301126109b957600080fd5b8135818111156109cb576109cb610954565b604051601f8201601f19908116603f011681019083821181831017156109f3576109f3610954565b81604052828152886020848701011115610a0c57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215610a4057600080fd5b8135610a4b81610906565b9392505050565b60008060408385031215610a6557600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b600060208284031215610aad57600080fd5b5051919050565b6000825160005b81811015610ad55760208186018101518583015201610abb565b50600092019182525091905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203a1d3c5353c9b0d8d4d5bf99c8e25bc1253bce822d66840d9ceaadb82101c72164736f6c63430008120033", + "devdoc": { + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "changeGovernor(address)": { + "details": "Changes the governor of the contract.", + "params": { + "_governor": "The new governor." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "initialize(address,address)": { + "details": "Initializer", + "params": { + "_governor": "Governor of the contract.", + "_randomizer": "Randomizer contract." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "randomizerCallback(uint256,bytes32)": { + "details": "Callback function called by the randomizer contract when the random value is generated." + }, + "randomizerWithdraw(uint256)": { + "details": "Allows the governor to withdraw randomizer funds.", + "params": { + "_amount": "Amount to withdraw in wei." + } + }, + "receiveRandomness(uint256)": { + "details": "Return the random number.", + "returns": { + "randomNumber": "The random number or 0 if it is not ready or has not been requested." + } + }, + "requestRandomness(uint256)": { + "details": "Request a random number. The id of the request is tied to the sender." + }, + "setCallbackGasLimit(uint256)": { + "details": "Change the Randomizer callback gas limit.", + "params": { + "_callbackGasLimit": "the new limit." + } + }, + "setRandomizer(address)": { + "details": "Change the Randomizer address.", + "params": { + "_randomizer": "the new Randomizer address." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + } + }, + "title": "Random Number Generator that uses Randomizer.ai https://randomizer.ai/", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 22542, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 22544, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "callbackGasLimit", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 22547, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "randomizer", + "offset": 0, + "slot": "2", + "type": "t_contract(IRandomizer)22470" + }, + { + "astId": 22551, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "randomNumbers", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 22555, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "requesterToID", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(IRandomizer)22470": { + "encoding": "inplace", + "label": "contract IRandomizer", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Proxy.json new file mode 100644 index 000000000..16f213426 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/RandomizerRNG_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0xF67D956988cb11449db7aeA80E6339b95b160593", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xF67D956988cb11449db7aeA80E6339b95b160593", + "transactionIndex": 1, + "gasUsed": "220046", + "logsBloom": "0x00000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080400000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x82a42c7e6d4befb9948292a39e817c3ea7b3404b3ca26e8357c0db0cb78be588", + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823711, + "transactionHash": "0x22aca5d2ff07ecd691b94cfafa5583f284f240af578902f331b34c0bb31752e2", + "address": "0xF67D956988cb11449db7aeA80E6339b95b160593", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x82a42c7e6d4befb9948292a39e817c3ea7b3404b3ca26e8357c0db0cb78be588" + } + ], + "blockNumber": 43823711, + "cumulativeGasUsed": "220046", + "status": 1, + "byzantium": true + }, + "args": [ + "0xc1C85d303B4995Cb543C2b449C1b3dF490d49ebE", + "0x485cc955000000000000000000000000923096da90a3b60eb7e12723fa2e1547ba9236bc000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/SortitionModule.json b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule.json index e1c3f0db9..36085f9cf 100644 --- a/contracts/deployments/arbitrumGoerliDevnet/SortitionModule.json +++ b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule.json @@ -1,41 +1,68 @@ { - "address": "0x6f3b3c8d72Af21102088C8b3F07Ee97b166a21b2", + "address": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [ { "internalType": "address", - "name": "_governor", + "name": "implementation", "type": "address" - }, - { - "internalType": "contract KlerosCore", - "name": "_core", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_minStakingTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxDrawingTime", - "type": "uint256" - }, + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ { - "internalType": "contract RNG", - "name": "_rng", - "type": "address" - }, + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ { - "internalType": "uint256", - "name": "_rngLookahead", - "type": "uint256" + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "Initialized", + "type": "event" }, { "anonymous": false, @@ -50,6 +77,19 @@ "name": "NewPhase", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, { "inputs": [], "name": "DEFAULT_K", @@ -292,6 +332,44 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minStakingTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxDrawingTime", + "type": "uint256" + }, + { + "internalType": "contract RNG", + "name": "_rng", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_rngLookahead", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "lastPhaseChange", @@ -411,6 +489,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "randomNumber", @@ -498,116 +589,107 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0xec0d52bfc0fe2ced483d00d0f9e08308161211738f804f7aefb48b6b1a68fbac", + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x6f3b3c8d72Af21102088C8b3F07Ee97b166a21b2", + "contractAddress": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", "transactionIndex": 1, - "gasUsed": "1808339", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0ec5ba651c4f216b62b4c8a706ef48e0804b12552e3caf3332c1cc7957dd3dbb", - "transactionHash": "0xec0d52bfc0fe2ced483d00d0f9e08308161211738f804f7aefb48b6b1a68fbac", - "logs": [], - "blockNumber": 43589325, - "cumulativeGasUsed": "1808339", + "gasUsed": "332281", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000200000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x619c881d0f4e09106b8808e3e1168e6c179f9b3f9948cc6e687a8dd0ccdf3cb8", + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823761, + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", + "address": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x619c881d0f4e09106b8808e3e1168e6c179f9b3f9948cc6e687a8dd0ccdf3cb8" + } + ], + "blockNumber": 43823761, + "cumulativeGasUsed": "332281", "status": 1, "byzantium": true }, "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0xAbE6106f9f051af72eE2dB752061e2a0f081c10B", - 1800, - 1800, - "0x0FE3869EA01Febb895Bc76DaB143858F84C67024", - 20 + "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", + "0x54812d17000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3000000000000000000000000813dcc76dba91dd9f6bdd038aea0877fc95656be00000000000000000000000000000000000000000000000000000000000007080000000000000000000000000000000000000000000000000000000000000708000000000000000000000000f67d956988cb11449db7aea80e6339b95b1605930000000000000000000000000000000000000000000000000000000000000014" ], - "numDeployments": 4, - "solcInputHash": "7b7733e7f1a8859e8b5512131ec1d587", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"},{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum ISortitionModule.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhase\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_K\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_STAKE_PATHS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"}],\"name\":\"changeMaxDrawingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"}],\"name\":\"changeMinStakingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"name\":\"changeRandomNumberGenerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"createDisputeHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeReadIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeWriteIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delayedStakes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputesWithoutJurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"executeDelayedStakes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastPhaseChange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDrawingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStakingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_randomNumber\",\"type\":\"uint256\"}],\"name\":\"notifyRandomNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum ISortitionModule.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"postDrawHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_stake\",\"type\":\"uint256\"}],\"name\":\"preStakeHook\",\"outputs\":[{\"internalType\":\"enum ISortitionModule.preStakeHookResult\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumberRequestBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngLookahead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"setJurorInactive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A factory of trees that keeps track of staked values for sortition.\",\"kind\":\"dev\",\"methods\":{\"changeMaxDrawingTime(uint256)\":{\"details\":\"Changes the `maxDrawingTime` storage variable.\",\"params\":{\"_maxDrawingTime\":\"The new value for the `maxDrawingTime` storage variable.\"}},\"changeMinStakingTime(uint256)\":{\"details\":\"Changes the `minStakingTime` storage variable.\",\"params\":{\"_minStakingTime\":\"The new value for the `minStakingTime` storage variable.\"}},\"changeRandomNumberGenerator(address,uint256)\":{\"details\":\"Changes the `_rng` and `_rngLookahead` storage variables.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\",\"_rngLookahead\":\"The new value for the `rngLookahead` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore.\",\"_maxDrawingTime\":\"Time after which the drawing phase can be switched\",\"_minStakingTime\":\"Minimal time to stake\",\"_rng\":\"The random number generator.\",\"_rngLookahead\":\"Lookahead value for rng.\"}},\"createTree(bytes32,bytes)\":{\"details\":\"Create a sortition sum tree at the specified key.\",\"params\":{\"_extraData\":\"Extra data that contains the number of children each node in the tree should have.\",\"_key\":\"The key of the new tree.\"}},\"draw(bytes32,uint256,uint256)\":{\"details\":\"Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.\",\"params\":{\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\",\"_key\":\"The key of the tree.\",\"_nonce\":\"Nonce to hash with random number.\"},\"returns\":{\"drawnAddress\":\"The drawn address. `O(k * log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.\"}},\"executeDelayedStakes(uint256)\":{\"details\":\"Executes the next delayed stakes.\",\"params\":{\"_iterations\":\"The number of delayed stakes to execute.\"}},\"notifyRandomNumber(uint256)\":{\"details\":\"Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().\",\"params\":{\"_randomNumber\":\"Random number returned by RNG contract.\"}},\"setJurorInactive(address)\":{\"details\":\"Unstakes the inactive juror from all courts. `O(n * (p * log_k(j)) )` where `n` is the number of courts the juror has staked in, `p` is the depth of the court tree, `k` is the minimum number of children per node of one of these courts' sortition sum tree, and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\",\"params\":{\"_account\":\"The juror to unstake.\"}},\"setStake(address,uint96,uint256)\":{\"details\":\"Sets the value for a particular court and its parent courts.\",\"params\":{\"_account\":\"Address of the juror. `O(log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.\",\"_courtID\":\"ID of the court.\",\"_value\":\"The new value.\"}}},\"title\":\"SortitionModule\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/SortitionModule.sol\":\"SortitionModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2 {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 public constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n /// @dev Constructor.\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n if (_courtID != GENERAL_COURT && courts[courts[_courtID].parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n if (courts[courts[_courtID].children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n courts[_courtID].minStake = _minStake;\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n courts[_courtID].alpha = _alpha;\\n courts[_courtID].feeForJuror = _feeForJuror;\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n CurrencyRate storage rate = currencyRates[_feeToken];\\n rate.rateInEth = _rateInEth;\\n rate.rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n require(_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount), \\\"Transfer failed\\\");\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit;\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKit.createDispute(_disputeID, _numberOfChoices, _extraData, extraRound.nbVotes);\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n CurrencyRate storage rate = currencyRates[_toToken];\\n return (_amountInEth * 10 ** rate.rateDecimals) / rate.rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == FORKING_COURT || courtID >= courts.length) {\\n courtID = GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = DEFAULT_NB_OF_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n}\\n\",\"keccak256\":\"0xc9f7a39d8996805b06b34b538277cd9250e56302bf9f259b4f16d1775f343bdd\",\"license\":\"MIT\"},\"src/arbitration/SortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @custom:authors: [@epiqueras, @unknownunknown1, @shotaronowhere]\\n * @custom:reviewers: []\\n * @custom:auditors: []\\n * @custom:bounties: []\\n * @custom:deployments: []\\n */\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./KlerosCore.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"../rng/RNG.sol\\\";\\n\\n/// @title SortitionModule\\n/// @dev A factory of trees that keeps track of staked values for sortition.\\ncontract SortitionModule is ISortitionModule {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of children per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant DEFAULT_K = 6; // Default number of children per node.\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The core arbitrator contract.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Drawing if there are open disputes.\\n uint256 public maxDrawingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public randomNumberRequestBlock; // Number of the block when RNG request was made.\\n uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors.\\n RNG public rng; // The random number generator.\\n uint256 public randomNumber; // Random number returned by RNG.\\n uint256 public rngLookahead; // Minimal block distance between requesting and obtaining a random number.\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees; // The mapping trees by keys.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Drawing phase, to update them when the phase is switched to Staking.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(address(governor) == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor.\\n /// @param _core The KlerosCore.\\n /// @param _minStakingTime Minimal time to stake\\n /// @param _maxDrawingTime Time after which the drawing phase can be switched\\n /// @param _rng The random number generator.\\n /// @param _rngLookahead Lookahead value for rng.\\n constructor(\\n address _governor,\\n KlerosCore _core,\\n uint256 _minStakingTime,\\n uint256 _maxDrawingTime,\\n RNG _rng,\\n uint256 _rngLookahead\\n ) {\\n governor = _governor;\\n core = _core;\\n minStakingTime = _minStakingTime;\\n maxDrawingTime = _maxDrawingTime;\\n lastPhaseChange = block.timestamp;\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Changes the `minStakingTime` storage variable.\\n /// @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /// @dev Changes the `maxDrawingTime` storage variable.\\n /// @param _maxDrawingTime The new value for the `maxDrawingTime` storage variable.\\n function changeMaxDrawingTime(uint256 _maxDrawingTime) external onlyByGovernor {\\n maxDrawingTime = _maxDrawingTime;\\n }\\n\\n /// @dev Changes the `_rng` and `_rngLookahead` storage variables.\\n /// @param _rng The new value for the `RNGenerator` storage variable.\\n /// @param _rngLookahead The new value for the `rngLookahead` storage variable.\\n function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n if (phase == Phase.generating) {\\n rng.requestRandomness(block.number + rngLookahead);\\n randomNumberRequestBlock = block.number;\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(\\n block.timestamp - lastPhaseChange >= minStakingTime,\\n \\\"The minimum staking time has not passed yet.\\\"\\n );\\n require(disputesWithoutJurors > 0, \\\"There are no disputes that need jurors.\\\");\\n rng.requestRandomness(block.number + rngLookahead);\\n randomNumberRequestBlock = block.number;\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n randomNumber = rng.receiveRandomness(randomNumberRequestBlock + rngLookahead);\\n require(randomNumber != 0, \\\"Random number is not ready yet\\\");\\n phase = Phase.drawing;\\n } else if (phase == Phase.drawing) {\\n require(\\n disputesWithoutJurors == 0 || block.timestamp - lastPhaseChange >= maxDrawingTime,\\n \\\"There are still disputes without jurors and the maximum drawing time has not passed yet.\\\"\\n );\\n phase = Phase.staking;\\n }\\n\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /// @dev Create a sortition sum tree at the specified key.\\n /// @param _key The key of the new tree.\\n /// @param _extraData Extra data that contains the number of children each node in the tree should have.\\n function createTree(bytes32 _key, bytes memory _extraData) external override onlyByCore {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n uint256 K = _extraDataToTreeK(_extraData);\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(K > 1, \\\"K must be greater than one.\\\");\\n tree.K = K;\\n tree.nodes.push(0);\\n }\\n\\n /// @dev Executes the next delayed stakes.\\n /// @param _iterations The number of delayed stakes to execute.\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"Should be in Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n core.setStakeBySortitionModule(delayedStake.account, delayedStake.courtID, delayedStake.stake);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n function preStakeHook(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake\\n ) external override onlyByCore returns (preStakeHookResult) {\\n (, , uint256 currentStake, uint256 nbCourts) = core.getJurorBalance(_account, _courtID);\\n if (currentStake == 0 && nbCourts >= MAX_STAKE_PATHS) {\\n // Prevent staking beyond MAX_STAKE_PATHS but unstaking is always allowed.\\n return preStakeHookResult.failed;\\n } else {\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake\\n });\\n return preStakeHookResult.delayed;\\n }\\n }\\n return preStakeHookResult.ok;\\n }\\n\\n function createDisputeHook(uint256 /*_disputeID*/, uint256 /*_roundID*/) external override onlyByCore {\\n disputesWithoutJurors++;\\n }\\n\\n function postDrawHook(uint256 /*_disputeID*/, uint256 /*_roundID*/) external override onlyByCore {\\n disputesWithoutJurors--;\\n }\\n\\n /// @dev Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().\\n /// @param _randomNumber Random number returned by RNG contract.\\n function notifyRandomNumber(uint256 _randomNumber) public override {}\\n\\n /// @dev Sets the value for a particular court and its parent courts.\\n /// @param _courtID ID of the court.\\n /// @param _value The new value.\\n /// @param _account Address of the juror.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function setStake(address _account, uint96 _courtID, uint256 _value) external override onlyByCore {\\n bytes32 stakePathID = _accountAndCourtIDToStakePathID(_account, _courtID);\\n bool finished = false;\\n uint96 currenCourtID = _courtID;\\n while (!finished) {\\n // Tokens are also implicitly staked in parent courts through sortition module to increase the chance of being drawn.\\n _set(bytes32(uint256(currenCourtID)), _value, stakePathID);\\n if (currenCourtID == core.GENERAL_COURT()) {\\n finished = true;\\n } else {\\n (currenCourtID, , , , , , ) = core.courts(currenCourtID);\\n }\\n }\\n }\\n\\n /// @dev Unstakes the inactive juror from all courts.\\n /// `O(n * (p * log_k(j)) )` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The juror to unstake.\\n function setJurorInactive(address _account) external override onlyByCore {\\n uint96[] memory courtIDs = core.getJurorCourtIDs(_account);\\n for (uint256 j = courtIDs.length; j > 0; j--) {\\n core.setStakeBySortitionModule(_account, courtIDs[j - 1], 0);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Draw an ID from a tree using a number.\\n /// Note that this function reverts if the sum of all values in the tree is 0.\\n /// @param _key The key of the tree.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core.\\n /// @param _nonce Nonce to hash with random number.\\n /// @return drawnAddress The drawn address.\\n /// `O(k * log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function draw(\\n bytes32 _key,\\n uint256 _coreDisputeID,\\n uint256 _nonce\\n ) public view override returns (address drawnAddress) {\\n require(phase == Phase.drawing, \\\"Wrong phase.\\\");\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n\\n if (tree.nodes[0] == 0) {\\n return address(0); // No jurors staked.\\n }\\n\\n uint256 currentDrawnNumber = uint256(keccak256(abi.encodePacked(randomNumber, _coreDisputeID, _nonce))) %\\n tree.nodes[0];\\n\\n // While it still has children\\n uint256 treeIndex = 0;\\n while ((tree.K * treeIndex) + 1 < tree.nodes.length) {\\n for (uint256 i = 1; i <= tree.K; i++) {\\n // Loop over children.\\n uint256 nodeIndex = (tree.K * treeIndex) + i;\\n uint256 nodeValue = tree.nodes[nodeIndex];\\n\\n if (currentDrawnNumber >= nodeValue) {\\n // Go to the next child.\\n currentDrawnNumber -= nodeValue;\\n } else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n }\\n drawnAddress = _stakePathIDToAccount(tree.nodeIndexesToIDs[treeIndex]);\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Update all the parents of a node.\\n /// @param _key The key of the tree to update.\\n /// @param _treeIndex The index of the node to start from.\\n /// @param _plusOrMinus Whether to add (true) or substract (false).\\n /// @param _value The value to add or substract.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function _updateParents(bytes32 _key, uint256 _treeIndex, bool _plusOrMinus, uint256 _value) private {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n\\n /// @dev Retrieves a juror's address from the stake path ID.\\n /// @param _stakePathID The stake path ID to unpack.\\n /// @return account The account.\\n function _stakePathIDToAccount(bytes32 _stakePathID) internal pure returns (address account) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(add(ptr, 0x0c), i), byte(i, _stakePathID))\\n }\\n account := mload(ptr)\\n }\\n }\\n\\n function _extraDataToTreeK(bytes memory _extraData) internal pure returns (uint256 K) {\\n if (_extraData.length >= 32) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n K := mload(add(_extraData, 0x20))\\n }\\n } else {\\n K = DEFAULT_K;\\n }\\n }\\n\\n /// @dev Set a value in a tree.\\n /// @param _key The key of the tree.\\n /// @param _value The new value.\\n /// @param _ID The ID of the value.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function _set(bytes32 _key, uint256 _value, bytes32 _ID) internal {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n _updateParents(_key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n _updateParents(_key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n _updateParents(_key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /// @dev Packs an account and a court ID into a stake path ID.\\n /// @param _account The address of the juror to pack.\\n /// @param _courtID The court ID to pack.\\n /// @return stakePathID The stake path ID.\\n function _accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3afe57017332cc7f99c73920201c2eaecd1d9e8a4309611c77ca3d80494d8e8d\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\ninterface RNG {\\n /// @dev Request a random number.\\n /// @param _block Block linked to the request.\\n function requestRandomness(uint256 _block) external;\\n\\n /// @dev Receive the random number.\\n /// @param _block Block the random number is linked to.\\n /// @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x5afe7121f49aebe72218df356bd91b66c2171b9ad15e7945a15a091784291a43\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040526001600b553480156200001657600080fd5b5060405162001d9c38038062001d9c8339810160408190526200003991620000a9565b600080546001600160a01b03199081166001600160a01b039889161790915560018054821696881696909617909555600293909355600391909155426004556007805490931693169290921790556009556200011a565b6001600160a01b0381168114620000a657600080fd5b50565b60008060008060008060c08789031215620000c357600080fd5b8651620000d08162000090565b6020880151909650620000e38162000090565b8095505060408701519350606087015192506080870151620001058162000090565b8092505060a087015190509295509295509295565b611c72806200012a6000396000f3fe608060405234801561001057600080fd5b506004361061018f5760003560e01c8063684fbf5f116100e4578063c057eca711610092578063c057eca7146102ff578063c157261814610308578063ccbac9f514610311578063d09f392d1461031a578063d605787b1461032d578063dd5e5cb514610340578063f2f4eb2614610353578063f6b4d82d1461036657600080fd5b8063684fbf5f1461028b5780637dc38f14146102ab578063823cfd70146102b4578063b1c9fe6e146102c7578063b4a61608146102db578063b5d69e99146102e3578063b888adfa146102f657600080fd5b806335975f4a1161014157806335975f4a1461021057806345988e2c14610223578063477a655c146102365780634c70a0d6146102495780634dbbebbc1461025c57806356acb0501461026f5780635d2d78461461027857600080fd5b806303432744146101945780630b274f2e146101b05780630b51806d146101ba5780630c340a24146101c25780630e083ec9146101ed5780631b92bbbe146101f657806321ea9b3f146101ff575b600080fd5b61019d60065481565b6040519081526020015b60405180910390f35b6101b86103b8565b005b61019d600681565b6000546101d5906001600160a01b031681565b6040516001600160a01b0390911681526020016101a7565b61019d600a5481565b61019d60035481565b6101b861020d3660046116b7565b50565b6101b861021e3660046116b7565b610790565b6101b86102313660046116fa565b610921565b6101b8610244366004611782565b610a9a565b6101d5610257366004611821565b610b91565b6101b861026a36600461184d565b610d75565b61019d600b5481565b6101b8610286366004611879565b610e5e565b61029e6102993660046116fa565b610ea1565b6040516101a791906118cf565b61019d60095481565b6101b86102c23660046116b7565b61103a565b60015461029e90600160a01b900460ff1681565b61019d600481565b6101b86102f13660046118e2565b611069565b61019d60045481565b61019d60025481565b61019d60055481565b61019d60085481565b6101b8610328366004611879565b6111b6565b6007546101d5906001600160a01b031681565b6101b861034e3660046116b7565b6111f0565b6001546101d5906001600160a01b031681565b6103a96103743660046116b7565b600d60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b6040516101a7939291906118ff565b6000600154600160a01b900460ff1660028111156103d8576103d861189b565b0361054b576002546004546103ed904261193f565b10156104555760405162461bcd60e51b815260206004820152602c60248201527f546865206d696e696d756d207374616b696e672074696d6520686173206e6f7460448201526b103830b9b9b2b2103cb2ba1760a11b60648201526084015b60405180910390fd5b6000600654116104b75760405162461bcd60e51b815260206004820152602760248201527f546865726520617265206e6f2064697370757465732074686174206e65656420604482015266353ab937b9399760c91b606482015260840161044c565b6007546009546001600160a01b0390911690637363ae1f906104d99043611958565b6040518263ffffffff1660e01b81526004016104f791815260200190565b600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505043600555505060018054819060ff60a01b1916600160a01b825b0217905550610745565b60018054600160a01b900460ff16600281111561056a5761056a61189b565b03610662576007546009546005546001600160a01b03909216916313cf90549161059391611958565b6040518263ffffffff1660e01b81526004016105b191815260200190565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f4919061196b565b60088190556000036106485760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161044c565b600180546002919060ff60a01b1916600160a01b83610541565b6002600154600160a01b900460ff1660028111156106825761068261189b565b036107455760065415806106a457506003546004546106a1904261193f565b10155b6107375760405162461bcd60e51b815260206004820152605860248201527f546865726520617265207374696c6c20646973707574657320776974686f757460448201527f206a75726f727320616e6420746865206d6178696d756d2064726177696e67206064820152773a34b6b2903430b9903737ba103830b9b9b2b2103cb2ba1760411b608482015260a40161044c565b6001805460ff60a01b191690555b426004556001546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161078691600160a01b90910460ff16906118cf565b60405180910390a1565b6000600154600160a01b900460ff1660028111156107b0576107b061189b565b146107fd5760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e0000000000604482015260640161044c565b6000600a54600183600b546108129190611958565b61081c919061193f565b116108275781610842565b600b54600a54610837919061193f565b610842906001611958565b9050600081600b546108549190611958565b600b549091505b81811015610919576000818152600d602052604090819020600180548254918301549351630761c14d60e01b815292936001600160a01b0391821693630761c14d936108be93811692600160a01b9091046001600160601b0316916004016118ff565b600060405180830381600087803b1580156108d857600080fd5b505af11580156108ec573d6000803e3d6000fd5b5050506000838152600d60205260408120818155600101555081905061091181611984565b91505061085b565b50600b555050565b6001546001600160a01b0316331461094b5760405162461bcd60e51b815260040161044c9061199d565b6000610957848461121f565b90506000835b81610a92576109766001600160601b0382168585611267565b600160009054906101000a90046001600160a01b03166001600160a01b03166334d5fb316040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed91906119e1565b6001600160601b0316816001600160601b031603610a0e576001915061095d565b600154604051630fad06e960e11b81526001600160601b03831660048201526001600160a01b0390911690631f5a0dd29060240160e060405180830381865afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a839190611a0e565b5094955061095d945050505050565b505050505050565b6001546001600160a01b03163314610ac45760405162461bcd60e51b815260040161044c9061199d565b6000828152600c6020526040812090610adc836115bb565b825490915015610b255760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b604482015260640161044c565b60018111610b755760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e0000000000604482015260640161044c565b8155600201805460018101825560009182526020822001555050565b60006002600154600160a01b900460ff166002811115610bb357610bb361189b565b14610bef5760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b604482015260640161044c565b6000848152600c6020526040812060028101805491929091610c1357610c13611a7a565b9060005260206000200154600003610c2f576000915050610d6e565b600081600201600081548110610c4757610c47611a7a565b90600052602060002001546008548686604051602001610c7a939291909283526020830191909152604082015260600190565b6040516020818303038152906040528051906020012060001c610c9d9190611aa6565b905060005b60028301548354610cb4908390611aba565b610cbf906001611958565b1015610d4e5760015b83548111610d4857600081838660000154610ce39190611aba565b610ced9190611958565b90506000856002018281548110610d0657610d06611a7a565b90600052602060002001549050808510610d2b57610d24818661193f565b9450610d33565b509150610d48565b50508080610d4090611984565b915050610cc8565b50610ca2565b6000818152600484016020526040902054610d68906115d7565b93505050505b9392505050565b6000546001600160a01b03163314610d9f5760405162461bcd60e51b815260040161044c90611ad1565b600780546001600160a01b0319166001600160a01b038416179055600981905560018054600160a01b900460ff166002811115610dde57610dde61189b565b03610e5a576007546009546001600160a01b0390911690637363ae1f90610e059043611958565b6040518263ffffffff1660e01b8152600401610e2391815260200190565b600060405180830381600087803b158015610e3d57600080fd5b505af1158015610e51573d6000803e3d6000fd5b50504360055550505b5050565b6001546001600160a01b03163314610e885760405162461bcd60e51b815260040161044c9061199d565b60068054906000610e9883611b13565b91905055505050565b6001546000906001600160a01b03163314610ece5760405162461bcd60e51b815260040161044c9061199d565b600154604051631a383be960e31b81526001600160a01b0386811660048301526001600160601b0386166024830152600092839291169063d1c1df4890604401608060405180830381865afa158015610f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4f9190611b2a565b935093505050816000148015610f66575060048110155b15610f7657600292505050610d6e565b6000600154600160a01b900460ff166002811115610f9657610f9661189b565b1461102e576040518060600160405280876001600160a01b03168152602001866001600160601b0316815260200185815250600d6000600a60008154610fdb90611984565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b0390931692909217825591909101516001918201559250610d6e915050565b50600095945050505050565b6000546001600160a01b031633146110645760405162461bcd60e51b815260040161044c90611ad1565b600255565b6001546001600160a01b031633146110935760405162461bcd60e51b815260040161044c9061199d565b600154604051632a1fc51b60e11b81526001600160a01b038381166004830152600092169063543f8a3690602401600060405180830381865afa1580156110de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111069190810190611b60565b80519091505b80156111b157600180546001600160a01b031690630761c14d9085908590611134908661193f565b8151811061114457611144611a7a565b602002602001015160006040518463ffffffff1660e01b815260040161116c939291906118ff565b600060405180830381600087803b15801561118657600080fd5b505af115801561119a573d6000803e3d6000fd5b5050505080806111a990611b13565b91505061110c565b505050565b6001546001600160a01b031633146111e05760405162461bcd60e51b815260040161044c9061199d565b60068054906000610e9883611984565b6000546001600160a01b0316331461121a5760405162461bcd60e51b815260040161044c90611ad1565b600355565b600060405160005b6014811015611242578481600c011a81830153600101611227565b5060145b602081101561125e5783811a81830153600101611246565b50519392505050565b6000838152600c6020908152604080832084845260038101909252822054909181900361143457831561142f5760018201546000036113825750600281018054600180820183556000928352602090922081018590559081148015906112e1575081546112d560018361193f565b6112df9190611aa6565b155b1561137d5781546000906112f59083611c12565b6000818152600485016020526040812054919250611314846001611958565b90508460020185600201848154811061132f5761132f611a7a565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b6113fd565b6001808301805490916113949161193f565b815481106113a4576113a4611a7a565b90600052602060002001549050816001018054806113c4576113c4611c26565b60019003818190600052602060002001600090559055838260020182815481106113f0576113f0611a7a565b6000918252602090912001555b6000838152600383016020908152604080832084905583835260048501909152902083905561142f8582600187611602565b6115b4565b836000036114d257600082600201828154811061145357611453611a7a565b90600052602060002001549050600083600201838154811061147757611477611a7a565b60009182526020808320909101929092556001808601805491820181558252828220018490558581526003850182526040808220829055848252600486019092529081208190556114cc908790849084611602565b506115b4565b8160020181815481106114e7576114e7611a7a565b906000526020600020015484146115b45760008483600201838154811061151057611510611a7a565b906000526020600020015411159050600081611556578584600201848154811061153c5761153c611a7a565b9060005260206000200154611551919061193f565b611581565b83600201838154811061156b5761156b611a7a565b906000526020600020015486611581919061193f565b90508584600201848154811061159957611599611a7a565b6000918252602090912001556115b187848484611602565b50505b5050505050565b600060208251106115ce57506020015190565b5060065b919050565b600060405160005b60148110156115fa5783811a81600c840101536001016115df565b505192915050565b6000848152600c60205260409020835b8015610a9257815461162560018361193f565b61162f9190611c12565b905083611666578282600201828154811061164c5761164c611a7a565b9060005260206000200154611661919061193f565b611691565b8282600201828154811061167c5761167c611a7a565b90600052602060002001546116919190611958565b8260020182815481106116a6576116a6611a7a565b600091825260209091200155611612565b6000602082840312156116c957600080fd5b5035919050565b6001600160a01b038116811461020d57600080fd5b6001600160601b038116811461020d57600080fd5b60008060006060848603121561170f57600080fd5b833561171a816116d0565b9250602084013561172a816116e5565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561177a5761177a61173b565b604052919050565b6000806040838503121561179557600080fd5b8235915060208084013567ffffffffffffffff808211156117b557600080fd5b818601915086601f8301126117c957600080fd5b8135818111156117db576117db61173b565b6117ed601f8201601f19168501611751565b9150808252878482850101111561180357600080fd5b80848401858401376000848284010152508093505050509250929050565b60008060006060848603121561183657600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561186057600080fd5b823561186b816116d0565b946020939093013593505050565b6000806040838503121561188c57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6003811061020d57634e487b7160e01b600052602160045260246000fd5b602081016118dc836118b1565b91905290565b6000602082840312156118f457600080fd5b8135610d6e816116d0565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561195257611952611929565b92915050565b8082018082111561195257611952611929565b60006020828403121561197d57600080fd5b5051919050565b60006001820161199657611996611929565b5060010190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6000602082840312156119f357600080fd5b8151610d6e816116e5565b805180151581146115d257600080fd5b600080600080600080600060e0888a031215611a2957600080fd5b8751611a34816116e5565b9650611a42602089016119fe565b955060408801519450606088015193506080880151925060a08801519150611a6c60c089016119fe565b905092959891949750929550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600082611ab557611ab5611a90565b500690565b808202811582820484141761195257611952611929565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600081611b2257611b22611929565b506000190190565b60008060008060808587031215611b4057600080fd5b505082516020840151604085015160609095015191969095509092509050565b60006020808385031215611b7357600080fd5b825167ffffffffffffffff80821115611b8b57600080fd5b818501915085601f830112611b9f57600080fd5b815181811115611bb157611bb161173b565b8060051b9150611bc2848301611751565b8181529183018401918481019088841115611bdc57600080fd5b938501935b83851015611c065784519250611bf6836116e5565b8282529385019390850190611be1565b98975050505050505050565b600082611c2157611c21611a90565b500490565b634e487b7160e01b600052603160045260246000fdfea26469706673582212209cfab488d83b98c47f2593754fde71c2b6ca7b66d78f73c52dd756e02df80a9864736f6c63430008120033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018f5760003560e01c8063684fbf5f116100e4578063c057eca711610092578063c057eca7146102ff578063c157261814610308578063ccbac9f514610311578063d09f392d1461031a578063d605787b1461032d578063dd5e5cb514610340578063f2f4eb2614610353578063f6b4d82d1461036657600080fd5b8063684fbf5f1461028b5780637dc38f14146102ab578063823cfd70146102b4578063b1c9fe6e146102c7578063b4a61608146102db578063b5d69e99146102e3578063b888adfa146102f657600080fd5b806335975f4a1161014157806335975f4a1461021057806345988e2c14610223578063477a655c146102365780634c70a0d6146102495780634dbbebbc1461025c57806356acb0501461026f5780635d2d78461461027857600080fd5b806303432744146101945780630b274f2e146101b05780630b51806d146101ba5780630c340a24146101c25780630e083ec9146101ed5780631b92bbbe146101f657806321ea9b3f146101ff575b600080fd5b61019d60065481565b6040519081526020015b60405180910390f35b6101b86103b8565b005b61019d600681565b6000546101d5906001600160a01b031681565b6040516001600160a01b0390911681526020016101a7565b61019d600a5481565b61019d60035481565b6101b861020d3660046116b7565b50565b6101b861021e3660046116b7565b610790565b6101b86102313660046116fa565b610921565b6101b8610244366004611782565b610a9a565b6101d5610257366004611821565b610b91565b6101b861026a36600461184d565b610d75565b61019d600b5481565b6101b8610286366004611879565b610e5e565b61029e6102993660046116fa565b610ea1565b6040516101a791906118cf565b61019d60095481565b6101b86102c23660046116b7565b61103a565b60015461029e90600160a01b900460ff1681565b61019d600481565b6101b86102f13660046118e2565b611069565b61019d60045481565b61019d60025481565b61019d60055481565b61019d60085481565b6101b8610328366004611879565b6111b6565b6007546101d5906001600160a01b031681565b6101b861034e3660046116b7565b6111f0565b6001546101d5906001600160a01b031681565b6103a96103743660046116b7565b600d60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b6040516101a7939291906118ff565b6000600154600160a01b900460ff1660028111156103d8576103d861189b565b0361054b576002546004546103ed904261193f565b10156104555760405162461bcd60e51b815260206004820152602c60248201527f546865206d696e696d756d207374616b696e672074696d6520686173206e6f7460448201526b103830b9b9b2b2103cb2ba1760a11b60648201526084015b60405180910390fd5b6000600654116104b75760405162461bcd60e51b815260206004820152602760248201527f546865726520617265206e6f2064697370757465732074686174206e65656420604482015266353ab937b9399760c91b606482015260840161044c565b6007546009546001600160a01b0390911690637363ae1f906104d99043611958565b6040518263ffffffff1660e01b81526004016104f791815260200190565b600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505043600555505060018054819060ff60a01b1916600160a01b825b0217905550610745565b60018054600160a01b900460ff16600281111561056a5761056a61189b565b03610662576007546009546005546001600160a01b03909216916313cf90549161059391611958565b6040518263ffffffff1660e01b81526004016105b191815260200190565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f4919061196b565b60088190556000036106485760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161044c565b600180546002919060ff60a01b1916600160a01b83610541565b6002600154600160a01b900460ff1660028111156106825761068261189b565b036107455760065415806106a457506003546004546106a1904261193f565b10155b6107375760405162461bcd60e51b815260206004820152605860248201527f546865726520617265207374696c6c20646973707574657320776974686f757460448201527f206a75726f727320616e6420746865206d6178696d756d2064726177696e67206064820152773a34b6b2903430b9903737ba103830b9b9b2b2103cb2ba1760411b608482015260a40161044c565b6001805460ff60a01b191690555b426004556001546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161078691600160a01b90910460ff16906118cf565b60405180910390a1565b6000600154600160a01b900460ff1660028111156107b0576107b061189b565b146107fd5760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e0000000000604482015260640161044c565b6000600a54600183600b546108129190611958565b61081c919061193f565b116108275781610842565b600b54600a54610837919061193f565b610842906001611958565b9050600081600b546108549190611958565b600b549091505b81811015610919576000818152600d602052604090819020600180548254918301549351630761c14d60e01b815292936001600160a01b0391821693630761c14d936108be93811692600160a01b9091046001600160601b0316916004016118ff565b600060405180830381600087803b1580156108d857600080fd5b505af11580156108ec573d6000803e3d6000fd5b5050506000838152600d60205260408120818155600101555081905061091181611984565b91505061085b565b50600b555050565b6001546001600160a01b0316331461094b5760405162461bcd60e51b815260040161044c9061199d565b6000610957848461121f565b90506000835b81610a92576109766001600160601b0382168585611267565b600160009054906101000a90046001600160a01b03166001600160a01b03166334d5fb316040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed91906119e1565b6001600160601b0316816001600160601b031603610a0e576001915061095d565b600154604051630fad06e960e11b81526001600160601b03831660048201526001600160a01b0390911690631f5a0dd29060240160e060405180830381865afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a839190611a0e565b5094955061095d945050505050565b505050505050565b6001546001600160a01b03163314610ac45760405162461bcd60e51b815260040161044c9061199d565b6000828152600c6020526040812090610adc836115bb565b825490915015610b255760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b604482015260640161044c565b60018111610b755760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e0000000000604482015260640161044c565b8155600201805460018101825560009182526020822001555050565b60006002600154600160a01b900460ff166002811115610bb357610bb361189b565b14610bef5760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b604482015260640161044c565b6000848152600c6020526040812060028101805491929091610c1357610c13611a7a565b9060005260206000200154600003610c2f576000915050610d6e565b600081600201600081548110610c4757610c47611a7a565b90600052602060002001546008548686604051602001610c7a939291909283526020830191909152604082015260600190565b6040516020818303038152906040528051906020012060001c610c9d9190611aa6565b905060005b60028301548354610cb4908390611aba565b610cbf906001611958565b1015610d4e5760015b83548111610d4857600081838660000154610ce39190611aba565b610ced9190611958565b90506000856002018281548110610d0657610d06611a7a565b90600052602060002001549050808510610d2b57610d24818661193f565b9450610d33565b509150610d48565b50508080610d4090611984565b915050610cc8565b50610ca2565b6000818152600484016020526040902054610d68906115d7565b93505050505b9392505050565b6000546001600160a01b03163314610d9f5760405162461bcd60e51b815260040161044c90611ad1565b600780546001600160a01b0319166001600160a01b038416179055600981905560018054600160a01b900460ff166002811115610dde57610dde61189b565b03610e5a576007546009546001600160a01b0390911690637363ae1f90610e059043611958565b6040518263ffffffff1660e01b8152600401610e2391815260200190565b600060405180830381600087803b158015610e3d57600080fd5b505af1158015610e51573d6000803e3d6000fd5b50504360055550505b5050565b6001546001600160a01b03163314610e885760405162461bcd60e51b815260040161044c9061199d565b60068054906000610e9883611b13565b91905055505050565b6001546000906001600160a01b03163314610ece5760405162461bcd60e51b815260040161044c9061199d565b600154604051631a383be960e31b81526001600160a01b0386811660048301526001600160601b0386166024830152600092839291169063d1c1df4890604401608060405180830381865afa158015610f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4f9190611b2a565b935093505050816000148015610f66575060048110155b15610f7657600292505050610d6e565b6000600154600160a01b900460ff166002811115610f9657610f9661189b565b1461102e576040518060600160405280876001600160a01b03168152602001866001600160601b0316815260200185815250600d6000600a60008154610fdb90611984565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b0390931692909217825591909101516001918201559250610d6e915050565b50600095945050505050565b6000546001600160a01b031633146110645760405162461bcd60e51b815260040161044c90611ad1565b600255565b6001546001600160a01b031633146110935760405162461bcd60e51b815260040161044c9061199d565b600154604051632a1fc51b60e11b81526001600160a01b038381166004830152600092169063543f8a3690602401600060405180830381865afa1580156110de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111069190810190611b60565b80519091505b80156111b157600180546001600160a01b031690630761c14d9085908590611134908661193f565b8151811061114457611144611a7a565b602002602001015160006040518463ffffffff1660e01b815260040161116c939291906118ff565b600060405180830381600087803b15801561118657600080fd5b505af115801561119a573d6000803e3d6000fd5b5050505080806111a990611b13565b91505061110c565b505050565b6001546001600160a01b031633146111e05760405162461bcd60e51b815260040161044c9061199d565b60068054906000610e9883611984565b6000546001600160a01b0316331461121a5760405162461bcd60e51b815260040161044c90611ad1565b600355565b600060405160005b6014811015611242578481600c011a81830153600101611227565b5060145b602081101561125e5783811a81830153600101611246565b50519392505050565b6000838152600c6020908152604080832084845260038101909252822054909181900361143457831561142f5760018201546000036113825750600281018054600180820183556000928352602090922081018590559081148015906112e1575081546112d560018361193f565b6112df9190611aa6565b155b1561137d5781546000906112f59083611c12565b6000818152600485016020526040812054919250611314846001611958565b90508460020185600201848154811061132f5761132f611a7a565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b6113fd565b6001808301805490916113949161193f565b815481106113a4576113a4611a7a565b90600052602060002001549050816001018054806113c4576113c4611c26565b60019003818190600052602060002001600090559055838260020182815481106113f0576113f0611a7a565b6000918252602090912001555b6000838152600383016020908152604080832084905583835260048501909152902083905561142f8582600187611602565b6115b4565b836000036114d257600082600201828154811061145357611453611a7a565b90600052602060002001549050600083600201838154811061147757611477611a7a565b60009182526020808320909101929092556001808601805491820181558252828220018490558581526003850182526040808220829055848252600486019092529081208190556114cc908790849084611602565b506115b4565b8160020181815481106114e7576114e7611a7a565b906000526020600020015484146115b45760008483600201838154811061151057611510611a7a565b906000526020600020015411159050600081611556578584600201848154811061153c5761153c611a7a565b9060005260206000200154611551919061193f565b611581565b83600201838154811061156b5761156b611a7a565b906000526020600020015486611581919061193f565b90508584600201848154811061159957611599611a7a565b6000918252602090912001556115b187848484611602565b50505b5050505050565b600060208251106115ce57506020015190565b5060065b919050565b600060405160005b60148110156115fa5783811a81600c840101536001016115df565b505192915050565b6000848152600c60205260409020835b8015610a9257815461162560018361193f565b61162f9190611c12565b905083611666578282600201828154811061164c5761164c611a7a565b9060005260206000200154611661919061193f565b611691565b8282600201828154811061167c5761167c611a7a565b90600052602060002001546116919190611958565b8260020182815481106116a6576116a6611a7a565b600091825260209091200155611612565b6000602082840312156116c957600080fd5b5035919050565b6001600160a01b038116811461020d57600080fd5b6001600160601b038116811461020d57600080fd5b60008060006060848603121561170f57600080fd5b833561171a816116d0565b9250602084013561172a816116e5565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561177a5761177a61173b565b604052919050565b6000806040838503121561179557600080fd5b8235915060208084013567ffffffffffffffff808211156117b557600080fd5b818601915086601f8301126117c957600080fd5b8135818111156117db576117db61173b565b6117ed601f8201601f19168501611751565b9150808252878482850101111561180357600080fd5b80848401858401376000848284010152508093505050509250929050565b60008060006060848603121561183657600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561186057600080fd5b823561186b816116d0565b946020939093013593505050565b6000806040838503121561188c57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6003811061020d57634e487b7160e01b600052602160045260246000fd5b602081016118dc836118b1565b91905290565b6000602082840312156118f457600080fd5b8135610d6e816116d0565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561195257611952611929565b92915050565b8082018082111561195257611952611929565b60006020828403121561197d57600080fd5b5051919050565b60006001820161199657611996611929565b5060010190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6000602082840312156119f357600080fd5b8151610d6e816116e5565b805180151581146115d257600080fd5b600080600080600080600060e0888a031215611a2957600080fd5b8751611a34816116e5565b9650611a42602089016119fe565b955060408801519450606088015193506080880151925060a08801519150611a6c60c089016119fe565b905092959891949750929550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600082611ab557611ab5611a90565b500690565b808202811582820484141761195257611952611929565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600081611b2257611b22611929565b506000190190565b60008060008060808587031215611b4057600080fd5b505082516020840151604085015160609095015191969095509092509050565b60006020808385031215611b7357600080fd5b825167ffffffffffffffff80821115611b8b57600080fd5b818501915085601f830112611b9f57600080fd5b815181811115611bb157611bb161173b565b8060051b9150611bc2848301611751565b8181529183018401918481019088841115611bdc57600080fd5b938501935b83851015611c065784519250611bf6836116e5565b8282529385019390850190611be1565b98975050505050505050565b600082611c2157611c21611a90565b500490565b634e487b7160e01b600052603160045260246000fdfea26469706673582212209cfab488d83b98c47f2593754fde71c2b6ca7b66d78f73c52dd756e02df80a9864736f6c63430008120033", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x813DCc76dbA91DD9f6bDD038aea0877FC95656bE", + 1800, + 1800, + "0xF67D956988cb11449db7aeA80E6339b95b160593", + 20 + ] + }, + "implementation": "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", "devdoc": { - "details": "A factory of trees that keeps track of staked values for sortition.", + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "changeMaxDrawingTime(uint256)": { - "details": "Changes the `maxDrawingTime` storage variable.", - "params": { - "_maxDrawingTime": "The new value for the `maxDrawingTime` storage variable." - } - }, - "changeMinStakingTime(uint256)": { - "details": "Changes the `minStakingTime` storage variable.", - "params": { - "_minStakingTime": "The new value for the `minStakingTime` storage variable." - } - }, - "changeRandomNumberGenerator(address,uint256)": { - "details": "Changes the `_rng` and `_rngLookahead` storage variables.", - "params": { - "_rng": "The new value for the `RNGenerator` storage variable.", - "_rngLookahead": "The new value for the `rngLookahead` storage variable." - } - }, "constructor": { - "details": "Constructor.", - "params": { - "_core": "The KlerosCore.", - "_maxDrawingTime": "Time after which the drawing phase can be switched", - "_minStakingTime": "Minimal time to stake", - "_rng": "The random number generator.", - "_rngLookahead": "Lookahead value for rng." - } - }, - "createTree(bytes32,bytes)": { - "details": "Create a sortition sum tree at the specified key.", - "params": { - "_extraData": "Extra data that contains the number of children each node in the tree should have.", - "_key": "The key of the new tree." - } - }, - "draw(bytes32,uint256,uint256)": { - "details": "Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.", - "params": { - "_coreDisputeID": "Index of the dispute in Kleros Core.", - "_key": "The key of the tree.", - "_nonce": "Nonce to hash with random number." - }, - "returns": { - "drawnAddress": "The drawn address. `O(k * log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended." - } - }, - "executeDelayedStakes(uint256)": { - "details": "Executes the next delayed stakes.", - "params": { - "_iterations": "The number of delayed stakes to execute." - } - }, - "notifyRandomNumber(uint256)": { - "details": "Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().", - "params": { - "_randomNumber": "Random number returned by RNG contract." - } - }, - "setJurorInactive(address)": { - "details": "Unstakes the inactive juror from all courts. `O(n * (p * log_k(j)) )` where `n` is the number of courts the juror has staked in, `p` is the depth of the court tree, `k` is the minimum number of children per node of one of these courts' sortition sum tree, and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.", - "params": { - "_account": "The juror to unstake." - } - }, - "setStake(address,uint96,uint256)": { - "details": "Sets the value for a particular court and its parent courts.", - "params": { - "_account": "Address of the juror. `O(log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.", - "_courtID": "ID of the court.", - "_value": "The new value." - } + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" } }, - "title": "SortitionModule", + "title": "UUPS Proxy", "version": 1 }, "userdoc": { @@ -616,276 +698,7 @@ "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 8249, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8252, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "core", - "offset": 0, - "slot": "1", - "type": "t_contract(KlerosCore)6744" - }, - { - "astId": 8255, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "phase", - "offset": 20, - "slot": "1", - "type": "t_enum(Phase)15580" - }, - { - "astId": 8257, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "minStakingTime", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 8259, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "maxDrawingTime", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 8261, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "lastPhaseChange", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 8263, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "randomNumberRequestBlock", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 8265, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "disputesWithoutJurors", - "offset": 0, - "slot": "6", - "type": "t_uint256" - }, - { - "astId": 8268, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "rng", - "offset": 0, - "slot": "7", - "type": "t_contract(RNG)21646" - }, - { - "astId": 8270, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "randomNumber", - "offset": 0, - "slot": "8", - "type": "t_uint256" - }, - { - "astId": 8272, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "rngLookahead", - "offset": 0, - "slot": "9", - "type": "t_uint256" - }, - { - "astId": 8274, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "delayedStakeWriteIndex", - "offset": 0, - "slot": "10", - "type": "t_uint256" - }, - { - "astId": 8277, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "delayedStakeReadIndex", - "offset": 0, - "slot": "11", - "type": "t_uint256" - }, - { - "astId": 8282, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "sortitionSumTrees", - "offset": 0, - "slot": "12", - "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)8234_storage)" - }, - { - "astId": 8287, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "delayedStakes", - "offset": 0, - "slot": "13", - "type": "t_mapping(t_uint256,t_struct(DelayedStake)8241_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_uint256)dyn_storage": { - "base": "t_uint256", - "encoding": "dynamic_array", - "label": "uint256[]", - "numberOfBytes": "32" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(KlerosCore)6744": { - "encoding": "inplace", - "label": "contract KlerosCore", - "numberOfBytes": "20" - }, - "t_contract(RNG)21646": { - "encoding": "inplace", - "label": "contract RNG", - "numberOfBytes": "20" - }, - "t_enum(Phase)15580": { - "encoding": "inplace", - "label": "enum ISortitionModule.Phase", - "numberOfBytes": "1" - }, - "t_mapping(t_bytes32,t_struct(SortitionSumTree)8234_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct SortitionModule.SortitionSumTree)", - "numberOfBytes": "32", - "value": "t_struct(SortitionSumTree)8234_storage" - }, - "t_mapping(t_bytes32,t_uint256)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_uint256,t_bytes32)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bytes32)", - "numberOfBytes": "32", - "value": "t_bytes32" - }, - "t_mapping(t_uint256,t_struct(DelayedStake)8241_storage)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => struct SortitionModule.DelayedStake)", - "numberOfBytes": "32", - "value": "t_struct(DelayedStake)8241_storage" - }, - "t_struct(DelayedStake)8241_storage": { - "encoding": "inplace", - "label": "struct SortitionModule.DelayedStake", - "members": [ - { - "astId": 8236, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "account", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8238, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "courtID", - "offset": 20, - "slot": "0", - "type": "t_uint96" - }, - { - "astId": 8240, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "stake", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "numberOfBytes": "64" - }, - "t_struct(SortitionSumTree)8234_storage": { - "encoding": "inplace", - "label": "struct SortitionModule.SortitionSumTree", - "members": [ - { - "astId": 8219, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "K", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 8222, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "stack", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 8225, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "nodes", - "offset": 0, - "slot": "2", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 8229, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "IDsToNodeIndexes", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 8233, - "contract": "src/arbitration/SortitionModule.sol:SortitionModule", - "label": "nodeIndexesToIDs", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_uint256,t_bytes32)" - } - ], - "numberOfBytes": "160" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Implementation.json b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Implementation.json new file mode 100644 index 000000000..f803fe851 --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Implementation.json @@ -0,0 +1,1065 @@ +{ + "address": "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ISortitionModule.Phase", + "name": "_phase", + "type": "uint8" + } + ], + "name": "NewPhase", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_K", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_STAKE_PATHS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxDrawingTime", + "type": "uint256" + } + ], + "name": "changeMaxDrawingTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minStakingTime", + "type": "uint256" + } + ], + "name": "changeMinStakingTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract RNG", + "name": "_rng", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_rngLookahead", + "type": "uint256" + } + ], + "name": "changeRandomNumberGenerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract KlerosCore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "createDisputeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "delayedStakeReadIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "delayedStakeWriteIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delayedStakes", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputesWithoutJurors", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "name": "draw", + "outputs": [ + { + "internalType": "address", + "name": "drawnAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_iterations", + "type": "uint256" + } + ], + "name": "executeDelayedStakes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minStakingTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxDrawingTime", + "type": "uint256" + }, + { + "internalType": "contract RNG", + "name": "_rng", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_rngLookahead", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastPhaseChange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxDrawingTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minStakingTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_randomNumber", + "type": "uint256" + } + ], + "name": "notifyRandomNumber", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "passPhase", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "phase", + "outputs": [ + { + "internalType": "enum ISortitionModule.Phase", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "postDrawHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_stake", + "type": "uint256" + } + ], + "name": "preStakeHook", + "outputs": [ + { + "internalType": "enum ISortitionModule.preStakeHookResult", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "randomNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "randomNumberRequestBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rng", + "outputs": [ + { + "internalType": "contract RNG", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rngLookahead", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "setJurorInactive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "setStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x90af960c874ae55e41cf26b230c13b241e9a0e06fd36f1a38ca161428e46fc0e", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", + "transactionIndex": 1, + "gasUsed": "1986158", + "logsBloom": "0x00000000002000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000080000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x99b9ae77e0324bb446b2c27ff5779f34dd897395d702bd595f508db9ed7ff79a", + "transactionHash": "0x90af960c874ae55e41cf26b230c13b241e9a0e06fd36f1a38ca161428e46fc0e", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823755, + "transactionHash": "0x90af960c874ae55e41cf26b230c13b241e9a0e06fd36f1a38ca161428e46fc0e", + "address": "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 0, + "blockHash": "0x99b9ae77e0324bb446b2c27ff5779f34dd897395d702bd595f508db9ed7ff79a" + } + ], + "blockNumber": 43823755, + "cumulativeGasUsed": "1986158", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "f16a94d75c83e5f4618a2f6097a17dcc", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum ISortitionModule.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_K\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_STAKE_PATHS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"}],\"name\":\"changeMaxDrawingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"}],\"name\":\"changeMinStakingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"name\":\"changeRandomNumberGenerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"createDisputeHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeReadIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeWriteIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delayedStakes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputesWithoutJurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"executeDelayedStakes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"},{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastPhaseChange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDrawingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStakingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_randomNumber\",\"type\":\"uint256\"}],\"name\":\"notifyRandomNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum ISortitionModule.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"postDrawHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_stake\",\"type\":\"uint256\"}],\"name\":\"preStakeHook\",\"outputs\":[{\"internalType\":\"enum ISortitionModule.preStakeHookResult\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumberRequestBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngLookahead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"setJurorInactive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A factory of trees that keeps track of staked values for sortition.\",\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"changeMaxDrawingTime(uint256)\":{\"details\":\"Changes the `maxDrawingTime` storage variable.\",\"params\":{\"_maxDrawingTime\":\"The new value for the `maxDrawingTime` storage variable.\"}},\"changeMinStakingTime(uint256)\":{\"details\":\"Changes the `minStakingTime` storage variable.\",\"params\":{\"_minStakingTime\":\"The new value for the `minStakingTime` storage variable.\"}},\"changeRandomNumberGenerator(address,uint256)\":{\"details\":\"Changes the `_rng` and `_rngLookahead` storage variables.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\",\"_rngLookahead\":\"The new value for the `rngLookahead` storage variable.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"createTree(bytes32,bytes)\":{\"details\":\"Create a sortition sum tree at the specified key.\",\"params\":{\"_extraData\":\"Extra data that contains the number of children each node in the tree should have.\",\"_key\":\"The key of the new tree.\"}},\"draw(bytes32,uint256,uint256)\":{\"details\":\"Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.\",\"params\":{\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\",\"_key\":\"The key of the tree.\",\"_nonce\":\"Nonce to hash with random number.\"},\"returns\":{\"drawnAddress\":\"The drawn address. `O(k * log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.\"}},\"executeDelayedStakes(uint256)\":{\"details\":\"Executes the next delayed stakes.\",\"params\":{\"_iterations\":\"The number of delayed stakes to execute.\"}},\"initialize(address,address,uint256,uint256,address,uint256)\":{\"details\":\"Initializer (constructor equivalent for upgradable contracts).\",\"params\":{\"_core\":\"The KlerosCore.\",\"_maxDrawingTime\":\"Time after which the drawing phase can be switched\",\"_minStakingTime\":\"Minimal time to stake\",\"_rng\":\"The random number generator.\",\"_rngLookahead\":\"Lookahead value for rng.\"}},\"notifyRandomNumber(uint256)\":{\"details\":\"Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().\",\"params\":{\"_randomNumber\":\"Random number returned by RNG contract.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"setJurorInactive(address)\":{\"details\":\"Unstakes the inactive juror from all courts. `O(n * (p * log_k(j)) )` where `n` is the number of courts the juror has staked in, `p` is the depth of the court tree, `k` is the minimum number of children per node of one of these courts' sortition sum tree, and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\",\"params\":{\"_account\":\"The juror to unstake.\"}},\"setStake(address,uint96,uint256)\":{\"details\":\"Sets the value for a particular court and its parent courts.\",\"params\":{\"_account\":\"Address of the juror. `O(log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.\",\"_courtID\":\"ID of the court.\",\"_value\":\"The new value.\"}},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}}},\"title\":\"SortitionModule\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/SortitionModule.sol\":\"SortitionModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"../libraries/SafeERC20.sol\\\";\\nimport \\\"../libraries/Constants.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// @title KlerosCore\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\ncontract KlerosCore is IArbitratorV2, UUPSProxiable, Initializable {\\n using SafeERC20 for IERC20;\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Period {\\n evidence, // Evidence can be submitted. This is also when drawing has to take place.\\n commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.\\n vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.\\n appeal, // The dispute can be appealed.\\n execution // Tokens are redistributed and the ruling is executed.\\n }\\n\\n struct Court {\\n uint96 parent; // The parent court.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256[] children; // List of child courts.\\n uint256 minStake; // Minimum PNKs needed to stake in the court.\\n uint256 alpha; // Basis point of PNKs that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n bool disabled; // True if the court is disabled. Unused for now, will be implemented later.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrableV2 arbitrated; // The arbitrable contract.\\n Period period; // The current period of the dispute.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n Round[] rounds;\\n }\\n\\n struct Round {\\n uint256 disputeKitID; // Index of the dispute kit in the array.\\n uint256 pnkAtStakePerJuror; // The amount of PNKs at stake for each juror in this round.\\n uint256 totalFeesForJurors; // The total juror fees paid in this round.\\n uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_round].length.\\n uint256 repartitions; // A counter of reward repartitions made in this round.\\n uint256 pnkPenalties; // The amount of PNKs collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n uint256 sumFeeRewardPaid; // Total sum of arbitration fees paid to coherent jurors as a reward in this round.\\n uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.\\n IERC20 feeToken; // The token used for paying fees in this round.\\n uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint256 stakedPnk; // The juror's total amount of tokens staked in subcourts. Reflects actual pnk balance.\\n uint256 lockedPnk; // The juror's total amount of tokens locked in disputes. Can reflect actual pnk balance when stakedPnk are fully withdrawn.\\n mapping(uint96 => uint256) stakedPnkByCourt; // The amount of PNKs the juror has staked in the court in the form `stakedPnkByCourt[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n bool disabled; // True if the dispute kit is disabled and can't be used. This parameter is added preemptively to avoid storage changes in the future.\\n }\\n\\n // Workaround \\\"stack too deep\\\" errors\\n struct ExecuteParams {\\n uint256 disputeID; // The ID of the dispute to execute.\\n uint256 round; // The round to execute.\\n uint256 coherentCount; // The number of coherent votes in the round.\\n uint256 numberOfVotesInRound; // The number of votes in the round.\\n uint256 pnkPenaltiesInRound; // The amount of PNKs collected from penalties in the round.\\n uint256 repartition; // The index of the repartition to execute.\\n }\\n\\n struct CurrencyRate {\\n bool feePaymentAccepted;\\n uint64 rateInEth;\\n uint8 rateDecimals;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 private constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 private constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 private constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n IERC20 private constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n ISortitionModule public sortitionModule; // Sortition module for drawing.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);\\n event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(\\n uint96 indexed _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod\\n );\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _degreeOfCoherency,\\n int256 _pnkAmount,\\n int256 _feeAmount,\\n IERC20 _feeToken\\n );\\n event LeftoverRewardSent(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 _pnkAmount,\\n uint256 _feeAmount,\\n IERC20 _feeToken\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer (constructor equivalent for upgradable contracts).\\n /// @param _governor The governor's address.\\n /// @param _pinakion The address of the token contract.\\n /// @param _jurorProsecutionModule The address of the juror prosecution module.\\n /// @param _disputeKit The address of the default dispute kit.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n /// @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n /// @param _sortitionExtraData The extra data for sortition module.\\n /// @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors.\\n function initialize(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n ISortitionModule _sortitionModuleAddress\\n ) external initializer {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: Constants.NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n depthLevel: 0,\\n disabled: false\\n })\\n );\\n emit DisputeKitCreated(Constants.DISPUTE_KIT_CLASSIC, _disputeKit, Constants.NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionModule.createTree(bytes32(uint256(Constants.FORKING_COURT)), _sortitionExtraData);\\n\\n // GENERAL_COURT\\n Court storage court = courts.push();\\n court.parent = Constants.FORKING_COURT;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _courtParameters[0];\\n court.alpha = _courtParameters[1];\\n court.feeForJuror = _courtParameters[2];\\n court.jurorsForCourtJump = _courtParameters[3];\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(uint256(Constants.GENERAL_COURT)), _sortitionExtraData);\\n\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n new uint256[](0)\\n );\\n _enableDisputeKit(Constants.GENERAL_COURT, Constants.DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /* @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Allows the governor to call anything on behalf of the contract.\\n /// @param _destination The destination of the call.\\n /// @param _amount The value sent with the call.\\n /// @param _data The data sent with the call.\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n if (!success) revert UnsuccessfulCall();\\n }\\n\\n /// @dev Changes the `governor` storage variable.\\n /// @param _governor The new value for the `governor` storage variable.\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /// @dev Changes the `pinakion` storage variable.\\n /// @param _pinakion The new value for the `pinakion` storage variable.\\n function changePinakion(IERC20 _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /// @dev Changes the `jurorProsecutionModule` storage variable.\\n /// @param _jurorProsecutionModule The new value for the `jurorProsecutionModule` storage variable.\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /// @dev Changes the `_sortitionModule` storage variable.\\n /// Note that the new module should be initialized for all courts.\\n /// @param _sortitionModule The new value for the `sortitionModule` storage variable.\\n function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor {\\n sortitionModule = _sortitionModule;\\n }\\n\\n /// @dev Add a new supported dispute kit module to the court.\\n /// @param _disputeKitAddress The address of the dispute kit contract.\\n /// @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n /// Note that the root DK must be supported by the general court.\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n if (_parent >= disputeKitID) revert InvalidDisputKitParent();\\n uint256 depthLevel;\\n if (_parent != Constants.NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n if (depthLevel >= SEARCH_ITERATIONS) revert DepthLevelMax();\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n depthLevel: depthLevel,\\n disabled: false\\n })\\n );\\n\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == Constants.NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n _enableDisputeKit(Constants.GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /// @dev Creates a court under a specified parent court.\\n /// @param _parent The `parent` property value of the court.\\n /// @param _hiddenVotes The `hiddenVotes` property value of the court.\\n /// @param _minStake The `minStake` property value of the court.\\n /// @param _alpha The `alpha` property value of the court.\\n /// @param _feeForJuror The `feeForJuror` property value of the court.\\n /// @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n /// @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n /// @param _sortitionExtraData Extra data for sortition module.\\n /// @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n function createCourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n bytes memory _sortitionExtraData,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n if (courts[_parent].minStake > _minStake) revert MinStakeLowerThanParentCourt();\\n if (_supportedDisputeKits.length == 0) revert UnsupportedDisputeKit();\\n if (_parent == Constants.FORKING_COURT) revert InvalidForkingCourtAsParent();\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionModule.createTree(bytes32(courtID), _sortitionExtraData);\\n\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _supportedDisputeKits\\n );\\n }\\n\\n function changeCourtParameters(\\n uint96 _courtID,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n if (_courtID != Constants.GENERAL_COURT && courts[court.parent].minStake > _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n for (uint256 i = 0; i < court.children.length; i++) {\\n if (courts[court.children[i]].minStake < _minStake) {\\n revert MinStakeLowerThanParentCourt();\\n }\\n }\\n court.minStake = _minStake;\\n court.hiddenVotes = _hiddenVotes;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(\\n _courtID,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod\\n );\\n }\\n\\n /// @dev Adds/removes court's support for specified dispute kits.\\n /// @param _courtID The ID of the court.\\n /// @param _disputeKitIDs The IDs of dispute kits which support should be added/removed.\\n /// @param _enable Whether add or remove the dispute kits from the court.\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKitNodes.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n if (\\n _courtID == Constants.GENERAL_COURT &&\\n disputeKitNodes[_disputeKitIDs[i]].parent == Constants.NULL_DISPUTE_KIT\\n ) {\\n revert CannotDisableRootDKInGeneral();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n /// @dev Changes the supported fee tokens.\\n /// @param _feeToken The fee token.\\n /// @param _accepted Whether the token is supported or not as a method of fee payment.\\n function changeAcceptedFeeTokens(IERC20 _feeToken, bool _accepted) external onlyByGovernor {\\n currencyRates[_feeToken].feePaymentAccepted = _accepted;\\n emit AcceptedFeeToken(_feeToken, _accepted);\\n }\\n\\n /// @dev Changes the currency rate of a fee token.\\n /// @param _feeToken The fee token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n function changeCurrencyRates(IERC20 _feeToken, uint64 _rateInEth, uint8 _rateDecimals) external onlyByGovernor {\\n currencyRates[_feeToken].rateInEth = _rateInEth;\\n currencyRates[_feeToken].rateDecimals = _rateDecimals;\\n emit NewCurrencyRate(_feeToken, _rateInEth, _rateDecimals);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Sets the caller's stake in a court.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n function setStake(uint96 _courtID, uint256 _newStake) external {\\n if (!_setStakeForAccount(msg.sender, _courtID, _newStake)) revert StakingFailed();\\n }\\n\\n function setStakeBySortitionModule(address _account, uint96 _courtID, uint256 _newStake) external {\\n if (msg.sender != address(sortitionModule)) revert WrongCaller();\\n _setStakeForAccount(_account, _courtID, _newStake);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n if (msg.value < arbitrationCost(_extraData)) revert ArbitrationFeesNotEnough();\\n\\n return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external override returns (uint256 disputeID) {\\n if (!currencyRates[_feeToken].feePaymentAccepted) revert TokenNotAccepted();\\n if (_feeAmount < arbitrationCost(_extraData, _feeToken)) revert ArbitrationFeesNotEnough();\\n\\n if (!_feeToken.safeTransferFrom(msg.sender, address(this), _feeAmount)) revert TransferFailed();\\n return _createDispute(_numberOfChoices, _extraData, _feeToken, _feeAmount);\\n }\\n\\n function _createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) internal returns (uint256 disputeID) {\\n (uint96 courtID, , uint256 disputeKitID) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n if (!courts[courtID].supportedDisputeKits[disputeKitID]) revert DisputeKitNotSupportedByCourt();\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrableV2(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n\\n // Obtain the feeForJuror in the same currency as the _feeAmount\\n uint256 feeForJuror = (_feeToken == NATIVE_CURRENCY)\\n ? court.feeForJuror\\n : convertEthToTokenAmount(_feeToken, court.feeForJuror);\\n round.nbVotes = _feeAmount / feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = _feeAmount;\\n round.feeToken = IERC20(_feeToken);\\n\\n sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));\\n }\\n\\n /// @dev Passes the period of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n function passPeriod(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n Court storage court = courts[dispute.courtID];\\n\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period == Period.evidence) {\\n if (\\n currentRound == 0 &&\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]\\n ) {\\n revert EvidenceNotPassedAndNotAppeal();\\n }\\n if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID)\\n ) {\\n revert CommitPeriodNotPassed();\\n }\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n if (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID)\\n ) {\\n revert VotePeriodNotPassed();\\n }\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {\\n revert AppealPeriodNotPassed();\\n }\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert DisputePeriodIsFinal();\\n }\\n\\n dispute.lastPeriodChange = block.timestamp;\\n emit NewPeriod(_disputeID, dispute.period);\\n }\\n\\n /// @dev Draws jurors for the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _iterations The number of iterations to run.\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n if (dispute.period != Period.evidence) revert NotEvidencePeriod();\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 startIndex = round.drawIterations; // for gas: less storage reads\\n uint256 i;\\n while (i < _iterations && round.drawnJurors.length < round.nbVotes) {\\n address drawnAddress = disputeKit.draw(_disputeID, startIndex + i++);\\n if (drawnAddress == address(0)) {\\n continue;\\n }\\n jurors[drawnAddress].lockedPnk += round.pnkAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n if (round.drawnJurors.length == round.nbVotes) {\\n sortitionModule.postDrawHook(_disputeID, currentRound);\\n }\\n }\\n round.drawIterations += i;\\n }\\n\\n /// @dev Appeals the ruling of a specified dispute.\\n /// Note: Access restricted to the Dispute Kit for this `disputeID`.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _numberOfChoices Number of choices for the dispute. Can be required during court jump.\\n /// @param _extraData Extradata for the dispute. Can be required during court jump.\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n if (msg.value < appealCost(_disputeID)) revert AppealFeesNotEnough();\\n\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.appeal) revert DisputeNotAppealable();\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n if (msg.sender != address(disputeKitNodes[round.disputeKitID].disputeKit)) revert DisputeKitOnly();\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != Constants.NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = Constants.GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.pnkAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1);\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute. Can be called in parts.\\n /// @param _disputeID The ID of the dispute.\\n /// @param _round The appeal round.\\n /// @param _iterations The number of iterations to run.\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRoundCache = round.pnkPenalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n if (coherentCount == 0) {\\n // We loop over the votes once as there are no rewards because it is not a tie and no one in this round is coherent with the final outcome.\\n if (end > numberOfVotesInRound) end = numberOfVotesInRound;\\n } else {\\n // We loop over the votes twice, first to collect the PNK penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n round.repartitions = end;\\n\\n for (uint256 i = start; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n pnkPenaltiesInRoundCache = _executePenalties(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams(_disputeID, _round, coherentCount, numberOfVotesInRound, pnkPenaltiesInRoundCache, i)\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRoundCache) {\\n round.pnkPenalties = pnkPenaltiesInRoundCache; // Reentrancy risk: breaks Check-Effect-Interact\\n }\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, penalties only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n /// @return pnkPenaltiesInRoundCache The updated penalties in round cache.\\n function _executePenalties(ExecuteParams memory _params) internal returns (uint256) {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition\\n );\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.pnkAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n _params.pnkPenaltiesInRound += penalty;\\n\\n // Unlock the PNKs affected by the penalty\\n address account = round.drawnJurors[_params.repartition];\\n jurors[account].lockedPnk -= penalty;\\n\\n // Apply the penalty to the staked PNKs.\\n // Note that lockedPnk will always cover penalty while stakedPnk can become lower after manual unstaking.\\n if (jurors[account].stakedPnk >= penalty) {\\n jurors[account].stakedPnk -= penalty;\\n } else {\\n jurors[account].stakedPnk = 0;\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n -int256(penalty),\\n 0,\\n round.feeToken\\n );\\n\\n if (!disputeKit.isVoteActive(_params.disputeID, _params.round, _params.repartition)) {\\n // The juror is inactive, unstake them.\\n sortitionModule.setJurorInactive(account);\\n }\\n if (_params.repartition == _params.numberOfVotesInRound - 1 && _params.coherentCount == 0) {\\n // No one was coherent, send the rewards to the governor.\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(round.totalFeesForJurors);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, round.totalFeesForJurors);\\n }\\n pinakion.safeTransfer(governor, _params.pnkPenaltiesInRound);\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n _params.pnkPenaltiesInRound,\\n round.totalFeesForJurors,\\n round.feeToken\\n );\\n }\\n return _params.pnkPenaltiesInRound;\\n }\\n\\n /// @dev Distribute the PNKs at stake and the dispute fees for the specific round of the dispute, rewards only.\\n /// @param _params The parameters for the execution, see `ExecuteParams`.\\n function _executeRewards(ExecuteParams memory _params) internal {\\n Dispute storage dispute = disputes[_params.disputeID];\\n Round storage round = dispute.rounds[_params.round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\n uint256 degreeOfCoherence = disputeKit.getDegreeOfCoherence(\\n _params.disputeID,\\n _params.round,\\n _params.repartition % _params.numberOfVotesInRound\\n );\\n\\n // Make sure the degree doesn't exceed 1, though it should be ensured by the dispute kit.\\n if (degreeOfCoherence > ALPHA_DIVISOR) {\\n degreeOfCoherence = ALPHA_DIVISOR;\\n }\\n\\n address account = round.drawnJurors[_params.repartition % _params.numberOfVotesInRound];\\n uint256 pnkLocked = (round.pnkAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n\\n // Release the rest of the PNKs of the juror for this round.\\n jurors[account].lockedPnk -= pnkLocked;\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (jurors[account].stakedPnk == 0) {\\n pinakion.safeTransfer(account, pnkLocked);\\n }\\n\\n // Transfer the rewards\\n uint256 pnkReward = ((_params.pnkPenaltiesInRound / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumPnkRewardPaid += pnkReward;\\n uint256 feeReward = ((round.totalFeesForJurors / _params.coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n round.sumFeeRewardPaid += feeReward;\\n pinakion.safeTransfer(account, pnkReward);\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(account).send(feeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(account, feeReward);\\n }\\n emit TokenAndETHShift(\\n account,\\n _params.disputeID,\\n _params.round,\\n degreeOfCoherence,\\n int256(pnkReward),\\n int256(feeReward),\\n round.feeToken\\n );\\n\\n // Transfer any residual rewards to the governor. It may happen due to partial coherence of the jurors.\\n if (_params.repartition == _params.numberOfVotesInRound * 2 - 1) {\\n uint256 leftoverPnkReward = _params.pnkPenaltiesInRound - round.sumPnkRewardPaid;\\n uint256 leftoverFeeReward = round.totalFeesForJurors - round.sumFeeRewardPaid;\\n if (leftoverPnkReward != 0 || leftoverFeeReward != 0) {\\n if (leftoverPnkReward != 0) {\\n pinakion.safeTransfer(governor, leftoverPnkReward);\\n }\\n if (leftoverFeeReward != 0) {\\n if (round.feeToken == NATIVE_CURRENCY) {\\n // The dispute fees were paid in ETH\\n payable(governor).send(leftoverFeeReward);\\n } else {\\n // The dispute fees were paid in ERC20\\n round.feeToken.safeTransfer(governor, leftoverFeeReward);\\n }\\n }\\n emit LeftoverRewardSent(\\n _params.disputeID,\\n _params.round,\\n leftoverPnkReward,\\n leftoverFeeReward,\\n round.feeToken\\n );\\n }\\n }\\n }\\n\\n /// @dev Executes a specified dispute's ruling.\\n /// @param _disputeID The ID of the dispute.\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n if (dispute.ruled) revert RulingAlreadyExecuted();\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n emit Ruling(dispute.arbitrated, _disputeID, winningChoice);\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Compute the cost of arbitration denominated in ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors, ) = _extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[courtID].feeForJuror * minJurors;\\n }\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) public view override returns (uint256 cost) {\\n cost = convertEthToTokenAmount(_feeToken, arbitrationCost(_extraData));\\n }\\n\\n /// @dev Gets the cost of appealing a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return cost The appeal cost.\\n function appealCost(uint256 _disputeID) public view returns (uint256 cost) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent court.\\n if (dispute.courtID == Constants.GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent court.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current court.\\n cost = court.feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n }\\n\\n /// @dev Gets the start and the end of a specified dispute's current appeal period.\\n /// @param _disputeID The ID of the dispute.\\n /// @return start The start of the appeal period.\\n /// @return end The end of the appeal period.\\n function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period == Period.appeal) {\\n start = dispute.lastPeriodChange;\\n end = dispute.lastPeriodChange + courts[dispute.courtID].timesPerPeriod[uint256(Period.appeal)];\\n } else {\\n start = 0;\\n end = 0;\\n }\\n }\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round) external view returns (Round memory) {\\n return disputes[_disputeID].rounds[_round];\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts) {\\n Juror storage juror = jurors[_juror];\\n totalStaked = juror.stakedPnk;\\n totalLocked = juror.lockedPnk;\\n stakedInCourt = juror.stakedPnkByCourt[_courtID];\\n nbCourts = juror.courtIDs.length;\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /// @dev Gets non-primitive properties of a specified dispute kit node.\\n /// @param _disputeKitID The ID of the dispute kit.\\n /// @return children Indexes of children of this DK.\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /// @dev Gets the timesPerPeriod array for a given court.\\n /// @param _courtID The ID of the court to get the times from.\\n /// @return timesPerPeriod The timesPerPeriod array for the given court.\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n timesPerPeriod = courts[_courtID].timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n /// @dev Gets the number of votes permitted for the specified dispute in the latest round.\\n /// @param _disputeID The ID of the dispute.\\n function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) {\\n Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds[dispute.rounds.length - 1].nbVotes;\\n }\\n\\n /// @dev Returns true if the dispute kit will be switched to a parent DK.\\n /// @param _disputeID The ID of the dispute.\\n /// @return Whether DK will be switched or not.\\n function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n Court storage court = courts[dispute.courtID];\\n\\n if (round.nbVotes < court.jurorsForCourtJump) {\\n return false;\\n }\\n\\n // Jump if the parent court doesn't support the current DK.\\n return !courts[court.parent].supportedDisputeKits[round.disputeKitID];\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n /// @dev Gets the dispute kit for a specific `_disputeKitID`.\\n /// @param _disputeKitID The ID of the dispute kit.\\n function getDisputeKit(uint256 _disputeKitID) external view returns (IDisputeKit) {\\n return disputeKitNodes[_disputeKitID].disputeKit;\\n }\\n\\n /// @dev Gets the court identifiers where a specific `_juror` has staked.\\n /// @param _juror The address of the juror.\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n function convertEthToTokenAmount(IERC20 _toToken, uint256 _amountInEth) public view returns (uint256) {\\n return (_amountInEth * 10 ** currencyRates[_toToken].rateDecimals) / currencyRates[_toToken].rateInEth;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Toggles the dispute kit support for a given court.\\n /// @param _courtID The ID of the court to toggle the support for.\\n /// @param _disputeKitID The ID of the dispute kit to toggle the support for.\\n /// @param _enable Whether to enable or disable the support.\\n function _enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /// @dev Sets the specified juror's stake in a court.\\n /// `O(n + p * log_k(j))` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The address of the juror.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @return succeeded True if the call succeeded, false otherwise.\\n function _setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake\\n ) internal returns (bool succeeded) {\\n if (_courtID == Constants.FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n uint256 currentStake = juror.stakedPnkByCourt[_courtID];\\n\\n if (_newStake != 0) {\\n if (_newStake < courts[_courtID].minStake) return false;\\n } else if (currentStake == 0) {\\n return false;\\n }\\n\\n ISortitionModule.preStakeHookResult result = sortitionModule.preStakeHook(_account, _courtID, _newStake);\\n if (result == ISortitionModule.preStakeHookResult.failed) {\\n return false;\\n } else if (result == ISortitionModule.preStakeHookResult.delayed) {\\n emit StakeDelayed(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_newStake >= currentStake) {\\n // Stake increase\\n // When stakedPnk becomes lower than lockedPnk count the locked tokens in when transferring tokens from juror.\\n // (E.g. stakedPnk = 0, lockedPnk = 150) which can happen if the juror unstaked fully while having some tokens locked.\\n uint256 previouslyLocked = (juror.lockedPnk >= juror.stakedPnk) ? juror.lockedPnk - juror.stakedPnk : 0; // underflow guard\\n transferredAmount = (_newStake >= currentStake + previouslyLocked) // underflow guard\\n ? _newStake - currentStake - previouslyLocked\\n : 0;\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), transferredAmount)) {\\n return false;\\n }\\n }\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n // Stake decrease: make sure locked tokens always stay in the contract. They can only be released during Execution.\\n if (juror.stakedPnk >= currentStake - _newStake + juror.lockedPnk) {\\n // We have enough pnk staked to afford withdrawal while keeping locked tokens.\\n transferredAmount = currentStake - _newStake;\\n } else if (juror.stakedPnk >= juror.lockedPnk) {\\n // Can't afford withdrawing the current stake fully. Take whatever is available while keeping locked tokens.\\n transferredAmount = juror.stakedPnk - juror.lockedPnk;\\n }\\n if (transferredAmount > 0) {\\n if (!pinakion.safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n if (_newStake == 0) {\\n for (uint256 i = juror.courtIDs.length; i > 0; i--) {\\n if (juror.courtIDs[i - 1] == _courtID) {\\n juror.courtIDs[i - 1] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n }\\n }\\n\\n // Note that stakedPnk can become async with currentStake (e.g. after penalty).\\n juror.stakedPnk = (juror.stakedPnk >= currentStake) ? juror.stakedPnk - currentStake + _newStake : _newStake;\\n juror.stakedPnkByCourt[_courtID] = _newStake;\\n\\n sortitionModule.setStake(_account, _courtID, _newStake);\\n emit StakeSet(_account, _courtID, _newStake);\\n return true;\\n }\\n\\n /// @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n /// Note that if extradata contains an incorrect value then this value will be switched to default.\\n /// @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n /// @return courtID The court ID.\\n /// @return minJurors The minimum number of jurors required.\\n /// @return disputeKitID The ID of the dispute kit.\\n function _extraDataToCourtIDMinJurorsDisputeKit(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors, uint256 disputeKitID) {\\n // Note that if the extradata doesn't contain 32 bytes for the dispute kit ID it'll return the default 0 index.\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (courtID == Constants.FORKING_COURT || courtID >= courts.length) {\\n courtID = Constants.GENERAL_COURT;\\n }\\n if (minJurors == 0) {\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n }\\n if (disputeKitID == Constants.NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = Constants.GENERAL_COURT;\\n minJurors = Constants.DEFAULT_NB_OF_JURORS;\\n disputeKitID = Constants.DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n // ************************************* //\\n // * Errors * //\\n // ************************************* //\\n\\n error GovernorOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error DepthLevelMax();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableRootDKInGeneral();\\n error ArraysLengthMismatch();\\n error StakingFailed();\\n error WrongCaller();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error TokenNotAccepted();\\n error EvidenceNotPassedAndNotAppeal();\\n error DisputeStillDrawing();\\n error CommitPeriodNotPassed();\\n error VotePeriodNotPassed();\\n error AppealPeriodNotPassed();\\n error NotEvidencePeriod();\\n error AppealFeesNotEnough();\\n error DisputeNotAppealable();\\n error DisputeKitOnly();\\n error NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n error TransferFailed();\\n}\\n\",\"keccak256\":\"0x48e2706b2e795f745b6abc247c2ac9c8a789031f6b3a1fc3e195d48a7a06ef78\",\"license\":\"MIT\"},\"src/arbitration/SortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @custom:authors: [@epiqueras, @unknownunknown1, @shotaronowhere]\\n * @custom:reviewers: []\\n * @custom:auditors: []\\n * @custom:bounties: []\\n * @custom:deployments: []\\n */\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./KlerosCore.sol\\\";\\nimport \\\"./interfaces/ISortitionModule.sol\\\";\\nimport \\\"./interfaces/IDisputeKit.sol\\\";\\nimport \\\"../rng/RNG.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\nimport \\\"../libraries/Constants.sol\\\";\\n\\n/// @title SortitionModule\\n/// @dev A factory of trees that keeps track of staked values for sortition.\\ncontract SortitionModule is ISortitionModule, UUPSProxiable, Initializable {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of children per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant DEFAULT_K = 6; // Default number of children per node.\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The core arbitrator contract.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Drawing if there are open disputes.\\n uint256 public maxDrawingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public randomNumberRequestBlock; // Number of the block when RNG request was made.\\n uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors.\\n RNG public rng; // The random number generator.\\n uint256 public randomNumber; // Random number returned by RNG.\\n uint256 public rngLookahead; // Minimal block distance between requesting and obtaining a random number.\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees; // The mapping trees by keys.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Drawing phase, to update them when the phase is switched to Staking.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(address(governor) == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer (constructor equivalent for upgradable contracts).\\n /// @param _core The KlerosCore.\\n /// @param _minStakingTime Minimal time to stake\\n /// @param _maxDrawingTime Time after which the drawing phase can be switched\\n /// @param _rng The random number generator.\\n /// @param _rngLookahead Lookahead value for rng.\\n function initialize(\\n address _governor,\\n KlerosCore _core,\\n uint256 _minStakingTime,\\n uint256 _maxDrawingTime,\\n RNG _rng,\\n uint256 _rngLookahead\\n ) external reinitializer(1) {\\n governor = _governor;\\n core = _core;\\n minStakingTime = _minStakingTime;\\n maxDrawingTime = _maxDrawingTime;\\n lastPhaseChange = block.timestamp;\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n delayedStakeReadIndex = 1;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Changes the `minStakingTime` storage variable.\\n /// @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /// @dev Changes the `maxDrawingTime` storage variable.\\n /// @param _maxDrawingTime The new value for the `maxDrawingTime` storage variable.\\n function changeMaxDrawingTime(uint256 _maxDrawingTime) external onlyByGovernor {\\n maxDrawingTime = _maxDrawingTime;\\n }\\n\\n /// @dev Changes the `_rng` and `_rngLookahead` storage variables.\\n /// @param _rng The new value for the `RNGenerator` storage variable.\\n /// @param _rngLookahead The new value for the `rngLookahead` storage variable.\\n function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n if (phase == Phase.generating) {\\n rng.requestRandomness(block.number + rngLookahead);\\n randomNumberRequestBlock = block.number;\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(\\n block.timestamp - lastPhaseChange >= minStakingTime,\\n \\\"The minimum staking time has not passed yet.\\\"\\n );\\n require(disputesWithoutJurors > 0, \\\"There are no disputes that need jurors.\\\");\\n rng.requestRandomness(block.number + rngLookahead);\\n randomNumberRequestBlock = block.number;\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n randomNumber = rng.receiveRandomness(randomNumberRequestBlock + rngLookahead);\\n require(randomNumber != 0, \\\"Random number is not ready yet\\\");\\n phase = Phase.drawing;\\n } else if (phase == Phase.drawing) {\\n require(\\n disputesWithoutJurors == 0 || block.timestamp - lastPhaseChange >= maxDrawingTime,\\n \\\"There are still disputes without jurors and the maximum drawing time has not passed yet.\\\"\\n );\\n phase = Phase.staking;\\n }\\n\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /// @dev Create a sortition sum tree at the specified key.\\n /// @param _key The key of the new tree.\\n /// @param _extraData Extra data that contains the number of children each node in the tree should have.\\n function createTree(bytes32 _key, bytes memory _extraData) external override onlyByCore {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n uint256 K = _extraDataToTreeK(_extraData);\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(K > 1, \\\"K must be greater than one.\\\");\\n tree.K = K;\\n tree.nodes.push(0);\\n }\\n\\n /// @dev Executes the next delayed stakes.\\n /// @param _iterations The number of delayed stakes to execute.\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"Should be in Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n core.setStakeBySortitionModule(delayedStake.account, delayedStake.courtID, delayedStake.stake);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n function preStakeHook(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake\\n ) external override onlyByCore returns (preStakeHookResult) {\\n (, , uint256 currentStake, uint256 nbCourts) = core.getJurorBalance(_account, _courtID);\\n if (currentStake == 0 && nbCourts >= MAX_STAKE_PATHS) {\\n // Prevent staking beyond MAX_STAKE_PATHS but unstaking is always allowed.\\n return preStakeHookResult.failed;\\n } else {\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake\\n });\\n return preStakeHookResult.delayed;\\n }\\n }\\n return preStakeHookResult.ok;\\n }\\n\\n function createDisputeHook(uint256 /*_disputeID*/, uint256 /*_roundID*/) external override onlyByCore {\\n disputesWithoutJurors++;\\n }\\n\\n function postDrawHook(uint256 /*_disputeID*/, uint256 /*_roundID*/) external override onlyByCore {\\n disputesWithoutJurors--;\\n }\\n\\n /// @dev Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().\\n /// @param _randomNumber Random number returned by RNG contract.\\n function notifyRandomNumber(uint256 _randomNumber) public override {}\\n\\n /// @dev Sets the value for a particular court and its parent courts.\\n /// @param _courtID ID of the court.\\n /// @param _value The new value.\\n /// @param _account Address of the juror.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function setStake(address _account, uint96 _courtID, uint256 _value) external override onlyByCore {\\n bytes32 stakePathID = _accountAndCourtIDToStakePathID(_account, _courtID);\\n bool finished = false;\\n uint96 currenCourtID = _courtID;\\n while (!finished) {\\n // Tokens are also implicitly staked in parent courts through sortition module to increase the chance of being drawn.\\n _set(bytes32(uint256(currenCourtID)), _value, stakePathID);\\n if (currenCourtID == Constants.GENERAL_COURT) {\\n finished = true;\\n } else {\\n (currenCourtID, , , , , , ) = core.courts(currenCourtID);\\n }\\n }\\n }\\n\\n /// @dev Unstakes the inactive juror from all courts.\\n /// `O(n * (p * log_k(j)) )` where\\n /// `n` is the number of courts the juror has staked in,\\n /// `p` is the depth of the court tree,\\n /// `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n /// and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n /// @param _account The juror to unstake.\\n function setJurorInactive(address _account) external override onlyByCore {\\n uint96[] memory courtIDs = core.getJurorCourtIDs(_account);\\n for (uint256 j = courtIDs.length; j > 0; j--) {\\n core.setStakeBySortitionModule(_account, courtIDs[j - 1], 0);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Draw an ID from a tree using a number.\\n /// Note that this function reverts if the sum of all values in the tree is 0.\\n /// @param _key The key of the tree.\\n /// @param _coreDisputeID Index of the dispute in Kleros Core.\\n /// @param _nonce Nonce to hash with random number.\\n /// @return drawnAddress The drawn address.\\n /// `O(k * log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function draw(\\n bytes32 _key,\\n uint256 _coreDisputeID,\\n uint256 _nonce\\n ) public view override returns (address drawnAddress) {\\n require(phase == Phase.drawing, \\\"Wrong phase.\\\");\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n\\n if (tree.nodes[0] == 0) {\\n return address(0); // No jurors staked.\\n }\\n\\n uint256 currentDrawnNumber = uint256(keccak256(abi.encodePacked(randomNumber, _coreDisputeID, _nonce))) %\\n tree.nodes[0];\\n\\n // While it still has children\\n uint256 treeIndex = 0;\\n while ((tree.K * treeIndex) + 1 < tree.nodes.length) {\\n for (uint256 i = 1; i <= tree.K; i++) {\\n // Loop over children.\\n uint256 nodeIndex = (tree.K * treeIndex) + i;\\n uint256 nodeValue = tree.nodes[nodeIndex];\\n\\n if (currentDrawnNumber >= nodeValue) {\\n // Go to the next child.\\n currentDrawnNumber -= nodeValue;\\n } else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n }\\n drawnAddress = _stakePathIDToAccount(tree.nodeIndexesToIDs[treeIndex]);\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /// @dev Update all the parents of a node.\\n /// @param _key The key of the tree to update.\\n /// @param _treeIndex The index of the node to start from.\\n /// @param _plusOrMinus Whether to add (true) or substract (false).\\n /// @param _value The value to add or substract.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function _updateParents(bytes32 _key, uint256 _treeIndex, bool _plusOrMinus, uint256 _value) private {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n\\n /// @dev Retrieves a juror's address from the stake path ID.\\n /// @param _stakePathID The stake path ID to unpack.\\n /// @return account The account.\\n function _stakePathIDToAccount(bytes32 _stakePathID) internal pure returns (address account) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(add(ptr, 0x0c), i), byte(i, _stakePathID))\\n }\\n account := mload(ptr)\\n }\\n }\\n\\n function _extraDataToTreeK(bytes memory _extraData) internal pure returns (uint256 K) {\\n if (_extraData.length >= 32) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n K := mload(add(_extraData, 0x20))\\n }\\n } else {\\n K = DEFAULT_K;\\n }\\n }\\n\\n /// @dev Set a value in a tree.\\n /// @param _key The key of the tree.\\n /// @param _value The new value.\\n /// @param _ID The ID of the value.\\n /// `O(log_k(n))` where\\n /// `k` is the maximum number of children per node in the tree,\\n /// and `n` is the maximum number of nodes ever appended.\\n function _set(bytes32 _key, uint256 _value, bytes32 _ID) internal {\\n SortitionSumTree storage tree = sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n _updateParents(_key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n _updateParents(_key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n _updateParents(_key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /// @dev Packs an account and a court ID into a stake path ID.\\n /// @param _account The address of the juror to pack.\\n /// @param _courtID The court ID to pack.\\n /// @return stakePathID The stake path ID.\\n function _accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe55d371a58ebb1fd034546d93797838d4e6dcf9c6aa037171c79493babd23f8f\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@unknownunknown1, @jaybuidl]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IDisputeKit\\n/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.\\n/// It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters.\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /// @dev Emitted when casting a vote to provide the justification of juror's choice.\\n /// @param _coreDisputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _juror Address of the juror.\\n /// @param _voteIDs The identifiers of the votes in the dispute.\\n /// @param _choice The choice juror voted for.\\n /// @param _justification Justification of the choice.\\n event VoteCast(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\n uint256[] _voteIDs,\\n uint256 indexed _choice,\\n string _justification\\n );\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @dev Creates a local dispute and maps it to the dispute ID in the Core contract.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _numberOfChoices Number of choices of the dispute\\n /// @param _extraData Additional info about the dispute, for possible use in future dispute kits.\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /// @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.\\n /// Note: Access restricted to Kleros Core only.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _nonce Nonce.\\n /// @return drawnAddress The drawn address.\\n function draw(uint256 _coreDisputeID, uint256 _nonce) external returns (address drawnAddress);\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /// @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the vote.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /// @dev Gets the number of jurors who are eligible to a reward in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @return The number of coherent jurors.\\n function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256);\\n\\n /// @dev Returns true if all of the jurors have cast their commits for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their commits for the last round.\\n function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if all of the jurors have cast their votes for the last round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether all of the jurors have cast their votes for the last round.\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /// @dev Returns true if the specified voter was active in this round.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n /// @param _voteID The ID of the voter.\\n /// @return Whether the voter was active or not.\\n function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool);\\n\\n function getRoundInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _choice\\n )\\n external\\n view\\n returns (\\n uint256 winningChoice,\\n bool tied,\\n uint256 totalVoted,\\n uint256 totalCommited,\\n uint256 nbVoters,\\n uint256 choiceCount\\n );\\n\\n function getVoteInfo(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted);\\n}\\n\",\"keccak256\":\"0x7fe6b1d9b991cc327cc5895f34208a7b1e3b6ebf8efb20fcb9f3ff0f40d2d209\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\ninterface ISortitionModule {\\n enum Phase {\\n staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.\\n }\\n\\n enum preStakeHookResult {\\n ok,\\n delayed,\\n failed\\n }\\n\\n event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(address _account, uint96 _courtID, uint256 _value) external;\\n\\n function setJurorInactive(address _account) external;\\n\\n function notifyRandomNumber(uint256 _drawnNumber) external;\\n\\n function draw(bytes32 _court, uint256 _coreDisputeID, uint256 _nonce) external view returns (address);\\n\\n function preStakeHook(address _account, uint96 _courtID, uint256 _stake) external returns (preStakeHookResult);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x605dede00fac41f3534a5009dab9a6d698b814d5cfed7e2d91cd4a284bf39410\",\"license\":\"MIT\"},\"src/libraries/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\n/// @title Constants\\nlibrary Constants {\\n // Courts\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n\\n // Dispute Kits\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n\\n // Defaults\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n}\\n\",\"keccak256\":\"0x0bc176ef4e0124e41a09f28f627a1b6458e06d17d65f4efa5f7de0d2f68ddc15\",\"license\":\"MIT\"},\"src/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/a7a94c77463acea95d979aae1580fb0ddc3b6a1e/contracts/token/ERC20/utils/SafeERC20.sol\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title SafeERC20\\n/// @dev Wrappers around ERC20 operations that throw on failure (when the token\\n/// contract returns false). Tokens that return no value (and instead revert or\\n/// throw on failure) are also supported, non-reverting calls are assumed to be\\n/// successful.\\n/// To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n/// which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\nlibrary SafeERC20 {\\n /// @dev Increases the allowance granted to `spender` by the caller.\\n /// @param _token Token to transfer.\\n /// @param _spender The address which will spend the funds.\\n /// @param _addedValue The amount of tokens to increase the allowance by.\\n function increaseAllowance(IERC20 _token, address _spender, uint256 _addedValue) internal returns (bool) {\\n _token.approve(_spender, _token.allowance(address(this), _spender) + _addedValue);\\n return true;\\n }\\n\\n /// @dev Calls transfer() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransfer(IERC20 _token, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(abi.encodeCall(IERC20.transfer, (_to, _value)));\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /// @dev Calls transferFrom() without reverting.\\n /// @param _token Token to transfer.\\n /// @param _from Sender address.\\n /// @param _to Recepient address.\\n /// @param _value Amount transferred.\\n /// @return Whether transfer succeeded or not.\\n function safeTransferFrom(IERC20 _token, address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(_token).call(\\n abi.encodeCall(IERC20.transferFrom, (_from, _to, _value))\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0x37a19df56a98cd466fb6e70b8c56e13bfc439221bfabd8c5108d36d0e3ffc0e5\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\ninterface RNG {\\n /// @dev Request a random number.\\n /// @param _block Block linked to the request.\\n function requestRandomness(uint256 _block) external;\\n\\n /// @dev Receive the random number.\\n /// @param _block Block the random number is linked to.\\n /// @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x5afe7121f49aebe72218df356bd91b66c2171b9ad15e7945a15a091784291a43\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff16156100715760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b608051612282620000fd60003960008181610fbf01528181610fe801526111d701526122826000f3fe6080604052600436106101a35760003560e01c80635d2d7846116100e2578063c057eca711610085578063c057eca714610461578063c157261814610477578063ccbac9f51461048d578063d09f392d146104a3578063d605787b146104c3578063dd5e5cb5146104e3578063f2f4eb2614610503578063f6b4d82d1461052357600080fd5b80635d2d784614610372578063684fbf5f146103925780637dc38f14146103bf578063823cfd70146103d5578063b1c9fe6e146103f5578063b4a6160814610416578063b5d69e991461042b578063b888adfa1461044b57600080fd5b806345988e2c1161014a57806345988e2c14610294578063477a655c146102b45780634c70a0d6146102d45780634dbbebbc146102f45780634f1ef2861461031457806352d1902d1461032757806354812d171461033c57806356acb0501461035c57600080fd5b806303432744146101a85780630b274f2e146101d15780630b51806d146101e85780630c340a24146101fd5780630e083ec91461022a5780631b92bbbe1461024057806321ea9b3f1461025657806335975f4a14610274575b600080fd5b3480156101b457600080fd5b506101be60065481565b6040519081526020015b60405180910390f35b3480156101dd57600080fd5b506101e6610582565b005b3480156101f457600080fd5b506101be600681565b34801561020957600080fd5b5060005461021d906001600160a01b031681565b6040516101c89190611bcd565b34801561023657600080fd5b506101be600a5481565b34801561024c57600080fd5b506101be60035481565b34801561026257600080fd5b506101e6610271366004611be1565b50565b34801561028057600080fd5b506101e661028f366004611be1565b61095a565b3480156102a057600080fd5b506101e66102af366004611c24565b610aeb565b3480156102c057600080fd5b506101e66102cf366004611d1a565b610be7565b3480156102e057600080fd5b5061021d6102ef366004611d60565b610cde565b34801561030057600080fd5b506101e661030f366004611d8c565b610ec2565b6101e6610322366004611db8565b610fab565b34801561033357600080fd5b506101be6111ca565b34801561034857600080fd5b506101e6610357366004611df1565b611228565b34801561036857600080fd5b506101be600b5481565b34801561037e57600080fd5b506101e661038d366004611e58565b61134c565b34801561039e57600080fd5b506103b26103ad366004611c24565b61138f565b6040516101c89190611eae565b3480156103cb57600080fd5b506101be60095481565b3480156103e157600080fd5b506101e66103f0366004611be1565b611528565b34801561040157600080fd5b506001546103b290600160a01b900460ff1681565b34801561042257600080fd5b506101be600481565b34801561043757600080fd5b506101e6610446366004611ec1565b611557565b34801561045757600080fd5b506101be60045481565b34801561046d57600080fd5b506101be60025481565b34801561048357600080fd5b506101be60055481565b34801561049957600080fd5b506101be60085481565b3480156104af57600080fd5b506101e66104be366004611e58565b6116a2565b3480156104cf57600080fd5b5060075461021d906001600160a01b031681565b3480156104ef57600080fd5b506101e66104fe366004611be1565b6116dc565b34801561050f57600080fd5b5060015461021d906001600160a01b031681565b34801561052f57600080fd5b5061057361053e366004611be1565b600d60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b6040516101c893929190611ede565b6000600154600160a01b900460ff1660028111156105a2576105a2611e7a565b03610715576002546004546105b79042611f1e565b101561061f5760405162461bcd60e51b815260206004820152602c60248201527f546865206d696e696d756d207374616b696e672074696d6520686173206e6f7460448201526b103830b9b9b2b2103cb2ba1760a11b60648201526084015b60405180910390fd5b6000600654116106815760405162461bcd60e51b815260206004820152602760248201527f546865726520617265206e6f2064697370757465732074686174206e65656420604482015266353ab937b9399760c91b6064820152608401610616565b6007546009546001600160a01b0390911690637363ae1f906106a39043611f37565b6040518263ffffffff1660e01b81526004016106c191815260200190565b600060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505043600555505060018054819060ff60a01b1916600160a01b825b021790555061090f565b60018054600160a01b900460ff16600281111561073457610734611e7a565b0361082c576007546009546005546001600160a01b03909216916313cf90549161075d91611f37565b6040518263ffffffff1660e01b815260040161077b91815260200190565b6020604051808303816000875af115801561079a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107be9190611f4a565b60088190556000036108125760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610616565b600180546002919060ff60a01b1916600160a01b8361070b565b6002600154600160a01b900460ff16600281111561084c5761084c611e7a565b0361090f57600654158061086e575060035460045461086b9042611f1e565b10155b6109015760405162461bcd60e51b815260206004820152605860248201527f546865726520617265207374696c6c20646973707574657320776974686f757460448201527f206a75726f727320616e6420746865206d6178696d756d2064726177696e67206064820152773a34b6b2903430b9903737ba103830b9b9b2b2103cb2ba1760411b608482015260a401610616565b6001805460ff60a01b191690555b426004556001546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161095091600160a01b90910460ff1690611eae565b60405180910390a1565b6000600154600160a01b900460ff16600281111561097a5761097a611e7a565b146109c75760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e00000000006044820152606401610616565b6000600a54600183600b546109dc9190611f37565b6109e69190611f1e565b116109f15781610a0c565b600b54600a54610a019190611f1e565b610a0c906001611f37565b9050600081600b54610a1e9190611f37565b600b549091505b81811015610ae3576000818152600d602052604090819020600180548254918301549351630761c14d60e01b815292936001600160a01b0391821693630761c14d93610a8893811692600160a01b9091046001600160601b031691600401611ede565b600060405180830381600087803b158015610aa257600080fd5b505af1158015610ab6573d6000803e3d6000fd5b5050506000838152600d602052604081208181556001015550819050610adb81611f63565b915050610a25565b50600b555050565b6001546001600160a01b03163314610b155760405162461bcd60e51b815260040161061690611f7c565b6000610b21848461170b565b90506000835b81610bdf57610b406001600160601b0382168585611753565b6000196001600160601b03821601610b5b5760019150610b27565b600154604051630fad06e960e11b81526001600160601b03831660048201526001600160a01b0390911690631f5a0dd29060240160e060405180830381865afa158015610bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd09190611fd0565b50949550610b27945050505050565b505050505050565b6001546001600160a01b03163314610c115760405162461bcd60e51b815260040161061690611f7c565b6000828152600c6020526040812090610c2983611aa7565b825490915015610c725760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b6044820152606401610616565b60018111610cc25760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610616565b8155600201805460018101825560009182526020822001555050565b60006002600154600160a01b900460ff166002811115610d0057610d00611e7a565b14610d3c5760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b6044820152606401610616565b6000848152600c6020526040812060028101805491929091610d6057610d6061203c565b9060005260206000200154600003610d7c576000915050610ebb565b600081600201600081548110610d9457610d9461203c565b90600052602060002001546008548686604051602001610dc7939291909283526020830191909152604082015260600190565b6040516020818303038152906040528051906020012060001c610dea9190612068565b905060005b60028301548354610e0190839061207c565b610e0c906001611f37565b1015610e9b5760015b83548111610e9557600081838660000154610e30919061207c565b610e3a9190611f37565b90506000856002018281548110610e5357610e5361203c565b90600052602060002001549050808510610e7857610e718186611f1e565b9450610e80565b509150610e95565b50508080610e8d90611f63565b915050610e15565b50610def565b6000818152600484016020526040902054610eb590611ac3565b93505050505b9392505050565b6000546001600160a01b03163314610eec5760405162461bcd60e51b815260040161061690612093565b600780546001600160a01b0319166001600160a01b038416179055600981905560018054600160a01b900460ff166002811115610f2b57610f2b611e7a565b03610fa7576007546009546001600160a01b0390911690637363ae1f90610f529043611f37565b6040518263ffffffff1660e01b8152600401610f7091815260200190565b600060405180830381600087803b158015610f8a57600080fd5b505af1158015610f9e573d6000803e3d6000fd5b50504360055550505b5050565b610fb482611aee565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061103257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661102660008051602061222d8339815191525490565b6001600160a01b031614155b156110505760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110aa575060408051601f3d908101601f191682019092526110a791810190611f4a565b60015b6110c95781604051630c76093760e01b81526004016106169190611bcd565b60008051602061222d83398151915281146110fa57604051632a87526960e21b815260048101829052602401610616565b60008051602061222d8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156111c5576000836001600160a01b03168360405161116191906120d5565b600060405180830381855af49150503d806000811461119c576040519150601f19603f3d011682016040523d82523d6000602084013e6111a1565b606091505b50509050806111c3576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112155760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061222d83398151915290565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680611271575080546001600160401b03808416911610155b1561128e5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600080546001600160a01b038b81166001600160a01b031992831617909255600180548b841690831617815560028a905560038990554260045560078054938916939092169290921790556009859055600b55815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050505050565b6001546001600160a01b031633146113765760405162461bcd60e51b815260040161061690611f7c565b6006805490600061138683612104565b91905055505050565b6001546000906001600160a01b031633146113bc5760405162461bcd60e51b815260040161061690611f7c565b600154604051631a383be960e31b81526001600160a01b0386811660048301526001600160601b0386166024830152600092839291169063d1c1df4890604401608060405180830381865afa158015611419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143d919061211b565b935093505050816000148015611454575060048110155b1561146457600292505050610ebb565b6000600154600160a01b900460ff16600281111561148457611484611e7a565b1461151c576040518060600160405280876001600160a01b03168152602001866001600160601b0316815260200185815250600d6000600a600081546114c990611f63565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b0390931692909217825591909101516001918201559250610ebb915050565b50600095945050505050565b6000546001600160a01b031633146115525760405162461bcd60e51b815260040161061690612093565b600255565b6001546001600160a01b031633146115815760405162461bcd60e51b815260040161061690611f7c565b600154604051632a1fc51b60e11b81526000916001600160a01b03169063543f8a36906115b2908590600401611bcd565b600060405180830381865afa1580156115cf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115f79190810190612151565b80519091505b80156111c557600180546001600160a01b031690630761c14d90859085906116259086611f1e565b815181106116355761163561203c565b602002602001015160006040518463ffffffff1660e01b815260040161165d93929190611ede565b600060405180830381600087803b15801561167757600080fd5b505af115801561168b573d6000803e3d6000fd5b50505050808061169a90612104565b9150506115fd565b6001546001600160a01b031633146116cc5760405162461bcd60e51b815260040161061690611f7c565b6006805490600061138683611f63565b6000546001600160a01b031633146117065760405162461bcd60e51b815260040161061690612093565b600355565b600060405160005b601481101561172e578481600c011a81830153600101611713565b5060145b602081101561174a5783811a81830153600101611732565b50519392505050565b6000838152600c6020908152604080832084845260038101909252822054909181900361192057831561191b57600182015460000361186e5750600281018054600180820183556000928352602090922081018590559081148015906117cd575081546117c1600183611f1e565b6117cb9190612068565b155b156118695781546000906117e19083612202565b6000818152600485016020526040812054919250611800846001611f37565b90508460020185600201848154811061181b5761181b61203c565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b6118e9565b60018083018054909161188091611f1e565b815481106118905761189061203c565b90600052602060002001549050816001018054806118b0576118b0612216565b60019003818190600052602060002001600090559055838260020182815481106118dc576118dc61203c565b6000918252602090912001555b6000838152600383016020908152604080832084905583835260048501909152902083905561191b8582600187611b18565b611aa0565b836000036119be57600082600201828154811061193f5761193f61203c565b9060005260206000200154905060008360020183815481106119635761196361203c565b60009182526020808320909101929092556001808601805491820181558252828220018490558581526003850182526040808220829055848252600486019092529081208190556119b8908790849084611b18565b50611aa0565b8160020181815481106119d3576119d361203c565b90600052602060002001548414611aa0576000848360020183815481106119fc576119fc61203c565b906000526020600020015411159050600081611a425785846002018481548110611a2857611a2861203c565b9060005260206000200154611a3d9190611f1e565b611a6d565b836002018381548110611a5757611a5761203c565b906000526020600020015486611a6d9190611f1e565b905085846002018481548110611a8557611a8561203c565b600091825260209091200155611a9d87848484611b18565b50505b5050505050565b60006020825110611aba57506020015190565b5060065b919050565b600060405160005b6014811015611ae65783811a81600c84010153600101611acb565b505192915050565b6000546001600160a01b031633146102715760405162461bcd60e51b815260040161061690612093565b6000848152600c60205260409020835b8015610bdf578154611b3b600183611f1e565b611b459190612202565b905083611b7c5782826002018281548110611b6257611b6261203c565b9060005260206000200154611b779190611f1e565b611ba7565b82826002018281548110611b9257611b9261203c565b9060005260206000200154611ba79190611f37565b826002018281548110611bbc57611bbc61203c565b600091825260209091200155611b28565b6001600160a01b0391909116815260200190565b600060208284031215611bf357600080fd5b5035919050565b6001600160a01b038116811461027157600080fd5b6001600160601b038116811461027157600080fd5b600080600060608486031215611c3957600080fd5b8335611c4481611bfa565b92506020840135611c5481611c0f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611ca357611ca3611c65565b604052919050565b600082601f830112611cbc57600080fd5b81356001600160401b03811115611cd557611cd5611c65565b611ce8601f8201601f1916602001611c7b565b818152846020838601011115611cfd57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611d2d57600080fd5b8235915060208301356001600160401b03811115611d4a57600080fd5b611d5685828601611cab565b9150509250929050565b600080600060608486031215611d7557600080fd5b505081359360208301359350604090920135919050565b60008060408385031215611d9f57600080fd5b8235611daa81611bfa565b946020939093013593505050565b60008060408385031215611dcb57600080fd5b8235611dd681611bfa565b915060208301356001600160401b03811115611d4a57600080fd5b60008060008060008060c08789031215611e0a57600080fd5b8635611e1581611bfa565b95506020870135611e2581611bfa565b945060408701359350606087013592506080870135611e4381611bfa565b8092505060a087013590509295509295509295565b60008060408385031215611e6b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6003811061027157634e487b7160e01b600052602160045260246000fd5b60208101611ebb83611e90565b91905290565b600060208284031215611ed357600080fd5b8135610ebb81611bfa565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115611f3157611f31611f08565b92915050565b80820180821115611f3157611f31611f08565b600060208284031215611f5c57600080fd5b5051919050565b600060018201611f7557611f75611f08565b5060010190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b80518015158114611abe57600080fd5b600080600080600080600060e0888a031215611feb57600080fd5b8751611ff681611c0f565b965061200460208901611fc0565b955060408801519450606088015193506080880151925060a0880151915061202e60c08901611fc0565b905092959891949750929550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261207757612077612052565b500690565b8082028115828204841417611f3157611f31611f08565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6000825160005b818110156120f657602081860181015185830152016120dc565b506000920191825250919050565b60008161211357612113611f08565b506000190190565b6000806000806080858703121561213157600080fd5b505082516020840151604085015160609095015191969095509092509050565b6000602080838503121561216457600080fd5b82516001600160401b038082111561217b57600080fd5b818501915085601f83011261218f57600080fd5b8151818111156121a1576121a1611c65565b8060051b91506121b2848301611c7b565b81815291830184019184810190888411156121cc57600080fd5b938501935b838510156121f657845192506121e683611c0f565b82825293850193908501906121d1565b98975050505050505050565b60008261221157612211612052565b500490565b634e487b7160e01b600052603160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212207293f4a627465507c1f94d546ad4325f98872cbaa6255a769c6f7dfafe527b1564736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106101a35760003560e01c80635d2d7846116100e2578063c057eca711610085578063c057eca714610461578063c157261814610477578063ccbac9f51461048d578063d09f392d146104a3578063d605787b146104c3578063dd5e5cb5146104e3578063f2f4eb2614610503578063f6b4d82d1461052357600080fd5b80635d2d784614610372578063684fbf5f146103925780637dc38f14146103bf578063823cfd70146103d5578063b1c9fe6e146103f5578063b4a6160814610416578063b5d69e991461042b578063b888adfa1461044b57600080fd5b806345988e2c1161014a57806345988e2c14610294578063477a655c146102b45780634c70a0d6146102d45780634dbbebbc146102f45780634f1ef2861461031457806352d1902d1461032757806354812d171461033c57806356acb0501461035c57600080fd5b806303432744146101a85780630b274f2e146101d15780630b51806d146101e85780630c340a24146101fd5780630e083ec91461022a5780631b92bbbe1461024057806321ea9b3f1461025657806335975f4a14610274575b600080fd5b3480156101b457600080fd5b506101be60065481565b6040519081526020015b60405180910390f35b3480156101dd57600080fd5b506101e6610582565b005b3480156101f457600080fd5b506101be600681565b34801561020957600080fd5b5060005461021d906001600160a01b031681565b6040516101c89190611bcd565b34801561023657600080fd5b506101be600a5481565b34801561024c57600080fd5b506101be60035481565b34801561026257600080fd5b506101e6610271366004611be1565b50565b34801561028057600080fd5b506101e661028f366004611be1565b61095a565b3480156102a057600080fd5b506101e66102af366004611c24565b610aeb565b3480156102c057600080fd5b506101e66102cf366004611d1a565b610be7565b3480156102e057600080fd5b5061021d6102ef366004611d60565b610cde565b34801561030057600080fd5b506101e661030f366004611d8c565b610ec2565b6101e6610322366004611db8565b610fab565b34801561033357600080fd5b506101be6111ca565b34801561034857600080fd5b506101e6610357366004611df1565b611228565b34801561036857600080fd5b506101be600b5481565b34801561037e57600080fd5b506101e661038d366004611e58565b61134c565b34801561039e57600080fd5b506103b26103ad366004611c24565b61138f565b6040516101c89190611eae565b3480156103cb57600080fd5b506101be60095481565b3480156103e157600080fd5b506101e66103f0366004611be1565b611528565b34801561040157600080fd5b506001546103b290600160a01b900460ff1681565b34801561042257600080fd5b506101be600481565b34801561043757600080fd5b506101e6610446366004611ec1565b611557565b34801561045757600080fd5b506101be60045481565b34801561046d57600080fd5b506101be60025481565b34801561048357600080fd5b506101be60055481565b34801561049957600080fd5b506101be60085481565b3480156104af57600080fd5b506101e66104be366004611e58565b6116a2565b3480156104cf57600080fd5b5060075461021d906001600160a01b031681565b3480156104ef57600080fd5b506101e66104fe366004611be1565b6116dc565b34801561050f57600080fd5b5060015461021d906001600160a01b031681565b34801561052f57600080fd5b5061057361053e366004611be1565b600d60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b6040516101c893929190611ede565b6000600154600160a01b900460ff1660028111156105a2576105a2611e7a565b03610715576002546004546105b79042611f1e565b101561061f5760405162461bcd60e51b815260206004820152602c60248201527f546865206d696e696d756d207374616b696e672074696d6520686173206e6f7460448201526b103830b9b9b2b2103cb2ba1760a11b60648201526084015b60405180910390fd5b6000600654116106815760405162461bcd60e51b815260206004820152602760248201527f546865726520617265206e6f2064697370757465732074686174206e65656420604482015266353ab937b9399760c91b6064820152608401610616565b6007546009546001600160a01b0390911690637363ae1f906106a39043611f37565b6040518263ffffffff1660e01b81526004016106c191815260200190565b600060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505043600555505060018054819060ff60a01b1916600160a01b825b021790555061090f565b60018054600160a01b900460ff16600281111561073457610734611e7a565b0361082c576007546009546005546001600160a01b03909216916313cf90549161075d91611f37565b6040518263ffffffff1660e01b815260040161077b91815260200190565b6020604051808303816000875af115801561079a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107be9190611f4a565b60088190556000036108125760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610616565b600180546002919060ff60a01b1916600160a01b8361070b565b6002600154600160a01b900460ff16600281111561084c5761084c611e7a565b0361090f57600654158061086e575060035460045461086b9042611f1e565b10155b6109015760405162461bcd60e51b815260206004820152605860248201527f546865726520617265207374696c6c20646973707574657320776974686f757460448201527f206a75726f727320616e6420746865206d6178696d756d2064726177696e67206064820152773a34b6b2903430b9903737ba103830b9b9b2b2103cb2ba1760411b608482015260a401610616565b6001805460ff60a01b191690555b426004556001546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161095091600160a01b90910460ff1690611eae565b60405180910390a1565b6000600154600160a01b900460ff16600281111561097a5761097a611e7a565b146109c75760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e00000000006044820152606401610616565b6000600a54600183600b546109dc9190611f37565b6109e69190611f1e565b116109f15781610a0c565b600b54600a54610a019190611f1e565b610a0c906001611f37565b9050600081600b54610a1e9190611f37565b600b549091505b81811015610ae3576000818152600d602052604090819020600180548254918301549351630761c14d60e01b815292936001600160a01b0391821693630761c14d93610a8893811692600160a01b9091046001600160601b031691600401611ede565b600060405180830381600087803b158015610aa257600080fd5b505af1158015610ab6573d6000803e3d6000fd5b5050506000838152600d602052604081208181556001015550819050610adb81611f63565b915050610a25565b50600b555050565b6001546001600160a01b03163314610b155760405162461bcd60e51b815260040161061690611f7c565b6000610b21848461170b565b90506000835b81610bdf57610b406001600160601b0382168585611753565b6000196001600160601b03821601610b5b5760019150610b27565b600154604051630fad06e960e11b81526001600160601b03831660048201526001600160a01b0390911690631f5a0dd29060240160e060405180830381865afa158015610bac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd09190611fd0565b50949550610b27945050505050565b505050505050565b6001546001600160a01b03163314610c115760405162461bcd60e51b815260040161061690611f7c565b6000828152600c6020526040812090610c2983611aa7565b825490915015610c725760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b6044820152606401610616565b60018111610cc25760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610616565b8155600201805460018101825560009182526020822001555050565b60006002600154600160a01b900460ff166002811115610d0057610d00611e7a565b14610d3c5760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b6044820152606401610616565b6000848152600c6020526040812060028101805491929091610d6057610d6061203c565b9060005260206000200154600003610d7c576000915050610ebb565b600081600201600081548110610d9457610d9461203c565b90600052602060002001546008548686604051602001610dc7939291909283526020830191909152604082015260600190565b6040516020818303038152906040528051906020012060001c610dea9190612068565b905060005b60028301548354610e0190839061207c565b610e0c906001611f37565b1015610e9b5760015b83548111610e9557600081838660000154610e30919061207c565b610e3a9190611f37565b90506000856002018281548110610e5357610e5361203c565b90600052602060002001549050808510610e7857610e718186611f1e565b9450610e80565b509150610e95565b50508080610e8d90611f63565b915050610e15565b50610def565b6000818152600484016020526040902054610eb590611ac3565b93505050505b9392505050565b6000546001600160a01b03163314610eec5760405162461bcd60e51b815260040161061690612093565b600780546001600160a01b0319166001600160a01b038416179055600981905560018054600160a01b900460ff166002811115610f2b57610f2b611e7a565b03610fa7576007546009546001600160a01b0390911690637363ae1f90610f529043611f37565b6040518263ffffffff1660e01b8152600401610f7091815260200190565b600060405180830381600087803b158015610f8a57600080fd5b505af1158015610f9e573d6000803e3d6000fd5b50504360055550505b5050565b610fb482611aee565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061103257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661102660008051602061222d8339815191525490565b6001600160a01b031614155b156110505760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110aa575060408051601f3d908101601f191682019092526110a791810190611f4a565b60015b6110c95781604051630c76093760e01b81526004016106169190611bcd565b60008051602061222d83398151915281146110fa57604051632a87526960e21b815260048101829052602401610616565b60008051602061222d8339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28151156111c5576000836001600160a01b03168360405161116191906120d5565b600060405180830381855af49150503d806000811461119c576040519150601f19603f3d011682016040523d82523d6000602084013e6111a1565b606091505b50509050806111c3576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112155760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061222d83398151915290565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680611271575080546001600160401b03808416911610155b1561128e5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600080546001600160a01b038b81166001600160a01b031992831617909255600180548b841690831617815560028a905560038990554260045560078054938916939092169290921790556009859055600b55815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050505050565b6001546001600160a01b031633146113765760405162461bcd60e51b815260040161061690611f7c565b6006805490600061138683612104565b91905055505050565b6001546000906001600160a01b031633146113bc5760405162461bcd60e51b815260040161061690611f7c565b600154604051631a383be960e31b81526001600160a01b0386811660048301526001600160601b0386166024830152600092839291169063d1c1df4890604401608060405180830381865afa158015611419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143d919061211b565b935093505050816000148015611454575060048110155b1561146457600292505050610ebb565b6000600154600160a01b900460ff16600281111561148457611484611e7a565b1461151c576040518060600160405280876001600160a01b03168152602001866001600160601b0316815260200185815250600d6000600a600081546114c990611f63565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b0390931692909217825591909101516001918201559250610ebb915050565b50600095945050505050565b6000546001600160a01b031633146115525760405162461bcd60e51b815260040161061690612093565b600255565b6001546001600160a01b031633146115815760405162461bcd60e51b815260040161061690611f7c565b600154604051632a1fc51b60e11b81526000916001600160a01b03169063543f8a36906115b2908590600401611bcd565b600060405180830381865afa1580156115cf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115f79190810190612151565b80519091505b80156111c557600180546001600160a01b031690630761c14d90859085906116259086611f1e565b815181106116355761163561203c565b602002602001015160006040518463ffffffff1660e01b815260040161165d93929190611ede565b600060405180830381600087803b15801561167757600080fd5b505af115801561168b573d6000803e3d6000fd5b50505050808061169a90612104565b9150506115fd565b6001546001600160a01b031633146116cc5760405162461bcd60e51b815260040161061690611f7c565b6006805490600061138683611f63565b6000546001600160a01b031633146117065760405162461bcd60e51b815260040161061690612093565b600355565b600060405160005b601481101561172e578481600c011a81830153600101611713565b5060145b602081101561174a5783811a81830153600101611732565b50519392505050565b6000838152600c6020908152604080832084845260038101909252822054909181900361192057831561191b57600182015460000361186e5750600281018054600180820183556000928352602090922081018590559081148015906117cd575081546117c1600183611f1e565b6117cb9190612068565b155b156118695781546000906117e19083612202565b6000818152600485016020526040812054919250611800846001611f37565b90508460020185600201848154811061181b5761181b61203c565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b6118e9565b60018083018054909161188091611f1e565b815481106118905761189061203c565b90600052602060002001549050816001018054806118b0576118b0612216565b60019003818190600052602060002001600090559055838260020182815481106118dc576118dc61203c565b6000918252602090912001555b6000838152600383016020908152604080832084905583835260048501909152902083905561191b8582600187611b18565b611aa0565b836000036119be57600082600201828154811061193f5761193f61203c565b9060005260206000200154905060008360020183815481106119635761196361203c565b60009182526020808320909101929092556001808601805491820181558252828220018490558581526003850182526040808220829055848252600486019092529081208190556119b8908790849084611b18565b50611aa0565b8160020181815481106119d3576119d361203c565b90600052602060002001548414611aa0576000848360020183815481106119fc576119fc61203c565b906000526020600020015411159050600081611a425785846002018481548110611a2857611a2861203c565b9060005260206000200154611a3d9190611f1e565b611a6d565b836002018381548110611a5757611a5761203c565b906000526020600020015486611a6d9190611f1e565b905085846002018481548110611a8557611a8561203c565b600091825260209091200155611a9d87848484611b18565b50505b5050505050565b60006020825110611aba57506020015190565b5060065b919050565b600060405160005b6014811015611ae65783811a81600c84010153600101611acb565b505192915050565b6000546001600160a01b031633146102715760405162461bcd60e51b815260040161061690612093565b6000848152600c60205260409020835b8015610bdf578154611b3b600183611f1e565b611b459190612202565b905083611b7c5782826002018281548110611b6257611b6261203c565b9060005260206000200154611b779190611f1e565b611ba7565b82826002018281548110611b9257611b9261203c565b9060005260206000200154611ba79190611f37565b826002018281548110611bbc57611bbc61203c565b600091825260209091200155611b28565b6001600160a01b0391909116815260200190565b600060208284031215611bf357600080fd5b5035919050565b6001600160a01b038116811461027157600080fd5b6001600160601b038116811461027157600080fd5b600080600060608486031215611c3957600080fd5b8335611c4481611bfa565b92506020840135611c5481611c0f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611ca357611ca3611c65565b604052919050565b600082601f830112611cbc57600080fd5b81356001600160401b03811115611cd557611cd5611c65565b611ce8601f8201601f1916602001611c7b565b818152846020838601011115611cfd57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611d2d57600080fd5b8235915060208301356001600160401b03811115611d4a57600080fd5b611d5685828601611cab565b9150509250929050565b600080600060608486031215611d7557600080fd5b505081359360208301359350604090920135919050565b60008060408385031215611d9f57600080fd5b8235611daa81611bfa565b946020939093013593505050565b60008060408385031215611dcb57600080fd5b8235611dd681611bfa565b915060208301356001600160401b03811115611d4a57600080fd5b60008060008060008060c08789031215611e0a57600080fd5b8635611e1581611bfa565b95506020870135611e2581611bfa565b945060408701359350606087013592506080870135611e4381611bfa565b8092505060a087013590509295509295509295565b60008060408385031215611e6b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6003811061027157634e487b7160e01b600052602160045260246000fd5b60208101611ebb83611e90565b91905290565b600060208284031215611ed357600080fd5b8135610ebb81611bfa565b6001600160a01b039390931683526001600160601b03919091166020830152604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115611f3157611f31611f08565b92915050565b80820180821115611f3157611f31611f08565b600060208284031215611f5c57600080fd5b5051919050565b600060018201611f7557611f75611f08565b5060010190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b80518015158114611abe57600080fd5b600080600080600080600060e0888a031215611feb57600080fd5b8751611ff681611c0f565b965061200460208901611fc0565b955060408801519450606088015193506080880151925060a0880151915061202e60c08901611fc0565b905092959891949750929550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261207757612077612052565b500690565b8082028115828204841417611f3157611f31611f08565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6000825160005b818110156120f657602081860181015185830152016120dc565b506000920191825250919050565b60008161211357612113611f08565b506000190190565b6000806000806080858703121561213157600080fd5b505082516020840151604085015160609095015191969095509092509050565b6000602080838503121561216457600080fd5b82516001600160401b038082111561217b57600080fd5b818501915085601f83011261218f57600080fd5b8151818111156121a1576121a1611c65565b8060051b91506121b2848301611c7b565b81815291830184019184810190888411156121cc57600080fd5b938501935b838510156121f657845192506121e683611c0f565b82825293850193908501906121d1565b98975050505050505050565b60008261221157612211612052565b500490565b634e487b7160e01b600052603160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212207293f4a627465507c1f94d546ad4325f98872cbaa6255a769c6f7dfafe527b1564736f6c63430008120033", + "devdoc": { + "details": "A factory of trees that keeps track of staked values for sortition.", + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "changeMaxDrawingTime(uint256)": { + "details": "Changes the `maxDrawingTime` storage variable.", + "params": { + "_maxDrawingTime": "The new value for the `maxDrawingTime` storage variable." + } + }, + "changeMinStakingTime(uint256)": { + "details": "Changes the `minStakingTime` storage variable.", + "params": { + "_minStakingTime": "The new value for the `minStakingTime` storage variable." + } + }, + "changeRandomNumberGenerator(address,uint256)": { + "details": "Changes the `_rng` and `_rngLookahead` storage variables.", + "params": { + "_rng": "The new value for the `RNGenerator` storage variable.", + "_rngLookahead": "The new value for the `rngLookahead` storage variable." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "createTree(bytes32,bytes)": { + "details": "Create a sortition sum tree at the specified key.", + "params": { + "_extraData": "Extra data that contains the number of children each node in the tree should have.", + "_key": "The key of the new tree." + } + }, + "draw(bytes32,uint256,uint256)": { + "details": "Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.", + "params": { + "_coreDisputeID": "Index of the dispute in Kleros Core.", + "_key": "The key of the tree.", + "_nonce": "Nonce to hash with random number." + }, + "returns": { + "drawnAddress": "The drawn address. `O(k * log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended." + } + }, + "executeDelayedStakes(uint256)": { + "details": "Executes the next delayed stakes.", + "params": { + "_iterations": "The number of delayed stakes to execute." + } + }, + "initialize(address,address,uint256,uint256,address,uint256)": { + "details": "Initializer (constructor equivalent for upgradable contracts).", + "params": { + "_core": "The KlerosCore.", + "_maxDrawingTime": "Time after which the drawing phase can be switched", + "_minStakingTime": "Minimal time to stake", + "_rng": "The random number generator.", + "_rngLookahead": "Lookahead value for rng." + } + }, + "notifyRandomNumber(uint256)": { + "details": "Saves the random number to use it in sortition. Not used by this contract because the storing of the number is inlined in passPhase().", + "params": { + "_randomNumber": "Random number returned by RNG contract." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "setJurorInactive(address)": { + "details": "Unstakes the inactive juror from all courts. `O(n * (p * log_k(j)) )` where `n` is the number of courts the juror has staked in, `p` is the depth of the court tree, `k` is the minimum number of children per node of one of these courts' sortition sum tree, and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.", + "params": { + "_account": "The juror to unstake." + } + }, + "setStake(address,uint96,uint256)": { + "details": "Sets the value for a particular court and its parent courts.", + "params": { + "_account": "Address of the juror. `O(log_k(n))` where `k` is the maximum number of children per node in the tree, and `n` is the maximum number of nodes ever appended.", + "_courtID": "ID of the court.", + "_value": "The new value." + } + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + } + }, + "title": "SortitionModule", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4039, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 4042, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "core", + "offset": 0, + "slot": "1", + "type": "t_contract(KlerosCore)3971" + }, + { + "astId": 4045, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "phase", + "offset": 20, + "slot": "1", + "type": "t_enum(Phase)9405" + }, + { + "astId": 4047, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "minStakingTime", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 4049, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "maxDrawingTime", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 4051, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "lastPhaseChange", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 4053, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "randomNumberRequestBlock", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 4055, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "disputesWithoutJurors", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 4058, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "rng", + "offset": 0, + "slot": "7", + "type": "t_contract(RNG)10050" + }, + { + "astId": 4060, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "randomNumber", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 4062, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "rngLookahead", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 4064, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "delayedStakeWriteIndex", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 4066, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "delayedStakeReadIndex", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 4071, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "sortitionSumTrees", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)4024_storage)" + }, + { + "astId": 4076, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "delayedStakes", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_uint256,t_struct(DelayedStake)4031_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(KlerosCore)3971": { + "encoding": "inplace", + "label": "contract KlerosCore", + "numberOfBytes": "20" + }, + "t_contract(RNG)10050": { + "encoding": "inplace", + "label": "contract RNG", + "numberOfBytes": "20" + }, + "t_enum(Phase)9405": { + "encoding": "inplace", + "label": "enum ISortitionModule.Phase", + "numberOfBytes": "1" + }, + "t_mapping(t_bytes32,t_struct(SortitionSumTree)4024_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct SortitionModule.SortitionSumTree)", + "numberOfBytes": "32", + "value": "t_struct(SortitionSumTree)4024_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_struct(DelayedStake)4031_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct SortitionModule.DelayedStake)", + "numberOfBytes": "32", + "value": "t_struct(DelayedStake)4031_storage" + }, + "t_struct(DelayedStake)4031_storage": { + "encoding": "inplace", + "label": "struct SortitionModule.DelayedStake", + "members": [ + { + "astId": 4026, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 4028, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "courtID", + "offset": 20, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 4030, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "stake", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_struct(SortitionSumTree)4024_storage": { + "encoding": "inplace", + "label": "struct SortitionModule.SortitionSumTree", + "members": [ + { + "astId": 4009, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "K", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 4012, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "stack", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 4015, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "nodes", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 4019, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "IDsToNodeIndexes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 4023, + "contract": "src/arbitration/SortitionModule.sol:SortitionModule", + "label": "nodeIndexesToIDs", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "160" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Proxy.json b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Proxy.json new file mode 100644 index 000000000..200154f1c --- /dev/null +++ b/contracts/deployments/arbitrumGoerliDevnet/SortitionModule_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", + "transactionIndex": 1, + "gasUsed": "332281", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000200000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x619c881d0f4e09106b8808e3e1168e6c179f9b3f9948cc6e687a8dd0ccdf3cb8", + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 43823761, + "transactionHash": "0xb62dfb1c5b5933f76db1535170f03bbc05aba45159b0b99ac18afd5672c10e89", + "address": "0xA7e5D4C3E6C593cF6A367C3A415BB8E4A065E62E", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x619c881d0f4e09106b8808e3e1168e6c179f9b3f9948cc6e687a8dd0ccdf3cb8" + } + ], + "blockNumber": 43823761, + "cumulativeGasUsed": "332281", + "status": 1, + "byzantium": true + }, + "args": [ + "0xA472Dfb104696E5CE82E46148c33Cd5FeE2C3b7d", + "0x54812d17000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3000000000000000000000000813dcc76dba91dd9f6bdd038aea0877fc95656be00000000000000000000000000000000000000000000000000000000000007080000000000000000000000000000000000000000000000000000000000000708000000000000000000000000f67d956988cb11449db7aea80e6339b95b1605930000000000000000000000000000000000000000000000000000000000000014" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis.json b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis.json index 36592c222..342882e2f 100644 --- a/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis.json +++ b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis.json @@ -1,31 +1,55 @@ { - "address": "0x83F393F2aE68FA6A6701D7c65CBbFf3225f3fDf9", + "address": "0x078dAd05373d19d7fd6829735b765F12242a4300", "abi": [ + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, { "inputs": [ { "internalType": "address", - "name": "_governor", - "type": "address" - }, - { - "internalType": "address", - "name": "_veaOutbox", + "name": "implementation", "type": "address" - }, - { - "internalType": "uint256", - "name": "_homeChainID", - "type": "uint256" - }, + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ { - "internalType": "address", - "name": "_homeGateway", - "type": "address" + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" } ], - "stateMutability": "nonpayable", - "type": "constructor" + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" }, { "anonymous": false, @@ -121,6 +145,19 @@ "name": "DisputeCreation", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -171,6 +208,19 @@ "name": "Ruling", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, { "inputs": [], "name": "DEFAULT_NB_OF_JURORS", @@ -518,6 +568,47 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_veaOutbox", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_homeChainID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_homeGateway", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -559,6 +650,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [], "name": "veaOutbox", @@ -584,347 +693,96 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" } ], - "transactionHash": "0x6ea9e281509ec33eb738298e35407da985a4a6f2dbace9fb313d8d30e5351345", + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x83F393F2aE68FA6A6701D7c65CBbFf3225f3fDf9", + "contractAddress": "0x078dAd05373d19d7fd6829735b765F12242a4300", "transactionIndex": 1, - "gasUsed": "1061402", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1c82fb1088526e8fd4c4341cc2f319a36c09d02135481e941c4b0af3a2afe6eb", - "transactionHash": "0x6ea9e281509ec33eb738298e35407da985a4a6f2dbace9fb313d8d30e5351345", - "logs": [], - "blockNumber": 5434035, - "cumulativeGasUsed": "1090534", + "gasUsed": "265335", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7ede631dec7eef5b52cd5719c77b2df2768ce5716f943b49d0484d77f81d9568", + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 6246439, + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", + "address": "0x078dAd05373d19d7fd6829735b765F12242a4300", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x7ede631dec7eef5b52cd5719c77b2df2768ce5716f943b49d0484d77f81d9568" + } + ], + "blockNumber": 6246439, + "cumulativeGasUsed": "291331", "status": 1, "byzantium": true }, "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0xdFd7aDEb43d46FA3f16FB3e27F7fe85c3f5BD89D", - "0x0000000000000000000000000000000000000000000000000000000000066eed", - "0x12633ad7bd757858ada24738a94aeeba08727f1b" + "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", + "0xbe203094000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3000000000000000000000000dfd7adeb43d46fa3f16fb3e27f7fe85c3f5bd89d0000000000000000000000000000000000000000000000000000000000066eed000000000000000000000000920856556ef06ff7d337af964d1954862f8da049" ], - "numDeployments": 2, - "solcInputHash": "4a879192e8bde2273db37e489aeff250", - "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_veaOutbox\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_homeChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_homeGateway\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"AcceptedFeeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"ArbitrationCostModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_foreignBlockHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_foreignArbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_foreignDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"CrossChainDisputeOutgoing\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"NewCurrencyRate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_NB_OF_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_homeGateway\",\"type\":\"address\"}],\"name\":\"changeHomeGateway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veaOutbox\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gracePeriod\",\"type\":\"uint256\"}],\"name\":\"changeVea\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deprecatedVeaOutbox\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deprecatedVeaOutboxExpiration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"disputeHashToForeignID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoDisputeData\",\"outputs\":[{\"internalType\":\"uint248\",\"name\":\"id\",\"type\":\"uint248\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"arbitrable\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"name\":\"feeForJuror\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_messageSender\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_relayer\",\"type\":\"address\"}],\"name\":\"relayRule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"senderGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veaOutbox\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AcceptedFeeToken(address,bool)\":{\"details\":\"To be emitted when an ERC20 token is added or removed as a method to pay fees.\",\"params\":{\"_accepted\":\"Whether the token is accepted or not.\",\"_token\":\"The ERC20 token.\"}},\"CrossChainDisputeOutgoing(bytes32,address,uint256,uint256,bytes)\":{\"details\":\"To be emitted when a dispute is sent to the IHomeGateway.\",\"params\":{\"_choices\":\"The number of choices the arbitrator can choose from in this dispute.\",\"_extraData\":\"Any extra data to attach.\",\"_foreignArbitrable\":\"The address of the Arbitrable contract.\",\"_foreignBlockHash\":\"foreignBlockHash\",\"_foreignDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\"}},\"DisputeCreation(uint256,address)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_arbitrable\":\"The contract which created the dispute.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\"}},\"NewCurrencyRate(address,uint64,uint8)\":{\"details\":\"To be emitted when the fee for a particular ERC20 token is updated.\",\"params\":{\"_feeToken\":\"The ERC20 token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrable\":\"The arbitrable receiving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}}},\"kind\":\"dev\",\"methods\":{\"arbitrationCost(bytes)\":{\"details\":\"Compute the cost of arbitration denominated in the native currency, typically ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost in ETH.\"}},\"arbitrationCost(bytes,address)\":{\"details\":\"Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeToken\":\"The ERC20 token used to pay fees.\"},\"returns\":{\"_0\":\"The arbitration cost in `_feeToken`.\"}},\"changeCourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.\",\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the governor.\",\"params\":{\"_governor\":\"The address of the new governor.\"}},\"changeHomeGateway(address)\":{\"details\":\"Changes the home gateway.\",\"params\":{\"_homeGateway\":\"The address of the new home gateway.\"}},\"changeVea(address,uint256)\":{\"details\":\"Changes the outbox.\",\"params\":{\"_gracePeriod\":\"The duration to accept messages from the deprecated bridge (if at all).\",\"_veaOutbox\":\"The address of the new outbox.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"createDispute(uint256,bytes,address,uint256)\":{\"details\":\"Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeAmount\":\"Amount of the ERC20 token used to pay fees.\",\"_feeToken\":\"The ERC20 token used to pay fees.\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"_0\":\"The identifier of the dispute created.\"}},\"disputeHashToForeignID(bytes32)\":{\"details\":\"Looks up the local foreign disputeID for a disputeHash\",\"params\":{\"_disputeHash\":\"dispute hash\"}},\"withdrawFees(bytes32)\":{\"params\":{\"_disputeHash\":\"The dispute hash for which to withdraw the fees.\"}}},\"stateVariables\":{\"homeChainID\":{\"return\":\"The chain ID where the corresponding home gateway is deployed.\",\"returns\":{\"_0\":\"The chain ID where the corresponding home gateway is deployed.\"}},\"homeGateway\":{\"return\":\"The address of the corresponding home gateway.\",\"returns\":{\"_0\":\"The address of the corresponding home gateway.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayRule(address,bytes32,uint256,address)\":{\"notice\":\"Relay the rule call from the home gateway to the arbitrable.\"},\"withdrawFees(bytes32)\":{\"notice\":\"Reimburses the dispute fees to the relayer who paid for these fees on the home chain.\"}},\"notice\":\"Foreign Gateway Counterpart of `HomeGateway`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/ForeignGateway.sol\":\"ForeignGateway\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\ninterface IReceiverGateway {\\n function veaOutbox() external view returns (address);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xde6bdbe57ced7c1e79d62dca23aa8c2322e031da91ceac22cefd185f1e3740ef\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/gateway/ForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\n\\n/// Foreign Gateway\\n/// Counterpart of `HomeGateway`\\ncontract ForeignGateway is IForeignGateway {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event ArbitrationCostModified(uint96 indexed _courtID, uint256 _feeForJuror);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n uint256 internal localDisputeID = 1; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero.\\n mapping(uint96 => uint256) public feeForJuror; // feeForJuror[v2CourtID], it mirrors the value on KlerosCore.\\n address public governor;\\n address public veaOutbox;\\n uint256 public immutable override homeChainID;\\n address public override homeGateway;\\n address public deprecatedVeaOutbox;\\n uint256 public deprecatedVeaOutboxExpiration;\\n mapping(bytes32 => DisputeData) public disputeHashtoDisputeData;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyFromVea(address _messageSender) {\\n require(\\n veaOutbox == msg.sender ||\\n (block.timestamp < deprecatedVeaOutboxExpiration && deprecatedVeaOutbox == msg.sender),\\n \\\"Access not allowed: Vea Outbox only.\\\"\\n );\\n require(_messageSender == homeGateway, \\\"Access not allowed: HomeGateway only.\\\");\\n _;\\n }\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n constructor(address _governor, address _veaOutbox, uint256 _homeChainID, address _homeGateway) {\\n governor = _governor;\\n veaOutbox = _veaOutbox;\\n homeChainID = _homeChainID;\\n homeGateway = _homeGateway;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Changes the governor.\\n /// @param _governor The address of the new governor.\\n function changeGovernor(address _governor) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n governor = _governor;\\n }\\n\\n /// @dev Changes the outbox.\\n /// @param _veaOutbox The address of the new outbox.\\n /// @param _gracePeriod The duration to accept messages from the deprecated bridge (if at all).\\n function changeVea(address _veaOutbox, uint256 _gracePeriod) external onlyByGovernor {\\n // grace period to relay the remaining messages which are still going through the deprecated bridge.\\n deprecatedVeaOutboxExpiration = block.timestamp + _gracePeriod;\\n deprecatedVeaOutbox = veaOutbox;\\n veaOutbox = _veaOutbox;\\n }\\n\\n /// @dev Changes the home gateway.\\n /// @param _homeGateway The address of the new home gateway.\\n function changeHomeGateway(address _homeGateway) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n homeGateway = _homeGateway;\\n }\\n\\n /// @dev Changes the `feeForJuror` property value of a specified court.\\n /// @param _courtID The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.\\n /// @param _feeForJuror The new value for the `feeForJuror` property value.\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n feeForJuror[_courtID] = _feeForJuror;\\n emit ArbitrationCostModified(_courtID, _feeForJuror);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _choices,\\n bytes calldata _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n disputeID = localDisputeID++;\\n uint256 chainID;\\n assembly {\\n chainID := chainid()\\n }\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n \\\"createDispute\\\",\\n blockhash(block.number - 1),\\n chainID,\\n msg.sender,\\n disputeID,\\n _choices,\\n _extraData\\n )\\n );\\n\\n disputeHashtoDisputeData[disputeHash] = DisputeData({\\n id: uint248(disputeID),\\n arbitrable: msg.sender,\\n paid: msg.value,\\n relayer: address(0),\\n ruled: false\\n });\\n\\n emit CrossChainDisputeOutgoing(blockhash(block.number - 1), msg.sender, disputeID, _choices, _extraData);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 /*_choices*/,\\n bytes calldata /*_extraData*/,\\n IERC20 /*_feeToken*/,\\n uint256 /*_feeAmount*/\\n ) external pure override returns (uint256) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function arbitrationCost(bytes calldata _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors) = extraDataToCourtIDMinJurors(_extraData);\\n cost = feeForJuror[courtID] * minJurors;\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function arbitrationCost(\\n bytes calldata /*_extraData*/,\\n IERC20 /*_feeToken*/\\n ) public pure override returns (uint256 /*cost*/) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n /// @inheritdoc IForeignGateway\\n function relayRule(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _relayer\\n ) external override onlyFromVea(_messageSender) {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(!dispute.ruled, \\\"Cannot rule twice\\\");\\n\\n dispute.ruled = true;\\n dispute.relayer = _relayer;\\n\\n IArbitrableV2 arbitrable = IArbitrableV2(dispute.arbitrable);\\n arbitrable.rule(dispute.id, _ruling);\\n }\\n\\n /// @inheritdoc IForeignGateway\\n function withdrawFees(bytes32 _disputeHash) external override {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(dispute.ruled, \\\"Not ruled yet\\\");\\n\\n uint256 amount = dispute.paid;\\n dispute.paid = 0;\\n payable(dispute.relayer).transfer(amount);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @inheritdoc IForeignGateway\\n function disputeHashToForeignID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoDisputeData[_disputeHash].id;\\n }\\n\\n /// @inheritdoc IReceiverGateway\\n function senderGateway() external view override returns (address) {\\n return homeGateway;\\n }\\n\\n function currentRuling(\\n uint256 /*_disputeID*/\\n ) public pure returns (uint256 /*ruling*/, bool /*tied*/, bool /*overridden*/) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function extraDataToCourtIDMinJurors(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors) {\\n // Note that here we ignore DisputeKitID\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n }\\n if (feeForJuror[courtID] == 0) courtID = 0;\\n if (minJurors == 0) minJurors = DEFAULT_NB_OF_JURORS;\\n } else {\\n courtID = 0;\\n minJurors = DEFAULT_NB_OF_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x22ebbed56967cbb41908e6636be3c06b4c528bcb9f1f7556fecdf98945d717a8\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../../arbitration/interfaces/IArbitratorV2.sol\\\";\\nimport \\\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitratorV2, IReceiverGateway {\\n /// @dev To be emitted when a dispute is sent to the IHomeGateway.\\n /// @param _foreignBlockHash foreignBlockHash\\n /// @param _foreignArbitrable The address of the Arbitrable contract.\\n /// @param _foreignDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _choices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Any extra data to attach.\\n event CrossChainDisputeOutgoing(\\n bytes32 _foreignBlockHash,\\n address indexed _foreignArbitrable,\\n uint256 indexed _foreignDisputeID,\\n uint256 _choices,\\n bytes _extraData\\n );\\n\\n /// Relay the rule call from the home gateway to the arbitrable.\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n /// Reimburses the dispute fees to the relayer who paid for these fees on the home chain.\\n /// @param _disputeHash The dispute hash for which to withdraw the fees.\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n /// @dev Looks up the local foreign disputeID for a disputeHash\\n /// @param _disputeHash dispute hash\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n /// @return The chain ID where the corresponding home gateway is deployed.\\n function homeChainID() external view returns (uint256);\\n\\n /// @return The address of the corresponding home gateway.\\n function homeGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf59d1a9cd8b601f82ea3871d48bd9181e012a650e8f075e2c23c04df00ca6fe8\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a0604052600160005534801561001557600080fd5b5060405161118b38038061118b83398101604081905261003491610098565b600280546001600160a01b039586166001600160a01b0319918216179091556003805494861694821694909417909355608091909152600480549190931691161790556100e5565b80516001600160a01b038116811461009357600080fd5b919050565b600080600080608085870312156100ae57600080fd5b6100b78561007c565b93506100c56020860161007c565b9250604085015191506100da6060860161007c565b905092959194509250565b60805161108b61010060003960006101e8015261108b6000f3fe6080604052600436106101355760003560e01c8063a60a4db5116100ab578063d98493f61161006f578063d98493f614610419578063dea580b914610439578063e4c0aaf414610459578063ebb7119414610479578063f6506db414610499578063f7434ea9146104b457600080fd5b8063a60a4db514610311578063bcb1a16614610331578063c13517e114610346578063ce0aaf9514610359578063d3c617ff1461037757600080fd5b806336e41d3d116100fd57806336e41d3d1461024e57806345c9044114610264578063492d85d4146102915780634d53c2a5146102b157806367c51947146102d157806393626084146102f157600080fd5b80630c340a241461013a5780631c3db16d146101775780631debaba6146101b45780631fc6b556146101d65780632e1db89014610218575b600080fd5b34801561014657600080fd5b5060025461015a906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561018357600080fd5b50610197610192366004610c01565b6104d4565b60408051938452911515602084015215159082015260600161016e565b3480156101c057600080fd5b506101d46101cf366004610c32565b6104fa565b005b3480156101e257600080fd5b5061020a7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161016e565b34801561022457600080fd5b5061020a610233366004610c01565b6000908152600760205260409020546001600160f81b031690565b34801561025a57600080fd5b5061020a60065481565b34801561027057600080fd5b5061020a61027f366004610c7a565b60016020526000908152604090205481565b34801561029d57600080fd5b506101d46102ac366004610c9c565b610562565b3480156102bd57600080fd5b5060045461015a906001600160a01b031681565b3480156102dd57600080fd5b506101d46102ec366004610cb9565b6105ae565b3480156102fd57600080fd5b5060055461015a906001600160a01b031681565b34801561031d57600080fd5b506101d461032c366004610cd5565b610631565b34801561033d57600080fd5b5061020a600381565b61020a610354366004610d68565b61084e565b34801561036557600080fd5b506004546001600160a01b031661015a565b34801561038357600080fd5b506103db610392366004610c01565b60076020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161016e565b34801561042557600080fd5b5061020a610434366004610db4565b6109ea565b34801561044557600080fd5b5060035461015a906001600160a01b031681565b34801561046557600080fd5b506101d4610474366004610c9c565b610a04565b34801561048557600080fd5b506101d4610494366004610c01565b610a50565b3480156104a557600080fd5b5061020a610434366004610e0b565b3480156104c057600080fd5b5061020a6104cf366004610e72565b610b22565b600080600060405162461bcd60e51b81526004016104f190610eb4565b60405180910390fd5b6002546001600160a01b031633146105245760405162461bcd60e51b81526004016104f190610edb565b61052e8142610f33565b6006555060038054600580546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b0316331461058c5760405162461bcd60e51b81526004016104f190610edb565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146105d85760405162461bcd60e51b81526004016104f190610edb565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c596906106259084815260200190565b60405180910390a25050565b60035484906001600160a01b031633148061066257506006544210801561066257506005546001600160a01b031633145b6106ba5760405162461bcd60e51b8152602060048201526024808201527f416363657373206e6f7420616c6c6f7765643a20566561204f7574626f78206f60448201526337363c9760e11b60648201526084016104f1565b6004546001600160a01b038281169116146107255760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20486f6d65476174657761792060448201526437b7363c9760d91b60648201526084016104f1565b6000848152600760205260408120805490916001600160f81b0390911690036107605760405162461bcd60e51b81526004016104f190610f4c565b8054600160f81b900460ff16156107ad5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016104f1565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038681166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018790521690819063311a6c5690604401600060405180830381600087803b15801561082d57600080fd5b505af1158015610841573d6000803e3d6000fd5b5050505050505050505050565b600061085a8383610b22565b3410156108a95760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016104f1565b6000805490806108b883610f7c565b9091555090504660006108cc600143610f95565b408233858989896040516020016108e99796959493929190610fa8565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b0380881685526000858401818152338787018181523460608a0190815260808a01858152878652600790985297909320975191511515600160f81b029190931617865551600186810180546001600160a01b039384166001600160a01b031991821617909155955160028801559351600390960180549690911695909416949094179092559092508491907f03e54fa10baada663d819e5d7e4533535bfb6d4407abe51045be84e6c8de0203906109c59043610f95565b408989896040516109d99493929190611001565b60405180910390a350509392505050565b600060405162461bcd60e51b81526004016104f190610eb4565b6002546001600160a01b03163314610a2e5760405162461bcd60e51b81526004016104f190610edb565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600760205260408120805490916001600160f81b039091169003610a8b5760405162461bcd60e51b81526004016104f190610f4c565b8054600160f81b900460ff16610ad35760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016104f1565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610b1c573d6000803e3d6000fd5b50505050565b6000806000610b6685858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b9892505050565b6001600160601b0382166000908152600160205260409020549193509150610b8f90829061103e565b95945050505050565b6000806040835110610bf557602083015191506040830151905060016000836001600160601b03166001600160601b0316815260200190815260200160002054600003610be457600091505b80600003610bf0575060035b915091565b50600090506003915091565b600060208284031215610c1357600080fd5b5035919050565b6001600160a01b0381168114610c2f57600080fd5b50565b60008060408385031215610c4557600080fd5b8235610c5081610c1a565b946020939093013593505050565b80356001600160601b0381168114610c7557600080fd5b919050565b600060208284031215610c8c57600080fd5b610c9582610c5e565b9392505050565b600060208284031215610cae57600080fd5b8135610c9581610c1a565b60008060408385031215610ccc57600080fd5b610c5083610c5e565b60008060008060808587031215610ceb57600080fd5b8435610cf681610c1a565b935060208501359250604085013591506060850135610d1481610c1a565b939692955090935050565b60008083601f840112610d3157600080fd5b50813567ffffffffffffffff811115610d4957600080fd5b602083019150836020828501011115610d6157600080fd5b9250929050565b600080600060408486031215610d7d57600080fd5b83359250602084013567ffffffffffffffff811115610d9b57600080fd5b610da786828701610d1f565b9497909650939450505050565b600080600060408486031215610dc957600080fd5b833567ffffffffffffffff811115610de057600080fd5b610dec86828701610d1f565b9094509250506020840135610e0081610c1a565b809150509250925092565b600080600080600060808688031215610e2357600080fd5b85359450602086013567ffffffffffffffff811115610e4157600080fd5b610e4d88828901610d1f565b9095509350506040860135610e6181610c1a565b949793965091946060013592915050565b60008060208385031215610e8557600080fd5b823567ffffffffffffffff811115610e9c57600080fd5b610ea885828601610d1f565b90969095509350505050565b6020808252600d908201526c139bdd081cdd5c1c1bdc9d1959609a1b604082015260600190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610f4657610f46610f1d565b92915050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b600060018201610f8e57610f8e610f1d565b5060010190565b81810381811115610f4657610f46610f1d565b6c6372656174654469737075746560981b815287600d82015286602d8201526001600160601b03198660601b16604d820152846061820152836081820152818360a18301376000910160a1019081529695505050505050565b84815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b8082028115828204841417610f4657610f46610f1d56fea2646970667358221220888d17a28a1ff1af1dfc3a7bd01b535245108bd5fc246f795eff76271d0a0cbc64736f6c63430008120033", - "deployedBytecode": "0x6080604052600436106101355760003560e01c8063a60a4db5116100ab578063d98493f61161006f578063d98493f614610419578063dea580b914610439578063e4c0aaf414610459578063ebb7119414610479578063f6506db414610499578063f7434ea9146104b457600080fd5b8063a60a4db514610311578063bcb1a16614610331578063c13517e114610346578063ce0aaf9514610359578063d3c617ff1461037757600080fd5b806336e41d3d116100fd57806336e41d3d1461024e57806345c9044114610264578063492d85d4146102915780634d53c2a5146102b157806367c51947146102d157806393626084146102f157600080fd5b80630c340a241461013a5780631c3db16d146101775780631debaba6146101b45780631fc6b556146101d65780632e1db89014610218575b600080fd5b34801561014657600080fd5b5060025461015a906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561018357600080fd5b50610197610192366004610c01565b6104d4565b60408051938452911515602084015215159082015260600161016e565b3480156101c057600080fd5b506101d46101cf366004610c32565b6104fa565b005b3480156101e257600080fd5b5061020a7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161016e565b34801561022457600080fd5b5061020a610233366004610c01565b6000908152600760205260409020546001600160f81b031690565b34801561025a57600080fd5b5061020a60065481565b34801561027057600080fd5b5061020a61027f366004610c7a565b60016020526000908152604090205481565b34801561029d57600080fd5b506101d46102ac366004610c9c565b610562565b3480156102bd57600080fd5b5060045461015a906001600160a01b031681565b3480156102dd57600080fd5b506101d46102ec366004610cb9565b6105ae565b3480156102fd57600080fd5b5060055461015a906001600160a01b031681565b34801561031d57600080fd5b506101d461032c366004610cd5565b610631565b34801561033d57600080fd5b5061020a600381565b61020a610354366004610d68565b61084e565b34801561036557600080fd5b506004546001600160a01b031661015a565b34801561038357600080fd5b506103db610392366004610c01565b60076020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161016e565b34801561042557600080fd5b5061020a610434366004610db4565b6109ea565b34801561044557600080fd5b5060035461015a906001600160a01b031681565b34801561046557600080fd5b506101d4610474366004610c9c565b610a04565b34801561048557600080fd5b506101d4610494366004610c01565b610a50565b3480156104a557600080fd5b5061020a610434366004610e0b565b3480156104c057600080fd5b5061020a6104cf366004610e72565b610b22565b600080600060405162461bcd60e51b81526004016104f190610eb4565b60405180910390fd5b6002546001600160a01b031633146105245760405162461bcd60e51b81526004016104f190610edb565b61052e8142610f33565b6006555060038054600580546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b0316331461058c5760405162461bcd60e51b81526004016104f190610edb565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146105d85760405162461bcd60e51b81526004016104f190610edb565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c596906106259084815260200190565b60405180910390a25050565b60035484906001600160a01b031633148061066257506006544210801561066257506005546001600160a01b031633145b6106ba5760405162461bcd60e51b8152602060048201526024808201527f416363657373206e6f7420616c6c6f7765643a20566561204f7574626f78206f60448201526337363c9760e11b60648201526084016104f1565b6004546001600160a01b038281169116146107255760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20486f6d65476174657761792060448201526437b7363c9760d91b60648201526084016104f1565b6000848152600760205260408120805490916001600160f81b0390911690036107605760405162461bcd60e51b81526004016104f190610f4c565b8054600160f81b900460ff16156107ad5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016104f1565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038681166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018790521690819063311a6c5690604401600060405180830381600087803b15801561082d57600080fd5b505af1158015610841573d6000803e3d6000fd5b5050505050505050505050565b600061085a8383610b22565b3410156108a95760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016104f1565b6000805490806108b883610f7c565b9091555090504660006108cc600143610f95565b408233858989896040516020016108e99796959493929190610fa8565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b0380881685526000858401818152338787018181523460608a0190815260808a01858152878652600790985297909320975191511515600160f81b029190931617865551600186810180546001600160a01b039384166001600160a01b031991821617909155955160028801559351600390960180549690911695909416949094179092559092508491907f03e54fa10baada663d819e5d7e4533535bfb6d4407abe51045be84e6c8de0203906109c59043610f95565b408989896040516109d99493929190611001565b60405180910390a350509392505050565b600060405162461bcd60e51b81526004016104f190610eb4565b6002546001600160a01b03163314610a2e5760405162461bcd60e51b81526004016104f190610edb565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600760205260408120805490916001600160f81b039091169003610a8b5760405162461bcd60e51b81526004016104f190610f4c565b8054600160f81b900460ff16610ad35760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016104f1565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610b1c573d6000803e3d6000fd5b50505050565b6000806000610b6685858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b9892505050565b6001600160601b0382166000908152600160205260409020549193509150610b8f90829061103e565b95945050505050565b6000806040835110610bf557602083015191506040830151905060016000836001600160601b03166001600160601b0316815260200190815260200160002054600003610be457600091505b80600003610bf0575060035b915091565b50600090506003915091565b600060208284031215610c1357600080fd5b5035919050565b6001600160a01b0381168114610c2f57600080fd5b50565b60008060408385031215610c4557600080fd5b8235610c5081610c1a565b946020939093013593505050565b80356001600160601b0381168114610c7557600080fd5b919050565b600060208284031215610c8c57600080fd5b610c9582610c5e565b9392505050565b600060208284031215610cae57600080fd5b8135610c9581610c1a565b60008060408385031215610ccc57600080fd5b610c5083610c5e565b60008060008060808587031215610ceb57600080fd5b8435610cf681610c1a565b935060208501359250604085013591506060850135610d1481610c1a565b939692955090935050565b60008083601f840112610d3157600080fd5b50813567ffffffffffffffff811115610d4957600080fd5b602083019150836020828501011115610d6157600080fd5b9250929050565b600080600060408486031215610d7d57600080fd5b83359250602084013567ffffffffffffffff811115610d9b57600080fd5b610da786828701610d1f565b9497909650939450505050565b600080600060408486031215610dc957600080fd5b833567ffffffffffffffff811115610de057600080fd5b610dec86828701610d1f565b9094509250506020840135610e0081610c1a565b809150509250925092565b600080600080600060808688031215610e2357600080fd5b85359450602086013567ffffffffffffffff811115610e4157600080fd5b610e4d88828901610d1f565b9095509350506040860135610e6181610c1a565b949793965091946060013592915050565b60008060208385031215610e8557600080fd5b823567ffffffffffffffff811115610e9c57600080fd5b610ea885828601610d1f565b90969095509350505050565b6020808252600d908201526c139bdd081cdd5c1c1bdc9d1959609a1b604082015260600190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610f4657610f46610f1d565b92915050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b600060018201610f8e57610f8e610f1d565b5060010190565b81810381811115610f4657610f46610f1d565b6c6372656174654469737075746560981b815287600d82015286602d8201526001600160601b03198660601b16604d820152846061820152836081820152818360a18301376000910160a1019081529695505050505050565b84815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b8082028115828204841417610f4657610f46610f1d56fea2646970667358221220888d17a28a1ff1af1dfc3a7bd01b535245108bd5fc246f795eff76271d0a0cbc64736f6c63430008120033", + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "execute": { + "methodName": "initialize", + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0xdFd7aDEb43d46FA3f16FB3e27F7fe85c3f5BD89D", + "0x0000000000000000000000000000000000000000000000000000000000066eed", + "0x920856556EF06ff7D337Af964D1954862f8Da049" + ] + }, + "implementation": "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", "devdoc": { - "events": { - "AcceptedFeeToken(address,bool)": { - "details": "To be emitted when an ERC20 token is added or removed as a method to pay fees.", - "params": { - "_accepted": "Whether the token is accepted or not.", - "_token": "The ERC20 token." - } - }, - "CrossChainDisputeOutgoing(bytes32,address,uint256,uint256,bytes)": { - "details": "To be emitted when a dispute is sent to the IHomeGateway.", - "params": { - "_choices": "The number of choices the arbitrator can choose from in this dispute.", - "_extraData": "Any extra data to attach.", - "_foreignArbitrable": "The address of the Arbitrable contract.", - "_foreignBlockHash": "foreignBlockHash", - "_foreignDisputeID": "The identifier of the dispute in the Arbitrable contract." - } - }, - "DisputeCreation(uint256,address)": { - "details": "To be emitted when a dispute is created.", - "params": { - "_arbitrable": "The contract which created the dispute.", - "_disputeID": "The identifier of the dispute in the Arbitrator contract." - } - }, - "NewCurrencyRate(address,uint64,uint8)": { - "details": "To be emitted when the fee for a particular ERC20 token is updated.", - "params": { - "_feeToken": "The ERC20 token.", - "_rateDecimals": "The new decimals of the fee token rate.", - "_rateInEth": "The new rate of the fee token in ETH." - } - }, - "Ruling(address,uint256,uint256)": { - "details": "To be raised when a ruling is given.", - "params": { - "_arbitrable": "The arbitrable receiving the ruling.", - "_disputeID": "The identifier of the dispute in the Arbitrator contract.", - "_ruling": "The ruling which was given." - } - } - }, + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", "kind": "dev", "methods": { - "arbitrationCost(bytes)": { - "details": "Compute the cost of arbitration denominated in the native currency, typically ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes)." - }, - "returns": { - "cost": "The arbitration cost in ETH." - } - }, - "arbitrationCost(bytes,address)": { - "details": "Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_feeToken": "The ERC20 token used to pay fees." - }, - "returns": { - "_0": "The arbitration cost in `_feeToken`." - } - }, - "changeCourtJurorFee(uint96,uint256)": { - "details": "Changes the `feeForJuror` property value of a specified court.", - "params": { - "_courtID": "The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.", - "_feeForJuror": "The new value for the `feeForJuror` property value." - } - }, - "changeGovernor(address)": { - "details": "Changes the governor.", - "params": { - "_governor": "The address of the new governor." - } - }, - "changeHomeGateway(address)": { - "details": "Changes the home gateway.", - "params": { - "_homeGateway": "The address of the new home gateway." - } - }, - "changeVea(address,uint256)": { - "details": "Changes the outbox.", - "params": { - "_gracePeriod": "The duration to accept messages from the deprecated bridge (if at all).", - "_veaOutbox": "The address of the new outbox." - } - }, - "createDispute(uint256,bytes)": { - "details": "Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." - }, - "returns": { - "disputeID": "The identifier of the dispute created." - } - }, - "createDispute(uint256,bytes,address,uint256)": { - "details": "Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", - "params": { - "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", - "_feeAmount": "Amount of the ERC20 token used to pay fees.", - "_feeToken": "The ERC20 token used to pay fees.", - "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." - }, - "returns": { - "_0": "The identifier of the dispute created." - } - }, - "disputeHashToForeignID(bytes32)": { - "details": "Looks up the local foreign disputeID for a disputeHash", - "params": { - "_disputeHash": "dispute hash" - } - }, - "withdrawFees(bytes32)": { - "params": { - "_disputeHash": "The dispute hash for which to withdraw the fees." - } + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." } }, "stateVariables": { - "homeChainID": { - "return": "The chain ID where the corresponding home gateway is deployed.", - "returns": { - "_0": "The chain ID where the corresponding home gateway is deployed." - } - }, - "homeGateway": { - "return": "The address of the corresponding home gateway.", - "returns": { - "_0": "The address of the corresponding home gateway." - } + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" } }, + "title": "UUPS Proxy", "version": 1 }, "userdoc": { "kind": "user", - "methods": { - "relayRule(address,bytes32,uint256,address)": { - "notice": "Relay the rule call from the home gateway to the arbitrable." - }, - "withdrawFees(bytes32)": { - "notice": "Reimburses the dispute fees to the relayer who paid for these fees on the home chain." - } - }, - "notice": "Foreign Gateway Counterpart of `HomeGateway`", + "methods": {}, "version": 1 }, "storageLayout": { - "storage": [ - { - "astId": 15750, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "localDisputeID", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 15754, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "feeForJuror", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_uint96,t_uint256)" - }, - { - "astId": 15756, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "governor", - "offset": 0, - "slot": "2", - "type": "t_address" - }, - { - "astId": 15758, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "veaOutbox", - "offset": 0, - "slot": "3", - "type": "t_address" - }, - { - "astId": 15764, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "homeGateway", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 15766, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "deprecatedVeaOutbox", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 15768, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "deprecatedVeaOutboxExpiration", - "offset": 0, - "slot": "6", - "type": "t_uint256" - }, - { - "astId": 15773, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "disputeHashtoDisputeData", - "offset": 0, - "slot": "7", - "type": "t_mapping(t_bytes32,t_struct(DisputeData)15738_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(DisputeData)15738_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct ForeignGateway.DisputeData)", - "numberOfBytes": "32", - "value": "t_struct(DisputeData)15738_storage" - }, - "t_mapping(t_uint96,t_uint256)": { - "encoding": "mapping", - "key": "t_uint96", - "label": "mapping(uint96 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(DisputeData)15738_storage": { - "encoding": "inplace", - "label": "struct ForeignGateway.DisputeData", - "members": [ - { - "astId": 15729, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "id", - "offset": 0, - "slot": "0", - "type": "t_uint248" - }, - { - "astId": 15731, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "ruled", - "offset": 31, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 15733, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "arbitrable", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 15735, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "paid", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 15737, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "relayer", - "offset": 0, - "slot": "3", - "type": "t_address" - } - ], - "numberOfBytes": "128" - }, - "t_uint248": { - "encoding": "inplace", - "label": "uint248", - "numberOfBytes": "31" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } + "storage": [], + "types": null } } diff --git a/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Implementation.json b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Implementation.json new file mode 100644 index 000000000..87cd88551 --- /dev/null +++ b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Implementation.json @@ -0,0 +1,1118 @@ +{ + "address": "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "FailedDelegateCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "_accepted", + "type": "bool" + } + ], + "name": "AcceptedFeeToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "ArbitrationCostModified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_foreignBlockHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "_foreignArbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_foreignDisputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "CrossChainDisputeOutgoing", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "_feeToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_rateInEth", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "_rateDecimals", + "type": "uint8" + } + ], + "name": "NewCurrencyRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrableV2", + "name": "_arbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_NB_OF_JURORS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "changeCourtJurorFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_homeGateway", + "type": "address" + } + ], + "name": "changeHomeGateway", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_veaOutbox", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gracePeriod", + "type": "uint256" + } + ], + "name": "changeVea", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "currentRuling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "deprecatedVeaOutbox", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deprecatedVeaOutboxExpiration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "disputeHashToForeignID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "disputeHashtoDisputeData", + "outputs": [ + { + "internalType": "uint248", + "name": "id", + "type": "uint248" + }, + { + "internalType": "bool", + "name": "ruled", + "type": "bool" + }, + { + "internalType": "address", + "name": "arbitrable", + "type": "address" + }, + { + "internalType": "uint256", + "name": "paid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "name": "feeForJuror", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "homeChainID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "homeGateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_veaOutbox", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_homeChainID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_homeGateway", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_messageSender", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_relayer", + "type": "address" + } + ], + "name": "relayRule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "senderGateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "veaOutbox", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xf709a57c35ca26594700e4b648185ecb948e1838772c51ed877062e8e241ef8e", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", + "transactionIndex": 1, + "gasUsed": "1301308", + "logsBloom": "0x00000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x51d614145cf5359099c84b1111d69ab2374cba6a0013c68e70b07fd97425d3f0", + "transactionHash": "0xf709a57c35ca26594700e4b648185ecb948e1838772c51ed877062e8e241ef8e", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 6246438, + "transactionHash": "0xf709a57c35ca26594700e4b648185ecb948e1838772c51ed877062e8e241ef8e", + "address": "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 1, + "blockHash": "0x51d614145cf5359099c84b1111d69ab2374cba6a0013c68e70b07fd97425d3f0" + } + ], + "blockNumber": 6246438, + "cumulativeGasUsed": "1388146", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedDelegateCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_accepted\",\"type\":\"bool\"}],\"name\":\"AcceptedFeeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"ArbitrationCostModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_foreignBlockHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_foreignArbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_foreignDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"CrossChainDisputeOutgoing\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IERC20\",\"name\":\"_feeToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_rateInEth\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_rateDecimals\",\"type\":\"uint8\"}],\"name\":\"NewCurrencyRate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrableV2\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_NB_OF_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_homeGateway\",\"type\":\"address\"}],\"name\":\"changeHomeGateway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veaOutbox\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gracePeriod\",\"type\":\"uint256\"}],\"name\":\"changeVea\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deprecatedVeaOutbox\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deprecatedVeaOutboxExpiration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"disputeHashToForeignID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoDisputeData\",\"outputs\":[{\"internalType\":\"uint248\",\"name\":\"id\",\"type\":\"uint248\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"arbitrable\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"name\":\"feeForJuror\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_veaOutbox\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_homeChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_homeGateway\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_messageSender\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_relayer\",\"type\":\"address\"}],\"name\":\"relayRule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"senderGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veaOutbox\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AlreadyInitialized()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"AcceptedFeeToken(address,bool)\":{\"details\":\"To be emitted when an ERC20 token is added or removed as a method to pay fees.\",\"params\":{\"_accepted\":\"Whether the token is accepted or not.\",\"_token\":\"The ERC20 token.\"}},\"CrossChainDisputeOutgoing(bytes32,address,uint256,uint256,bytes)\":{\"details\":\"To be emitted when a dispute is sent to the IHomeGateway.\",\"params\":{\"_choices\":\"The number of choices the arbitrator can choose from in this dispute.\",\"_extraData\":\"Any extra data to attach.\",\"_foreignArbitrable\":\"The address of the Arbitrable contract.\",\"_foreignBlockHash\":\"foreignBlockHash\",\"_foreignDisputeID\":\"The identifier of the dispute in the Arbitrable contract.\"}},\"DisputeCreation(uint256,address)\":{\"details\":\"To be emitted when a dispute is created.\",\"params\":{\"_arbitrable\":\"The contract which created the dispute.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\"}},\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"NewCurrencyRate(address,uint64,uint8)\":{\"details\":\"To be emitted when the fee for a particular ERC20 token is updated.\",\"params\":{\"_feeToken\":\"The ERC20 token.\",\"_rateDecimals\":\"The new decimals of the fee token rate.\",\"_rateInEth\":\"The new rate of the fee token in ETH.\"}},\"Ruling(address,uint256,uint256)\":{\"details\":\"To be raised when a ruling is given.\",\"params\":{\"_arbitrable\":\"The arbitrable receiving the ruling.\",\"_disputeID\":\"The identifier of the dispute in the Arbitrator contract.\",\"_ruling\":\"The ruling which was given.\"}},\"Upgraded(address)\":{\"params\":{\"newImplementation\":\"Address of the new implementation the proxy is now forwarding calls to.\"}}},\"kind\":\"dev\",\"methods\":{\"arbitrationCost(bytes)\":{\"details\":\"Compute the cost of arbitration denominated in the native currency, typically ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost in ETH.\"}},\"arbitrationCost(bytes,address)\":{\"details\":\"Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeToken\":\"The ERC20 token used to pay fees.\"},\"returns\":{\"_0\":\"The arbitration cost in `_feeToken`.\"}},\"changeCourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.\",\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the governor.\",\"params\":{\"_governor\":\"The address of the new governor.\"}},\"changeHomeGateway(address)\":{\"details\":\"Changes the home gateway.\",\"params\":{\"_homeGateway\":\"The address of the new home gateway.\"}},\"changeVea(address,uint256)\":{\"details\":\"Changes the outbox.\",\"params\":{\"_gracePeriod\":\"The duration to accept messages from the deprecated bridge (if at all).\",\"_veaOutbox\":\"The address of the new outbox.\"}},\"constructor\":{\"details\":\"Constructor, initializing the implementation to reduce attack surface.\"},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"disputeID\":\"The identifier of the dispute created.\"}},\"createDispute(uint256,bytes,address,uint256)\":{\"details\":\"Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_feeAmount\":\"Amount of the ERC20 token used to pay fees.\",\"_feeToken\":\"The ERC20 token used to pay fees.\",\"_numberOfChoices\":\"The number of choices the arbitrator can choose from in this dispute.\"},\"returns\":{\"_0\":\"The identifier of the dispute created.\"}},\"disputeHashToForeignID(bytes32)\":{\"details\":\"Looks up the local foreign disputeID for a disputeHash\",\"params\":{\"_disputeHash\":\"dispute hash\"}},\"initialize(address,address,uint256,address)\":{\"details\":\"Constructs the `PolicyRegistry` contract.\",\"params\":{\"_governor\":\"The governor's address.\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.\",\"params\":{\"data\":\"Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\",\"newImplementation\":\"Address of the new implementation contract.\"}},\"withdrawFees(bytes32)\":{\"params\":{\"_disputeHash\":\"The dispute hash for which to withdraw the fees.\"}}},\"stateVariables\":{\"homeChainID\":{\"return\":\"The chain ID where the corresponding home gateway is deployed.\",\"returns\":{\"_0\":\"The chain ID where the corresponding home gateway is deployed.\"}},\"homeGateway\":{\"return\":\"The address of the corresponding home gateway.\",\"returns\":{\"_0\":\"The address of the corresponding home gateway.\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}],\"InvalidImplementation(address)\":[{\"notice\":\"The `implementation` is not UUPS-compliant\"}]},\"events\":{\"Upgraded(address)\":{\"notice\":\"Emitted when the `implementation` has been successfully upgraded.\"}},\"kind\":\"user\",\"methods\":{\"relayRule(address,bytes32,uint256,address)\":{\"notice\":\"Relay the rule call from the home gateway to the arbitrable.\"},\"withdrawFees(bytes32)\":{\"notice\":\"Reimburses the dispute fees to the relayer who paid for these fees on the home chain.\"}},\"notice\":\"Foreign Gateway Counterpart of `HomeGateway`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/ForeignGateway.sol\":\"ForeignGateway\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\ninterface IReceiverGateway {\\n function veaOutbox() external view returns (address);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xde6bdbe57ced7c1e79d62dca23aa8c2322e031da91ceac22cefd185f1e3740ef\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// When developing arbitrable contracts, we need to:\\n/// - Define the action taken when a ruling is received by the contract.\\n/// - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\ninterface IArbitrableV2 {\\n /// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.\\n /// @param _arbitrator The arbitrator of the contract.\\n /// @param _arbitrableDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _externalDisputeID An identifier created outside Kleros by the protocol requesting arbitration.\\n /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.\\n /// @param _templateUri The URI to the dispute template. For example on IPFS: starting with '/ipfs/'. Should not be used with _templateId.\\n event DisputeRequest(\\n IArbitratorV2 indexed _arbitrator,\\n uint256 indexed _arbitrableDisputeID,\\n uint256 _externalDisputeID,\\n uint256 _templateId,\\n string _templateUri\\n );\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrator The arbitrator giving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev Give a ruling for a dispute.\\n /// Must be called by the arbitrator.\\n /// The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling Ruling given by the arbitrator.\\n /// Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x389326b1f749454ed179bdac2f9d6ce24a1ef944bbce976ca78b93f4e173354a\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrableV2.sol\\\";\\n\\n/// @title Arbitrator\\n/// Arbitrator interface that implements the new arbitration standard.\\n/// Unlike the ERC-792 this standard is not concerned with appeals, so each arbitrator can implement an appeal system that suits it the most.\\n/// When developing arbitrator contracts we need to:\\n/// - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).\\n/// - Define the functions for cost display (arbitrationCost).\\n/// - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).\\ninterface IArbitratorV2 {\\n /// @dev To be emitted when a dispute is created.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _arbitrable The contract which created the dispute.\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);\\n\\n /// @dev To be raised when a ruling is given.\\n /// @param _arbitrable The arbitrable receiving the ruling.\\n /// @param _disputeID The identifier of the dispute in the Arbitrator contract.\\n /// @param _ruling The ruling which was given.\\n event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.\\n /// @param _token The ERC20 token.\\n /// @param _accepted Whether the token is accepted or not.\\n event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);\\n\\n /// @dev To be emitted when the fee for a particular ERC20 token is updated.\\n /// @param _feeToken The ERC20 token.\\n /// @param _rateInEth The new rate of the fee token in ETH.\\n /// @param _rateDecimals The new decimals of the fee token rate.\\n event NewCurrencyRate(IERC20 indexed _feeToken, uint64 _rateInEth, uint8 _rateDecimals);\\n\\n /// @dev Create a dispute and pay for the fees in the native currency, typically ETH.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData\\n ) external payable returns (uint256 disputeID);\\n\\n /// @dev Create a dispute and pay for the fees in a supported ERC20 token.\\n /// Must be called by the arbitrable contract.\\n /// Must pay at least arbitrationCost(_extraData).\\n /// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @param _feeAmount Amount of the ERC20 token used to pay fees.\\n /// @return disputeID The identifier of the dispute created.\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n IERC20 _feeToken,\\n uint256 _feeAmount\\n ) external returns (uint256 disputeID);\\n\\n /// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @return cost The arbitration cost in ETH.\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n\\n /// @dev Compute the cost of arbitration denominated in `_feeToken`.\\n /// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\\n /// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n /// @param _feeToken The ERC20 token used to pay fees.\\n /// @return cost The arbitration cost in `_feeToken`.\\n function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);\\n\\n /// @dev Gets the current ruling of a specified dispute.\\n /// @param _disputeID The ID of the dispute.\\n /// @return ruling The current ruling.\\n /// @return tied Whether it's a tie or not.\\n /// @return overridden Whether the ruling was overridden by appeal funding or not.\\n function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n}\\n\",\"keccak256\":\"0x453943ba5ccc94b9b9cdfd4afd3678682d62d8b90fe16b43e90215387d2f6a51\",\"license\":\"MIT\"},\"src/gateway/ForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\nimport \\\"../proxy/UUPSProxiable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/// Foreign Gateway\\n/// Counterpart of `HomeGateway`\\ncontract ForeignGateway is IForeignGateway, UUPSProxiable, Initializable {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event ArbitrationCostModified(uint96 indexed _courtID, uint256 _feeForJuror);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\n uint256 internal localDisputeID; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero.\\n mapping(uint96 => uint256) public feeForJuror; // feeForJuror[v2CourtID], it mirrors the value on KlerosCore.\\n address public governor;\\n address public veaOutbox;\\n uint256 public override homeChainID;\\n address public override homeGateway;\\n address public deprecatedVeaOutbox;\\n uint256 public deprecatedVeaOutboxExpiration;\\n mapping(bytes32 => DisputeData) public disputeHashtoDisputeData;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyFromVea(address _messageSender) {\\n require(\\n veaOutbox == msg.sender ||\\n (block.timestamp < deprecatedVeaOutboxExpiration && deprecatedVeaOutbox == msg.sender),\\n \\\"Access not allowed: Vea Outbox only.\\\"\\n );\\n require(_messageSender == homeGateway, \\\"Access not allowed: HomeGateway only.\\\");\\n _;\\n }\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Constructor, initializing the implementation to reduce attack surface.\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Constructs the `PolicyRegistry` contract.\\n /// @param _governor The governor's address.\\n function initialize(\\n address _governor,\\n address _veaOutbox,\\n uint256 _homeChainID,\\n address _homeGateway\\n ) external reinitializer(1) {\\n governor = _governor;\\n veaOutbox = _veaOutbox;\\n homeChainID = _homeChainID;\\n homeGateway = _homeGateway;\\n localDisputeID = 1;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n * @dev Only the governor can perform upgrades (`onlyByGovernor`)\\n */\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n /// @dev Changes the governor.\\n /// @param _governor The address of the new governor.\\n function changeGovernor(address _governor) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n governor = _governor;\\n }\\n\\n /// @dev Changes the outbox.\\n /// @param _veaOutbox The address of the new outbox.\\n /// @param _gracePeriod The duration to accept messages from the deprecated bridge (if at all).\\n function changeVea(address _veaOutbox, uint256 _gracePeriod) external onlyByGovernor {\\n // grace period to relay the remaining messages which are still going through the deprecated bridge.\\n deprecatedVeaOutboxExpiration = block.timestamp + _gracePeriod;\\n deprecatedVeaOutbox = veaOutbox;\\n veaOutbox = _veaOutbox;\\n }\\n\\n /// @dev Changes the home gateway.\\n /// @param _homeGateway The address of the new home gateway.\\n function changeHomeGateway(address _homeGateway) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n homeGateway = _homeGateway;\\n }\\n\\n /// @dev Changes the `feeForJuror` property value of a specified court.\\n /// @param _courtID The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.\\n /// @param _feeForJuror The new value for the `feeForJuror` property value.\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n feeForJuror[_courtID] = _feeForJuror;\\n emit ArbitrationCostModified(_courtID, _feeForJuror);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 _choices,\\n bytes calldata _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n disputeID = localDisputeID++;\\n uint256 chainID;\\n assembly {\\n chainID := chainid()\\n }\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n \\\"createDispute\\\",\\n blockhash(block.number - 1),\\n chainID,\\n msg.sender,\\n disputeID,\\n _choices,\\n _extraData\\n )\\n );\\n\\n disputeHashtoDisputeData[disputeHash] = DisputeData({\\n id: uint248(disputeID),\\n arbitrable: msg.sender,\\n paid: msg.value,\\n relayer: address(0),\\n ruled: false\\n });\\n\\n emit CrossChainDisputeOutgoing(blockhash(block.number - 1), msg.sender, disputeID, _choices, _extraData);\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function createDispute(\\n uint256 /*_choices*/,\\n bytes calldata /*_extraData*/,\\n IERC20 /*_feeToken*/,\\n uint256 /*_feeAmount*/\\n ) external pure override returns (uint256) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function arbitrationCost(bytes calldata _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors) = extraDataToCourtIDMinJurors(_extraData);\\n cost = feeForJuror[courtID] * minJurors;\\n }\\n\\n /// @inheritdoc IArbitratorV2\\n function arbitrationCost(\\n bytes calldata /*_extraData*/,\\n IERC20 /*_feeToken*/\\n ) public pure override returns (uint256 /*cost*/) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n /// @inheritdoc IForeignGateway\\n function relayRule(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _relayer\\n ) external override onlyFromVea(_messageSender) {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(!dispute.ruled, \\\"Cannot rule twice\\\");\\n\\n dispute.ruled = true;\\n dispute.relayer = _relayer;\\n\\n IArbitrableV2 arbitrable = IArbitrableV2(dispute.arbitrable);\\n arbitrable.rule(dispute.id, _ruling);\\n }\\n\\n /// @inheritdoc IForeignGateway\\n function withdrawFees(bytes32 _disputeHash) external override {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(dispute.ruled, \\\"Not ruled yet\\\");\\n\\n uint256 amount = dispute.paid;\\n dispute.paid = 0;\\n payable(dispute.relayer).transfer(amount);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /// @inheritdoc IForeignGateway\\n function disputeHashToForeignID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoDisputeData[_disputeHash].id;\\n }\\n\\n /// @inheritdoc IReceiverGateway\\n function senderGateway() external view override returns (address) {\\n return homeGateway;\\n }\\n\\n function currentRuling(\\n uint256 /*_disputeID*/\\n ) public pure returns (uint256 /*ruling*/, bool /*tied*/, bool /*overridden*/) {\\n revert(\\\"Not supported\\\");\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function extraDataToCourtIDMinJurors(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors) {\\n // Note that here we ignore DisputeKitID\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n }\\n if (feeForJuror[courtID] == 0) courtID = 0;\\n if (minJurors == 0) minJurors = DEFAULT_NB_OF_JURORS;\\n } else {\\n courtID = 0;\\n minJurors = DEFAULT_NB_OF_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf79f183f51d6ec371c0bc6681fe794570d20e2bb7ed4c594df909f41b34527ad\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/// @custom:authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n/// @custom:reviewers: []\\n/// @custom:auditors: []\\n/// @custom:bounties: []\\n/// @custom:deployments: []\\n\\npragma solidity 0.8.18;\\n\\nimport \\\"../../arbitration/interfaces/IArbitratorV2.sol\\\";\\nimport \\\"@kleros/vea-contracts/src/interfaces/gateways/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitratorV2, IReceiverGateway {\\n /// @dev To be emitted when a dispute is sent to the IHomeGateway.\\n /// @param _foreignBlockHash foreignBlockHash\\n /// @param _foreignArbitrable The address of the Arbitrable contract.\\n /// @param _foreignDisputeID The identifier of the dispute in the Arbitrable contract.\\n /// @param _choices The number of choices the arbitrator can choose from in this dispute.\\n /// @param _extraData Any extra data to attach.\\n event CrossChainDisputeOutgoing(\\n bytes32 _foreignBlockHash,\\n address indexed _foreignArbitrable,\\n uint256 indexed _foreignDisputeID,\\n uint256 _choices,\\n bytes _extraData\\n );\\n\\n /// Relay the rule call from the home gateway to the arbitrable.\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n /// Reimburses the dispute fees to the relayer who paid for these fees on the home chain.\\n /// @param _disputeHash The dispute hash for which to withdraw the fees.\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n /// @dev Looks up the local foreign disputeID for a disputeHash\\n /// @param _disputeHash dispute hash\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n /// @return The chain ID where the corresponding home gateway is deployed.\\n function homeChainID() external view returns (uint256);\\n\\n /// @return The address of the corresponding home gateway.\\n function homeGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf59d1a9cd8b601f82ea3871d48bd9181e012a650e8f075e2c23c04df00ca6fe8\",\"license\":\"MIT\"},\"src/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) \\n\\npragma solidity 0.8.18;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to the proxy constructor\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1))\\n bytes32 private constant _INITIALIZABLE_STORAGE =\\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error AlreadyInitialized();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n if (!(isTopLevelCall && initialized < 1) && !(address(this).code.length == 0 && initialized == 1)) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert AlreadyInitialized();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert AlreadyInitialized();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := _INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5f734e0092e195ebee187ede1ecb16bd1ffe684addf1ea895d8351866f1846f\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxiable\\n * @author Simon Malatrait \\n * @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n * The functions included here can perform an upgrade of an UUPS Proxy, when this contract is set as the implementation behind such a proxy.\\n *\\n * IMPORTANT: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the transparent proxy.\\n * This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSProxiable` with a custom implementation of upgrades.\\n *\\n * The `_authorizeUpgrade` function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /**\\n * Emitted when the `implementation` has been successfully upgraded.\\n * @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n */\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// The `implementation` is not UUPS-compliant\\n error InvalidImplementation(address implementation);\\n\\n /// Failed Delegated call\\n error FailedDelegateCall();\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Storage variable of the proxiable contract address.\\n * It is used to check whether or not the current call is from the proxy.\\n */\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n * @dev Called by {upgradeToAndCall}.\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Upgrade mechanism including access control and UUPS-compliance.\\n * @param newImplementation Address of the new implementation contract.\\n * @param data Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual {\\n _authorizeUpgrade(newImplementation);\\n\\n /* Check that the execution is being performed through a delegatecall call and that the execution context is\\n a proxy contract with an implementation (as defined in ERC1967) pointing to self. */\\n if (address(this) == __self || _getImplementation() != __self) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n\\n try UUPSProxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n // Store the new implementation address to the implementation storage slot.\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, newImplementation)\\n }\\n emit Upgraded(newImplementation);\\n\\n if (data.length != 0) {\\n // The return data is not checked (checking, in case of success, that the newImplementation code is non-empty if the return data is empty) because the authorized callee is trusted.\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n revert FailedDelegateCall();\\n }\\n }\\n } catch {\\n revert InvalidImplementation(newImplementation);\\n }\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the if statement.\\n */\\n function proxiableUUID() external view virtual returns (bytes32) {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n return IMPLEMENTATION_SLOT;\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfcef20b48f40ce4099f1f5cfe3d1f2551b5c1997e92baaa0f0df62a3d4bd97e7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff16156100715760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805161161a6100fc6000396000818161060d01528181610636015261082e015261161a6000f3fe6080604052600436106101565760003560e01c806393626084116100c1578063d3c617ff1161007a578063d3c617ff146103c2578063d98493f614610464578063dea580b914610484578063e4c0aaf4146104a4578063ebb71194146104c4578063f6506db4146104e4578063f7434ea9146104ff57600080fd5b8063936260841461031c578063a60a4db51461033c578063bcb1a1661461035c578063be20309414610371578063c13517e114610391578063ce0aaf95146103a457600080fd5b806345c904411161011357806345c9044114610267578063492d85d4146102945780634d53c2a5146102b45780634f1ef286146102d457806352d1902d146102e757806367c51947146102fc57600080fd5b80630c340a241461015b5780631c3db16d146101985780631debaba6146101d55780631fc6b556146101f75780632e1db8901461021b57806336e41d3d14610251575b600080fd5b34801561016757600080fd5b5060025461017b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101a457600080fd5b506101b86101b336600461100f565b61051f565b60408051938452911515602084015215159082015260600161018f565b3480156101e157600080fd5b506101f56101f036600461103d565b610545565b005b34801561020357600080fd5b5061020d60045481565b60405190815260200161018f565b34801561022757600080fd5b5061020d61023636600461100f565b6000908152600860205260409020546001600160f81b031690565b34801561025d57600080fd5b5061020d60075481565b34801561027357600080fd5b5061020d610282366004611085565b60016020526000908152604090205481565b3480156102a057600080fd5b506101f56102af3660046110a7565b6105ad565b3480156102c057600080fd5b5060055461017b906001600160a01b031681565b6101f56102e23660046110da565b6105f9565b3480156102f357600080fd5b5061020d610821565b34801561030857600080fd5b506101f561031736600461119d565b61087f565b34801561032857600080fd5b5060065461017b906001600160a01b031681565b34801561034857600080fd5b506101f56103573660046111b9565b610902565b34801561036857600080fd5b5061020d600381565b34801561037d57600080fd5b506101f561038c366004611203565b610b1f565b61020d61039f366004611293565b610c35565b3480156103b057600080fd5b506005546001600160a01b031661017b565b3480156103ce57600080fd5b506104266103dd36600461100f565b60086020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161018f565b34801561047057600080fd5b5061020d61047f3660046112de565b610dd1565b34801561049057600080fd5b5060035461017b906001600160a01b031681565b3480156104b057600080fd5b506101f56104bf3660046110a7565b610deb565b3480156104d057600080fd5b506101f56104df36600461100f565b610e37565b3480156104f057600080fd5b5061020d61047f366004611334565b34801561050b57600080fd5b5061020d61051a36600461139a565b610f03565b600080600060405162461bcd60e51b815260040161053c906113db565b60405180910390fd5b6002546001600160a01b0316331461056f5760405162461bcd60e51b815260040161053c90611402565b610579814261145a565b6007555060038054600680546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146105d75760405162461bcd60e51b815260040161053c90611402565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b61060282610f79565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061068057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106746000805160206115c58339815191525490565b6001600160a01b031614155b1561069e5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156106f8575060408051601f3d908101601f191682019092526106f591810190611473565b60015b61072057604051630c76093760e01b81526001600160a01b038316600482015260240161053c565b6000805160206115c5833981519152811461075157604051632a87526960e21b81526004810182905260240161053c565b6000805160206115c58339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561081c576000836001600160a01b0316836040516107b8919061148c565b600060405180830381855af49150503d80600081146107f3576040519150601f19603f3d011682016040523d82523d6000602084013e6107f8565b606091505b505090508061081a576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461086c5760405163703e46dd60e11b815260040160405180910390fd5b506000805160206115c583398151915290565b6002546001600160a01b031633146108a95760405162461bcd60e51b815260040161053c90611402565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c596906108f69084815260200190565b60405180910390a25050565b60035484906001600160a01b031633148061093357506007544210801561093357506006546001600160a01b031633145b61098b5760405162461bcd60e51b8152602060048201526024808201527f416363657373206e6f7420616c6c6f7765643a20566561204f7574626f78206f60448201526337363c9760e11b606482015260840161053c565b6005546001600160a01b038281169116146109f65760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20486f6d65476174657761792060448201526437b7363c9760d91b606482015260840161053c565b6000848152600860205260408120805490916001600160f81b039091169003610a315760405162461bcd60e51b815260040161053c906114bb565b8054600160f81b900460ff1615610a7e5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b604482015260640161053c565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038681166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018790521690819063311a6c5690604401600060405180830381600087803b158015610afe57600080fd5b505af1158015610b12573d6000803e3d6000fd5b5050505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680610b68575080546001600160401b03808416911610155b15610b855760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600280546001600160a01b038981166001600160a01b03199283161790925560038054898416908316179055600487905560058054928716929091169190911790556001600055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050505050565b6000610c418383610f03565b341015610c905760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e00604482015260640161053c565b600080549080610c9f836114eb565b909155509050466000610cb3600143611504565b40823385898989604051602001610cd09796959493929190611517565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b0380881685526000858401818152338787018181523460608a0190815260808a01858152878652600890985297909320975191511515600160f81b029190931617865551600186810180546001600160a01b039384166001600160a01b031991821617909155955160028801559351600390960180549690911695909416949094179092559092508491907f03e54fa10baada663d819e5d7e4533535bfb6d4407abe51045be84e6c8de020390610dac9043611504565b40898989604051610dc09493929190611570565b60405180910390a350509392505050565b600060405162461bcd60e51b815260040161053c906113db565b6002546001600160a01b03163314610e155760405162461bcd60e51b815260040161053c90611402565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120805490916001600160f81b039091169003610e725760405162461bcd60e51b815260040161053c906114bb565b8054600160f81b900460ff16610eba5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b604482015260640161053c565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f1935050505015801561081a573d6000803e3d6000fd5b6000806000610f4785858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610fa692505050565b6001600160601b0382166000908152600160205260409020549193509150610f709082906115ad565b95945050505050565b6002546001600160a01b03163314610fa35760405162461bcd60e51b815260040161053c90611402565b50565b600080604083511061100357602083015191506040830151905060016000836001600160601b03166001600160601b0316815260200190815260200160002054600003610ff257600091505b80600003610ffe575060035b915091565b50600090506003915091565b60006020828403121561102157600080fd5b5035919050565b6001600160a01b0381168114610fa357600080fd5b6000806040838503121561105057600080fd5b823561105b81611028565b946020939093013593505050565b80356001600160601b038116811461108057600080fd5b919050565b60006020828403121561109757600080fd5b6110a082611069565b9392505050565b6000602082840312156110b957600080fd5b81356110a081611028565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156110ed57600080fd5b82356110f881611028565b915060208301356001600160401b038082111561111457600080fd5b818501915085601f83011261112857600080fd5b81358181111561113a5761113a6110c4565b604051601f8201601f19908116603f01168101908382118183101715611162576111626110c4565b8160405282815288602084870101111561117b57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156111b057600080fd5b61105b83611069565b600080600080608085870312156111cf57600080fd5b84356111da81611028565b9350602085013592506040850135915060608501356111f881611028565b939692955090935050565b6000806000806080858703121561121957600080fd5b843561122481611028565b9350602085013561123481611028565b92506040850135915060608501356111f881611028565b60008083601f84011261125d57600080fd5b5081356001600160401b0381111561127457600080fd5b60208301915083602082850101111561128c57600080fd5b9250929050565b6000806000604084860312156112a857600080fd5b8335925060208401356001600160401b038111156112c557600080fd5b6112d18682870161124b565b9497909650939450505050565b6000806000604084860312156112f357600080fd5b83356001600160401b0381111561130957600080fd5b6113158682870161124b565b909450925050602084013561132981611028565b809150509250925092565b60008060008060006080868803121561134c57600080fd5b8535945060208601356001600160401b0381111561136957600080fd5b6113758882890161124b565b909550935050604086013561138981611028565b949793965091946060013592915050565b600080602083850312156113ad57600080fd5b82356001600160401b038111156113c357600080fd5b6113cf8582860161124b565b90969095509350505050565b6020808252600d908201526c139bdd081cdd5c1c1bdc9d1959609a1b604082015260600190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561146d5761146d611444565b92915050565b60006020828403121561148557600080fd5b5051919050565b6000825160005b818110156114ad5760208186018101518583015201611493565b506000920191825250919050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b6000600182016114fd576114fd611444565b5060010190565b8181038181111561146d5761146d611444565b6c6372656174654469737075746560981b815287600d82015286602d8201526001600160601b03198660601b16604d820152846061820152836081820152818360a18301376000910160a1019081529695505050505050565b84815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b808202811582820484141761146d5761146d61144456fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212204651c10eb8dded7d25f1b67d58f568a9aabba6e281bf159ce4fbee5373c5507664736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106101565760003560e01c806393626084116100c1578063d3c617ff1161007a578063d3c617ff146103c2578063d98493f614610464578063dea580b914610484578063e4c0aaf4146104a4578063ebb71194146104c4578063f6506db4146104e4578063f7434ea9146104ff57600080fd5b8063936260841461031c578063a60a4db51461033c578063bcb1a1661461035c578063be20309414610371578063c13517e114610391578063ce0aaf95146103a457600080fd5b806345c904411161011357806345c9044114610267578063492d85d4146102945780634d53c2a5146102b45780634f1ef286146102d457806352d1902d146102e757806367c51947146102fc57600080fd5b80630c340a241461015b5780631c3db16d146101985780631debaba6146101d55780631fc6b556146101f75780632e1db8901461021b57806336e41d3d14610251575b600080fd5b34801561016757600080fd5b5060025461017b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101a457600080fd5b506101b86101b336600461100f565b61051f565b60408051938452911515602084015215159082015260600161018f565b3480156101e157600080fd5b506101f56101f036600461103d565b610545565b005b34801561020357600080fd5b5061020d60045481565b60405190815260200161018f565b34801561022757600080fd5b5061020d61023636600461100f565b6000908152600860205260409020546001600160f81b031690565b34801561025d57600080fd5b5061020d60075481565b34801561027357600080fd5b5061020d610282366004611085565b60016020526000908152604090205481565b3480156102a057600080fd5b506101f56102af3660046110a7565b6105ad565b3480156102c057600080fd5b5060055461017b906001600160a01b031681565b6101f56102e23660046110da565b6105f9565b3480156102f357600080fd5b5061020d610821565b34801561030857600080fd5b506101f561031736600461119d565b61087f565b34801561032857600080fd5b5060065461017b906001600160a01b031681565b34801561034857600080fd5b506101f56103573660046111b9565b610902565b34801561036857600080fd5b5061020d600381565b34801561037d57600080fd5b506101f561038c366004611203565b610b1f565b61020d61039f366004611293565b610c35565b3480156103b057600080fd5b506005546001600160a01b031661017b565b3480156103ce57600080fd5b506104266103dd36600461100f565b60086020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161018f565b34801561047057600080fd5b5061020d61047f3660046112de565b610dd1565b34801561049057600080fd5b5060035461017b906001600160a01b031681565b3480156104b057600080fd5b506101f56104bf3660046110a7565b610deb565b3480156104d057600080fd5b506101f56104df36600461100f565b610e37565b3480156104f057600080fd5b5061020d61047f366004611334565b34801561050b57600080fd5b5061020d61051a36600461139a565b610f03565b600080600060405162461bcd60e51b815260040161053c906113db565b60405180910390fd5b6002546001600160a01b0316331461056f5760405162461bcd60e51b815260040161053c90611402565b610579814261145a565b6007555060038054600680546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146105d75760405162461bcd60e51b815260040161053c90611402565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b61060282610f79565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061068057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106746000805160206115c58339815191525490565b6001600160a01b031614155b1561069e5760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156106f8575060408051601f3d908101601f191682019092526106f591810190611473565b60015b61072057604051630c76093760e01b81526001600160a01b038316600482015260240161053c565b6000805160206115c5833981519152811461075157604051632a87526960e21b81526004810182905260240161053c565b6000805160206115c58339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a281511561081c576000836001600160a01b0316836040516107b8919061148c565b600060405180830381855af49150503d80600081146107f3576040519150601f19603f3d011682016040523d82523d6000602084013e6107f8565b606091505b505090508061081a576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461086c5760405163703e46dd60e11b815260040160405180910390fd5b506000805160206115c583398151915290565b6002546001600160a01b031633146108a95760405162461bcd60e51b815260040161053c90611402565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c596906108f69084815260200190565b60405180910390a25050565b60035484906001600160a01b031633148061093357506007544210801561093357506006546001600160a01b031633145b61098b5760405162461bcd60e51b8152602060048201526024808201527f416363657373206e6f7420616c6c6f7765643a20566561204f7574626f78206f60448201526337363c9760e11b606482015260840161053c565b6005546001600160a01b038281169116146109f65760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20486f6d65476174657761792060448201526437b7363c9760d91b606482015260840161053c565b6000848152600860205260408120805490916001600160f81b039091169003610a315760405162461bcd60e51b815260040161053c906114bb565b8054600160f81b900460ff1615610a7e5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b604482015260640161053c565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038681166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018790521690819063311a6c5690604401600060405180830381600087803b158015610afe57600080fd5b505af1158015610b12573d6000803e3d6000fd5b5050505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805460019190600160401b900460ff1680610b68575080546001600160401b03808416911610155b15610b855760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b178255600280546001600160a01b038981166001600160a01b03199283161790925560038054898416908316179055600487905560058054928716929091169190911790556001600055815460ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050505050565b6000610c418383610f03565b341015610c905760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e00604482015260640161053c565b600080549080610c9f836114eb565b909155509050466000610cb3600143611504565b40823385898989604051602001610cd09796959493929190611517565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b0380881685526000858401818152338787018181523460608a0190815260808a01858152878652600890985297909320975191511515600160f81b029190931617865551600186810180546001600160a01b039384166001600160a01b031991821617909155955160028801559351600390960180549690911695909416949094179092559092508491907f03e54fa10baada663d819e5d7e4533535bfb6d4407abe51045be84e6c8de020390610dac9043611504565b40898989604051610dc09493929190611570565b60405180910390a350509392505050565b600060405162461bcd60e51b815260040161053c906113db565b6002546001600160a01b03163314610e155760405162461bcd60e51b815260040161053c90611402565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120805490916001600160f81b039091169003610e725760405162461bcd60e51b815260040161053c906114bb565b8054600160f81b900460ff16610eba5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b604482015260640161053c565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f1935050505015801561081a573d6000803e3d6000fd5b6000806000610f4785858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610fa692505050565b6001600160601b0382166000908152600160205260409020549193509150610f709082906115ad565b95945050505050565b6002546001600160a01b03163314610fa35760405162461bcd60e51b815260040161053c90611402565b50565b600080604083511061100357602083015191506040830151905060016000836001600160601b03166001600160601b0316815260200190815260200160002054600003610ff257600091505b80600003610ffe575060035b915091565b50600090506003915091565b60006020828403121561102157600080fd5b5035919050565b6001600160a01b0381168114610fa357600080fd5b6000806040838503121561105057600080fd5b823561105b81611028565b946020939093013593505050565b80356001600160601b038116811461108057600080fd5b919050565b60006020828403121561109757600080fd5b6110a082611069565b9392505050565b6000602082840312156110b957600080fd5b81356110a081611028565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156110ed57600080fd5b82356110f881611028565b915060208301356001600160401b038082111561111457600080fd5b818501915085601f83011261112857600080fd5b81358181111561113a5761113a6110c4565b604051601f8201601f19908116603f01168101908382118183101715611162576111626110c4565b8160405282815288602084870101111561117b57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080604083850312156111b057600080fd5b61105b83611069565b600080600080608085870312156111cf57600080fd5b84356111da81611028565b9350602085013592506040850135915060608501356111f881611028565b939692955090935050565b6000806000806080858703121561121957600080fd5b843561122481611028565b9350602085013561123481611028565b92506040850135915060608501356111f881611028565b60008083601f84011261125d57600080fd5b5081356001600160401b0381111561127457600080fd5b60208301915083602082850101111561128c57600080fd5b9250929050565b6000806000604084860312156112a857600080fd5b8335925060208401356001600160401b038111156112c557600080fd5b6112d18682870161124b565b9497909650939450505050565b6000806000604084860312156112f357600080fd5b83356001600160401b0381111561130957600080fd5b6113158682870161124b565b909450925050602084013561132981611028565b809150509250925092565b60008060008060006080868803121561134c57600080fd5b8535945060208601356001600160401b0381111561136957600080fd5b6113758882890161124b565b909550935050604086013561138981611028565b949793965091946060013592915050565b600080602083850312156113ad57600080fd5b82356001600160401b038111156113c357600080fd5b6113cf8582860161124b565b90969095509350505050565b6020808252600d908201526c139bdd081cdd5c1c1bdc9d1959609a1b604082015260600190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561146d5761146d611444565b92915050565b60006020828403121561148557600080fd5b5051919050565b6000825160005b818110156114ad5760208186018101518583015201611493565b506000920191825250919050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b6000600182016114fd576114fd611444565b5060010190565b8181038181111561146d5761146d611444565b6c6372656174654469737075746560981b815287600d82015286602d8201526001600160601b03198660601b16604d820152846061820152836081820152818360a18301376000910160a1019081529695505050505050565b84815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b808202811582820484141761146d5761146d61144456fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212204651c10eb8dded7d25f1b67d58f568a9aabba6e281bf159ce4fbee5373c5507664736f6c63430008120033", + "devdoc": { + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "AcceptedFeeToken(address,bool)": { + "details": "To be emitted when an ERC20 token is added or removed as a method to pay fees.", + "params": { + "_accepted": "Whether the token is accepted or not.", + "_token": "The ERC20 token." + } + }, + "CrossChainDisputeOutgoing(bytes32,address,uint256,uint256,bytes)": { + "details": "To be emitted when a dispute is sent to the IHomeGateway.", + "params": { + "_choices": "The number of choices the arbitrator can choose from in this dispute.", + "_extraData": "Any extra data to attach.", + "_foreignArbitrable": "The address of the Arbitrable contract.", + "_foreignBlockHash": "foreignBlockHash", + "_foreignDisputeID": "The identifier of the dispute in the Arbitrable contract." + } + }, + "DisputeCreation(uint256,address)": { + "details": "To be emitted when a dispute is created.", + "params": { + "_arbitrable": "The contract which created the dispute.", + "_disputeID": "The identifier of the dispute in the Arbitrator contract." + } + }, + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "NewCurrencyRate(address,uint64,uint8)": { + "details": "To be emitted when the fee for a particular ERC20 token is updated.", + "params": { + "_feeToken": "The ERC20 token.", + "_rateDecimals": "The new decimals of the fee token rate.", + "_rateInEth": "The new rate of the fee token in ETH." + } + }, + "Ruling(address,uint256,uint256)": { + "details": "To be raised when a ruling is given.", + "params": { + "_arbitrable": "The arbitrable receiving the ruling.", + "_disputeID": "The identifier of the dispute in the Arbitrator contract.", + "_ruling": "The ruling which was given." + } + }, + "Upgraded(address)": { + "params": { + "newImplementation": "Address of the new implementation the proxy is now forwarding calls to." + } + } + }, + "kind": "dev", + "methods": { + "arbitrationCost(bytes)": { + "details": "Compute the cost of arbitration denominated in the native currency, typically ETH. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes)." + }, + "returns": { + "cost": "The arbitration cost in ETH." + } + }, + "arbitrationCost(bytes,address)": { + "details": "Compute the cost of arbitration denominated in `_feeToken`. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_feeToken": "The ERC20 token used to pay fees." + }, + "returns": { + "_0": "The arbitration cost in `_feeToken`." + } + }, + "changeCourtJurorFee(uint96,uint256)": { + "details": "Changes the `feeForJuror` property value of a specified court.", + "params": { + "_courtID": "The ID of the court on the v2 arbitrator. Not to be confused with the courtID on KlerosLiquid.", + "_feeForJuror": "The new value for the `feeForJuror` property value." + } + }, + "changeGovernor(address)": { + "details": "Changes the governor.", + "params": { + "_governor": "The address of the new governor." + } + }, + "changeHomeGateway(address)": { + "details": "Changes the home gateway.", + "params": { + "_homeGateway": "The address of the new home gateway." + } + }, + "changeVea(address,uint256)": { + "details": "Changes the outbox.", + "params": { + "_gracePeriod": "The duration to accept messages from the deprecated bridge (if at all).", + "_veaOutbox": "The address of the new outbox." + } + }, + "constructor": { + "details": "Constructor, initializing the implementation to reduce attack surface." + }, + "createDispute(uint256,bytes)": { + "details": "Create a dispute and pay for the fees in the native currency, typically ETH. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." + }, + "returns": { + "disputeID": "The identifier of the dispute created." + } + }, + "createDispute(uint256,bytes,address,uint256)": { + "details": "Create a dispute and pay for the fees in a supported ERC20 token. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).", + "_feeAmount": "Amount of the ERC20 token used to pay fees.", + "_feeToken": "The ERC20 token used to pay fees.", + "_numberOfChoices": "The number of choices the arbitrator can choose from in this dispute." + }, + "returns": { + "_0": "The identifier of the dispute created." + } + }, + "disputeHashToForeignID(bytes32)": { + "details": "Looks up the local foreign disputeID for a disputeHash", + "params": { + "_disputeHash": "dispute hash" + } + }, + "initialize(address,address,uint256,address)": { + "details": "Constructs the `PolicyRegistry` contract.", + "params": { + "_governor": "The governor's address." + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 `proxiableUUID` function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the if statement." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade mechanism including access control and UUPS-compliance.Reverts if the execution is not performed via delegatecall or the execution context is not of a proxy with an ERC1967-compliant implementation pointing to self.", + "params": { + "data": "Data used in a delegate call to `newImplementation` if non-empty. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.", + "newImplementation": "Address of the new implementation contract." + } + }, + "withdrawFees(bytes32)": { + "params": { + "_disputeHash": "The dispute hash for which to withdraw the fees." + } + } + }, + "stateVariables": { + "homeChainID": { + "return": "The chain ID where the corresponding home gateway is deployed.", + "returns": { + "_0": "The chain ID where the corresponding home gateway is deployed." + } + }, + "homeGateway": { + "return": "The address of the corresponding home gateway.", + "returns": { + "_0": "The address of the corresponding home gateway." + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ], + "InvalidImplementation(address)": [ + { + "notice": "The `implementation` is not UUPS-compliant" + } + ] + }, + "events": { + "Upgraded(address)": { + "notice": "Emitted when the `implementation` has been successfully upgraded." + } + }, + "kind": "user", + "methods": { + "relayRule(address,bytes32,uint256,address)": { + "notice": "Relay the rule call from the home gateway to the arbitrable." + }, + "withdrawFees(bytes32)": { + "notice": "Reimburses the dispute fees to the relayer who paid for these fees on the home chain." + } + }, + "notice": "Foreign Gateway Counterpart of `HomeGateway`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15912, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "localDisputeID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 15916, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "feeForJuror", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint96,t_uint256)" + }, + { + "astId": 15918, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "governor", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 15920, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "veaOutbox", + "offset": 0, + "slot": "3", + "type": "t_address" + }, + { + "astId": 15923, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "homeChainID", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 15926, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "homeGateway", + "offset": 0, + "slot": "5", + "type": "t_address" + }, + { + "astId": 15928, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "deprecatedVeaOutbox", + "offset": 0, + "slot": "6", + "type": "t_address" + }, + { + "astId": 15930, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "deprecatedVeaOutboxExpiration", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 15935, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "disputeHashtoDisputeData", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_bytes32,t_struct(DisputeData)15901_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(DisputeData)15901_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct ForeignGateway.DisputeData)", + "numberOfBytes": "32", + "value": "t_struct(DisputeData)15901_storage" + }, + "t_mapping(t_uint96,t_uint256)": { + "encoding": "mapping", + "key": "t_uint96", + "label": "mapping(uint96 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(DisputeData)15901_storage": { + "encoding": "inplace", + "label": "struct ForeignGateway.DisputeData", + "members": [ + { + "astId": 15892, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "id", + "offset": 0, + "slot": "0", + "type": "t_uint248" + }, + { + "astId": 15894, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "ruled", + "offset": 31, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 15896, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "arbitrable", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 15898, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "paid", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 15900, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "relayer", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "numberOfBytes": "128" + }, + "t_uint248": { + "encoding": "inplace", + "label": "uint248", + "numberOfBytes": "31" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Proxy.json b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Proxy.json new file mode 100644 index 000000000..5b032be43 --- /dev/null +++ b/contracts/deployments/chiadoDevnet/ForeignGatewayOnGnosis_Proxy.json @@ -0,0 +1,93 @@ +{ + "address": "0x078dAd05373d19d7fd6829735b765F12242a4300", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x078dAd05373d19d7fd6829735b765F12242a4300", + "transactionIndex": 1, + "gasUsed": "265335", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7ede631dec7eef5b52cd5719c77b2df2768ce5716f943b49d0484d77f81d9568", + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 6246439, + "transactionHash": "0x01874fb34459c6ed77c5cb60dfd0cfb40aebacc46073f1d06df7e1b47e790705", + "address": "0x078dAd05373d19d7fd6829735b765F12242a4300", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x7ede631dec7eef5b52cd5719c77b2df2768ce5716f943b49d0484d77f81d9568" + } + ], + "blockNumber": 6246439, + "cumulativeGasUsed": "291331", + "status": 1, + "byzantium": true + }, + "args": [ + "0xA4096fDA5291D5bbDD5Ed0D6CF2AF98229168Ace", + "0xbe203094000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3000000000000000000000000dfd7adeb43d46fa3f16fb3e27f7fe85c3f5bd89d0000000000000000000000000000000000000000000000000000000000066eed000000000000000000000000920856556ef06ff7d337af964d1954862f8da049" + ], + "numDeployments": 1, + "solcInputHash": "55cffe29f75540cd17d37d1c4bbabcf9", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Simon Malatrait \",\"details\":\"This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"stateVariables\":{\"IMPLEMENTATION_SLOT\":{\"details\":\"Storage slot with the address of the current implementation. This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\"}},\"title\":\"UUPS Proxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/UUPSProxy.sol\":\"UUPSProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n// Adapted from \\n\\n/**\\n * @authors: [@malatrax]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\npragma solidity 0.8.18;\\n\\n/**\\n * @title UUPS Proxy\\n * @author Simon Malatrait \\n * @dev This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.\\n * @dev This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.\\n * @dev We refer to the Proxiable contract (as per ERC-1822) with `implementation`.\\n */\\ncontract UUPSProxy {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n * NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n */\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _implementation, bytes memory _data) {\\n assembly {\\n sstore(IMPLEMENTATION_SLOT, _implementation)\\n }\\n\\n if (_data.length != 0) {\\n (bool success, ) = _implementation.delegatecall(_data);\\n require(success, \\\"Proxy Constructor failed\\\");\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * Internal Views * //\\n // ************************************* //\\n\\n function _getImplementation() internal view returns (address implementation) {\\n assembly {\\n implementation := sload(IMPLEMENTATION_SLOT)\\n }\\n }\\n\\n // ************************************* //\\n // * Fallback * //\\n // ************************************* //\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0x828711038a141a5cfcef6f24bb33af8cbf7f336c69fb969d7d0be0646667382b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516102fe3803806102fe83398101604081905261002f9161014d565b817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010c576000826001600160a01b031682604051610075919061021b565b600060405180830381855af49150503d80600081146100b0576040519150601f19603f3d011682016040523d82523d6000602084013e6100b5565b606091505b505090508061010a5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050610237565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561014457818101518382015260200161012c565b50506000910152565b6000806040838503121561016057600080fd5b82516001600160a01b038116811461017757600080fd5b60208401519092506001600160401b038082111561019457600080fd5b818501915085601f8301126101a857600080fd5b8151818111156101ba576101ba610113565b604051601f8201601f19908116603f011681019083821181831017156101e2576101e2610113565b816040528281528860208487010111156101fb57600080fd5b61020c836020830160208801610129565b80955050505050509250929050565b6000825161022d818460208701610129565b9190910192915050565b60b9806102456000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea2646970667358221220e77e937000f74af50aa176fcbe90b8f19064161349c6b089e5987215280177d364736f6c63430008120033", + "devdoc": { + "author": "Simon Malatrait ", + "details": "This contract implements a UUPS Proxy compliant with ERC-1967 & ERC-1822.This contract delegates all calls to another contract (UUPS Proxiable) through a fallback function and the use of the `delegatecall` EVM instruction.We refer to the Proxiable contract (as per ERC-1822) with `implementation`.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_implementation`. If `_data` is nonempty, it's used as data in a delegate call to `_implementation`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "stateVariables": { + "IMPLEMENTATION_SLOT": { + "details": "Storage slot with the address of the current implementation. This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is validated in the constructor. NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)" + } + }, + "title": "UUPS Proxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/package.json b/contracts/package.json index e8f53096d..20fe8877f 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -31,6 +31,7 @@ "bot:relayer-from-hardhat": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-fetch hardhat run ./scripts/disputeRelayerBotFromHardhat.ts", "bot:disputor": "NODE_NO_WARNINGS=1 yarn hardhat run ./scripts/disputeCreatorBot.ts", "etherscan-verify": "hardhat etherscan-verify", + "etherscan-verify-proxies": "scripts/verifyProxies.sh", "sourcify": "hardhat sourcify --write-failing-metadata", "size": "hardhat size-contracts --no-compile", "watch": "hardhat watch", diff --git a/contracts/scripts/verifyProxies.sh b/contracts/scripts/verifyProxies.sh new file mode 100755 index 000000000..8f37b057b --- /dev/null +++ b/contracts/scripts/verifyProxies.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Etherscan docs: https://docs.etherscan.io/api-endpoints/contracts#verifying-proxy-contract-using-curl + +function verify() { #deploymentDir #explorerApiUrl #apiKey + deploymentDir=$1 + explorerApiUrl=$2 + apiKey=$3 + echo "verifying proxies on $(basename $deploymentDir)" + for f in $(ls -1 $deploymentDir/*_Proxy.json 2>/dev/null); do + contractName=$(basename $f .json) + address=$(cat $f | jq -r .address) + echo -n "verifying $contractName as a proxy at $address... " + curl -s \ + -d "address=$address" \ + "$explorerApiUrl?module=contract&action=verifyproxycontract&apikey=$apiKey" + echo + done +} + +. $SCRIPT_DIR/../.env + +verify "$SCRIPT_DIR/../deployments/arbitrumGoerliDevnet" "https://api-testnet.arbiscan.io/api" $ARBISCAN_API_KEY +echo +verify "$SCRIPT_DIR/../deployments/arbitrumGoerli" "https://api-testnet.arbiscan.io/api" $ARBISCAN_API_KEY +echo +verify "$SCRIPT_DIR/../deployments/arbitrum" "https://api.arbiscan.io/api" $ARBISCAN_API_KEY