diff --git a/contracts/README.md b/contracts/README.md index 74c5bf715..e915e4ea6 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -79,6 +79,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments - [DAIFaucet](https://sepolia.arbiscan.io/address/0xB5b39A1bcD2D7097A8824B3cC18Ebd2dFb0D9B5E) - [DisputeKitClassic: proxy](https://sepolia.arbiscan.io/address/0x2246821E1313A93e2F8CdF7a3422d078f560b457), [implementation](https://sepolia.arbiscan.io/address/0x8Db69EE93365190FE9CA4d59Ae4Cdd4f3688f1Af) - [DisputeKitClassicUniversity: proxy](https://sepolia.arbiscan.io/address/0xd6E96b7c993763B5CDDa1139C7387B82A7c8B8B5), [implementation](https://sepolia.arbiscan.io/address/0x87e863b94d2CB79A8aB53bD87Dc4A10E11C0918B) +- [DisputeKitShutter: proxy](https://sepolia.arbiscan.io/address/0x09F3d00B995186D76Af9AA8627D06351d0d9f950), [implementation](https://sepolia.arbiscan.io/address/0xFbEeF40E23C6B39e5d1190A43d6712B2643fa0dD) - [DisputeResolver](https://sepolia.arbiscan.io/address/0x524C5541f440204E0B4577334c439277018F971f) - [DisputeResolverRuler](https://sepolia.arbiscan.io/address/0x199893232ECC74cC7898B24b5Ff58d613029f6B7) - [DisputeResolverUniversity](https://sepolia.arbiscan.io/address/0x2Aa1a94307E772BeE42E9EfbD137b1053F1fCfd4) diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index e61805f31..d581cdc54 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -96,6 +96,15 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.error("failed to change currency rates:", e); } + // Extra dispute kits + const disputeKitShutter = await deployUpgradable(deployments, "DisputeKitShutter", { + from: deployer, + args: [deployer, core.target], + log: true, + }); + await core.addNewDisputeKit(disputeKitShutter.address); + await core.enableDisputeKits(1, [2], true); // enable disputeKitShutter on the General Court + await deploy("KlerosCoreSnapshotProxy", { from: deployer, args: [deployer, core.target], diff --git a/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json new file mode 100644 index 000000000..9a24928d4 --- /dev/null +++ b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json @@ -0,0 +1,1145 @@ +{ + "address": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "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": [ + { + "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": "bytes32", + "name": "_commit", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_identity", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_encryptedVote", + "type": "bytes" + } + ], + "name": "CommitCastShutter", + "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": 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": "bytes32", + "name": "_commit", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_identity", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_encryptedVote", + "type": "bytes" + } + ], + "name": "castCommitShutter", + "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" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "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": "_choice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_salt", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_justification", + "type": "string" + } + ], + "name": "hashVote", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize4", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "isAppealFunded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "singleDrawPerJuror", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "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" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + } + ], + "transactionHash": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "receipt": { + "to": null, + "from": "0xf1C7c037891525E360C59f708739Ac09A7670c59", + "contractAddress": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "transactionIndex": 2, + "gasUsed": "240379", + "logsBloom": "0x00000000000000000000000400000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe962e1a9d690b93ef86a8757e1d9d97537e53577738fbe29092cb9dc27bd112b", + "transactionHash": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 148194178, + "transactionHash": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "address": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 4, + "blockHash": "0xe962e1a9d690b93ef86a8757e1d9d97537e53577738fbe29092cb9dc27bd112b" + } + ], + "blockNumber": 148194178, + "cumulativeGasUsed": "361637", + "status": 1, + "byzantium": true + }, + "args": [ + "0x56b95cD6fd660c6E631c65C0d0F62B33A093D9a4", + "0x485cc955000000000000000000000000f1c7c037891525e360c59f708739ac09a7670c590000000000000000000000004838e31e0ea315232c431598110fe677caf2d6e6" + ], + "numDeployments": 3, + "solcInputHash": "96b8e3f55478438b6784f67c1730309e", + "metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"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\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/KlerosProxies.sol\":\"DisputeKitShutterProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/KlerosProxies.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./UUPSProxy.sol\\\";\\n\\n/// Workaround to get meaningful names for the proxy contracts\\n/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers\\n\\ncontract DisputeKitClassicNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitGatedProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitShutterProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitSybilResistantProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeTemplateRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract EvidenceModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract ForeignGatewayOnEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract HomeGatewayToEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreRulerProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract PolicyRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract RandomizerRNGProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\",\"keccak256\":\"0x209228b56d42a8444ca70919e1ded5711fba434a746f26d426e230f57526fc6c\",\"license\":\"MIT\"},\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\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/// @dev Adapted from \\ncontract UUPSProxy {\\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 bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\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 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 /// @dev Delegates the current call to `implementation`.\\n /// NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\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 /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.\\n /// @dev Will run if no other function in the contract matches the call data.\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0xc3e0b18f846a62cc6c274680fc10014d1267885f8eefc6767292d3e174a081c0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161030238038061030283398101604081905261002f91610151565b8181817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010e576000826001600160a01b031682604051610077919061021f565b600060405180830381855af49150503d80600081146100b2576040519150601f19603f3d011682016040523d82523d6000602084013e6100b7565b606091505b505090508061010c5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050505061023b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610148578181015183820152602001610130565b50506000910152565b6000806040838503121561016457600080fd5b82516001600160a01b038116811461017b57600080fd5b60208401519092506001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b8151818111156101be576101be610117565b604051601f8201601f19908116603f011681019083821181831017156101e6576101e6610117565b816040528281528860208487010111156101ff57600080fd5b61021083602083016020880161012d565b80955050505050509250929050565b6000825161023181846020870161012d565b9190910192915050565b60b9806102496000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122027e73125daa8b508f0a75ecdac4efb44a8712d5d43b9293019c738684adf472464736f6c63430008180033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122027e73125daa8b508f0a75ecdac4efb44a8712d5d43b9293019c738684adf472464736f6c63430008180033", + "execute": { + "methodName": "initialize4", + "args": [] + }, + "implementation": "0xFbEeF40E23C6B39e5d1190A43d6712B2643fa0dD", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Implementation.json b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Implementation.json new file mode 100644 index 000000000..2fa91c062 --- /dev/null +++ b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Implementation.json @@ -0,0 +1,1745 @@ +{ + "address": "0xFbEeF40E23C6B39e5d1190A43d6712B2643fa0dD", + "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": "bytes32", + "name": "_commit", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_identity", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_encryptedVote", + "type": "bytes" + } + ], + "name": "CommitCastShutter", + "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": 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": "bytes32", + "name": "_commit", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_identity", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_encryptedVote", + "type": "bytes" + } + ], + "name": "castCommitShutter", + "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" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "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": "_choice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_salt", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_justification", + "type": "string" + } + ], + "name": "hashVote", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize4", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + } + ], + "name": "isAppealFunded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "singleDrawPerJuror", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "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": "0x4652912ebec3fcf633568c2731bcd2ea3f6c38efc4b55757f2c55fcd9a6af4ae", + "receipt": { + "to": null, + "from": "0xf1C7c037891525E360C59f708739Ac09A7670c59", + "contractAddress": "0xFbEeF40E23C6B39e5d1190A43d6712B2643fa0dD", + "transactionIndex": 1, + "gasUsed": "3906991", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000002000000000000000000000000000000000000000000000", + "blockHash": "0x2c78cd9dcbec549968acacf96d2f6908bf4a606399d6de881daa449defb67bc4", + "transactionHash": "0x4652912ebec3fcf633568c2731bcd2ea3f6c38efc4b55757f2c55fcd9a6af4ae", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 148226049, + "transactionHash": "0x4652912ebec3fcf633568c2731bcd2ea3f6c38efc4b55757f2c55fcd9a6af4ae", + "address": "0xFbEeF40E23C6B39e5d1190A43d6712B2643fa0dD", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff", + "logIndex": 0, + "blockHash": "0x2c78cd9dcbec549968acacf96d2f6908bf4a606399d6de881daa449defb67bc4" + } + ], + "blockNumber": 148226049, + "cumulativeGasUsed": "3906991", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 3, + "solcInputHash": "525260efd109be98dd6a976c1b7235d3", + "metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"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\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_identity\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_encryptedVote\",\"type\":\"bytes\"}],\"name\":\"CommitCastShutter\",\"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\":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\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_identity\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_encryptedVote\",\"type\":\"bytes\"}],\"name\":\"castCommitShutter\",\"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\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"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\":\"_choice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salt\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"hashVote\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize4\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"isAppealFunded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"singleDrawPerJuror\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"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.\"}],\"InvalidImplementation(address)\":[{\"details\":\"The `implementation` is not UUPS-compliant\"}],\"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.\"}},\"CommitCastShutter(bytes32,bytes32,bytes)\":{\"details\":\"Emitted when a vote is cast.\",\"params\":{\"_commit\":\"The commitment hash.\",\"_encryptedVote\":\"The Shutter encrypted vote.\",\"_identity\":\"The Shutter identity used for encryption.\"}},\"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.\"}},\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the `implementation` has been successfully upgraded.\",\"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. Note that this function is to be called directly by the core contract and is not for off-chain usage.\",\"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 commitment hash.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"castCommitShutter(uint256,uint256[],bytes32,bytes32,bytes)\":{\"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 commitment hash including the justification.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_encryptedVote\":\"The Shutter encrypted vote.\",\"_identity\":\"The Shutter identity used for encryption.\",\"_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\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"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,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.\"}},\"hashVote(uint256,uint256,string)\":{\"details\":\"Computes the hash of a vote using ABI encoding\",\"params\":{\"_choice\":\"The choice being voted for\",\"_justification\":\"The justification for the vote\",\"_salt\":\"A random salt for commitment\"},\"returns\":{\"_0\":\"bytes32 The hash of the encoded vote parameters\"}},\"initialize(address,address)\":{\"details\":\"Initializer.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\"}},\"isAppealFunded(uint256)\":{\"details\":\"Returns true if the appeal funding is finished prematurely (e.g. when losing side didn't fund). Note that this function is to be called directly by the core contract and is not for off-chain usage.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"_0\":\"Whether the appeal funding is finished.\"}},\"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.\"},\"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. Note that withdrawals are not possible if the core contract is paused.\",\"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.\"}}},\"stateVariables\":{\"version\":{\"details\":\"Returns the version of the implementation.\",\"return\":\"Version string.\",\"returns\":{\"_0\":\"Version string.\"}}},\"title\":\"DisputeKitShutter 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. Added functionality: an Shutter-specific event emitted when a vote is cast.\",\"version\":1},\"userdoc\":{\"errors\":{\"FailedDelegateCall()\":[{\"notice\":\"Failed Delegated call\"}]},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/dispute-kits/DisputeKitShutter.sol\":\"DisputeKitShutter\"},\"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 v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport {KlerosCoreBase, IDisputeKit, ISortitionModule, IERC20} from \\\"./KlerosCoreBase.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 KlerosCoreBase {\\n string public constant override version = \\\"0.8.0\\\";\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /// @dev Initializer (constructor equivalent for upgradable contracts).\\n /// @param _governor The governor's address.\\n /// @param _guardian The guardian'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 address _guardian,\\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 reinitializer(1) {\\n __KlerosCoreBase_initialize(\\n _governor,\\n _guardian,\\n _pinakion,\\n _jurorProsecutionModule,\\n _disputeKit,\\n _hiddenVotes,\\n _courtParameters,\\n _timesPerPeriod,\\n _sortitionExtraData,\\n _sortitionModuleAddress\\n );\\n }\\n\\n function initialize3() external reinitializer(3) {\\n // NOP\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n /// Only the governor can perform upgrades (`onlyByGovernor`)\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n}\\n\",\"keccak256\":\"0x697705afc3f93aafded177968d141bfe919b74820f878b97a9d7b590577bf1b0\",\"license\":\"MIT\"},\"src/arbitration/KlerosCoreBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport {IArbitrableV2, IArbitratorV2} from \\\"./interfaces/IArbitratorV2.sol\\\";\\nimport {IDisputeKit} from \\\"./interfaces/IDisputeKit.sol\\\";\\nimport {ISortitionModule} from \\\"./interfaces/ISortitionModule.sol\\\";\\nimport {Initializable} from \\\"../proxy/Initializable.sol\\\";\\nimport {UUPSProxiable} from \\\"../proxy/UUPSProxiable.sol\\\";\\nimport {SafeERC20, IERC20} from \\\"../libraries/SafeERC20.sol\\\";\\nimport \\\"../libraries/Constants.sol\\\";\\n\\n/// @title KlerosCoreBase\\n/// Core arbitrator contract for Kleros v2.\\n/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.\\nabstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable {\\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 disputeKitId => bool) supportedDisputeKits; // True if DK with this ID is supported by the court. Note that each court must support classic dispute kit.\\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 // 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 feePerJurorInRound; // The fee per juror in the round.\\n uint256 pnkAtStakePerJurorInRound; // The amount of PNKs at stake for each juror 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\\n address public governor; // The governor of the contract.\\n address public guardian; // The guardian able to pause asset withdrawals.\\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 IDisputeKit[] public disputeKits; // Array of dispute kits.\\n Dispute[] public disputes; // The disputes.\\n mapping(IERC20 => CurrencyRate) public currencyRates; // The price of each token in ETH.\\n bool public paused; // Whether asset withdrawals are paused.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\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 uint96 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(uint256 indexed _disputeKitID, IDisputeKit indexed _disputeKitAddress);\\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 event Paused();\\n event Unpaused();\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n if (governor != msg.sender) revert GovernorOnly();\\n _;\\n }\\n\\n modifier onlyByGuardianOrGovernor() {\\n if (guardian != msg.sender && governor != msg.sender) revert GuardianOrGovernorOnly();\\n _;\\n }\\n\\n modifier whenPaused() {\\n if (!paused) revert WhenPausedOnly();\\n _;\\n }\\n\\n modifier whenNotPaused() {\\n if (paused) revert WhenNotPausedOnly();\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n function __KlerosCoreBase_initialize(\\n address _governor,\\n address _guardian,\\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 ) internal onlyInitializing {\\n governor = _governor;\\n guardian = _guardian;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n sortitionModule = _sortitionModuleAddress;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a dispute kit is not supported.\\n disputeKits.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKits.push(_disputeKit);\\n\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit);\\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 uint256[] memory supportedDisputeKits = new uint256[](1);\\n supportedDisputeKits[0] = DISPUTE_KIT_CLASSIC;\\n emit CourtCreated(\\n GENERAL_COURT,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n supportedDisputeKits\\n );\\n _enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Pause staking and reward execution. Can only be done by guardian or governor.\\n function pause() external onlyByGuardianOrGovernor whenNotPaused {\\n paused = true;\\n emit Paused();\\n }\\n\\n /// @dev Unpause staking and reward execution. Can only be done by governor.\\n function unpause() external onlyByGovernor whenPaused {\\n paused = false;\\n emit Unpaused();\\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 `guardian` storage variable.\\n /// @param _guardian The new value for the `guardian` storage variable.\\n function changeGuardian(address _guardian) external onlyByGovernor {\\n guardian = _guardian;\\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 function addNewDisputeKit(IDisputeKit _disputeKitAddress) external onlyByGovernor {\\n uint256 disputeKitID = disputeKits.length;\\n disputeKits.push(_disputeKitAddress);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress);\\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] >= disputeKits.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(uint96(courtID), _supportedDisputeKits[i], true);\\n }\\n // Check that Classic DK support was added.\\n if (!court.supportedDisputeKits[DISPUTE_KIT_CLASSIC]) revert MustSupportDisputeKitClassic();\\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 uint96(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 != 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] >= disputeKits.length) {\\n revert WrongDisputeKitIndex();\\n }\\n _enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n // Classic dispute kit must be supported by all courts.\\n if (_disputeKitIDs[i] == DISPUTE_KIT_CLASSIC) {\\n revert CannotDisableClassicDK();\\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 /// Note that the existing delayed stake will be nullified as non-relevant.\\n function setStake(uint96 _courtID, uint256 _newStake) external virtual whenNotPaused {\\n _setStake(msg.sender, _courtID, _newStake, false, OnError.Revert);\\n }\\n\\n /// @dev Sets the stake of a specified account in a court, typically to apply a delayed stake or unstake inactive jurors.\\n /// @param _account The account whose stake is being set.\\n /// @param _courtID The ID of the court.\\n /// @param _newStake The new stake.\\n /// @param _alreadyTransferred Whether the PNKs have already been transferred to the contract.\\n function setStakeBySortitionModule(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake,\\n bool _alreadyTransferred\\n ) external {\\n if (msg.sender != address(sortitionModule)) revert SortitionModuleOnly();\\n _setStake(_account, _courtID, _newStake, _alreadyTransferred, OnError.Return);\\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 virtual 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 = disputeKits[disputeKitID];\\n Court storage court = courts[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 !disputeKits[round.disputeKitID].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 !disputeKits[round.disputeKitID].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 (\\n block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&\\n !disputeKits[round.disputeKitID].isAppealFunded(_disputeID)\\n ) {\\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 = disputeKits[round.disputeKitID];\\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 sortitionModule.lockStake(drawnAddress, 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(disputeKits[round.disputeKitID])) 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 if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n // Switch to classic dispute kit if parent court doesn't support the current one.\\n newDisputeKitID = DISPUTE_KIT_CLASSIC;\\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 disputeKits[extraRound.disputeKitID].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 /// Note: Reward distributions are forbidden during pause.\\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 whenNotPaused {\\n Round storage round;\\n {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.period != Period.execution) revert NotExecutionPeriod();\\n\\n round = dispute.rounds[_round];\\n } // stack too deep workaround\\n\\n uint256 start = round.repartitions;\\n uint256 end = round.repartitions + _iterations;\\n\\n uint256 pnkPenaltiesInRound = round.pnkPenalties; // Keep in memory to save gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 feePerJurorInRound = round.totalFeesForJurors / numberOfVotesInRound;\\n uint256 pnkAtStakePerJurorInRound = round.pnkAtStakePerJuror;\\n uint256 coherentCount;\\n {\\n IDisputeKit disputeKit = disputeKits[round.disputeKitID];\\n coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n } // stack too deep workaround\\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 pnkPenaltiesInRound = _executePenalties(\\n ExecuteParams({\\n disputeID: _disputeID,\\n round: _round,\\n coherentCount: coherentCount,\\n numberOfVotesInRound: numberOfVotesInRound,\\n feePerJurorInRound: feePerJurorInRound,\\n pnkAtStakePerJurorInRound: pnkAtStakePerJurorInRound,\\n pnkPenaltiesInRound: pnkPenaltiesInRound,\\n repartition: i\\n })\\n );\\n } else {\\n _executeRewards(\\n ExecuteParams({\\n disputeID: _disputeID,\\n round: _round,\\n coherentCount: coherentCount,\\n numberOfVotesInRound: numberOfVotesInRound,\\n feePerJurorInRound: feePerJurorInRound,\\n pnkAtStakePerJurorInRound: pnkAtStakePerJurorInRound,\\n pnkPenaltiesInRound: pnkPenaltiesInRound,\\n repartition: i\\n })\\n );\\n }\\n }\\n if (round.pnkPenalties != pnkPenaltiesInRound) {\\n round.pnkPenalties = pnkPenaltiesInRound; // 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 = disputeKits[round.disputeKitID];\\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 _params.feePerJurorInRound,\\n _params.pnkAtStakePerJurorInRound\\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 sortitionModule.unlockStake(account, penalty);\\n\\n // Apply the penalty to the staked PNKs.\\n sortitionModule.penalizeStake(account, penalty);\\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 = disputeKits[round.disputeKitID];\\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 _params.feePerJurorInRound,\\n _params.pnkAtStakePerJurorInRound\\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 sortitionModule.unlockStake(account, pnkLocked);\\n\\n // Give back the locked PNKs in case the juror fully unstaked earlier.\\n if (!sortitionModule.isJurorStaked(account)) {\\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 = disputeKits[round.disputeKitID];\\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 isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\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 getDisputeKitsLength() external view returns (uint256) {\\n return disputeKits.length;\\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. Note that classic dispute kit should always be enabled.\\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 If called only once then set _onError to Revert, otherwise set it to Return\\n /// @param _account The account to set the stake for.\\n /// @param _courtID The ID of the court to set the stake for.\\n /// @param _newStake The new stake.\\n /// @param _alreadyTransferred Whether the PNKs were already transferred to/from the staking contract.\\n /// @param _onError Whether to revert or return false on error.\\n /// @return Whether the stake was successfully set or not.\\n function _setStake(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake,\\n bool _alreadyTransferred,\\n OnError _onError\\n ) internal returns (bool) {\\n if (_courtID == FORKING_COURT || _courtID >= courts.length) {\\n _stakingFailed(_onError, StakingResult.CannotStakeInThisCourt); // Staking directly into the forking court is not allowed.\\n return false;\\n }\\n if (_newStake != 0 && _newStake < courts[_courtID].minStake) {\\n _stakingFailed(_onError, StakingResult.CannotStakeLessThanMinStake); // Staking less than the minimum stake is not allowed.\\n return false;\\n }\\n (uint256 pnkDeposit, uint256 pnkWithdrawal, StakingResult stakingResult) = sortitionModule.setStake(\\n _account,\\n _courtID,\\n _newStake,\\n _alreadyTransferred\\n );\\n if (stakingResult != StakingResult.Successful) {\\n _stakingFailed(_onError, stakingResult);\\n return false;\\n }\\n if (pnkDeposit > 0) {\\n if (!pinakion.safeTransferFrom(_account, address(this), pnkDeposit)) {\\n _stakingFailed(_onError, StakingResult.StakingTransferFailed);\\n return false;\\n }\\n }\\n if (pnkWithdrawal > 0) {\\n if (!pinakion.safeTransfer(_account, pnkWithdrawal)) {\\n _stakingFailed(_onError, StakingResult.UnstakingTransferFailed);\\n return false;\\n }\\n }\\n return true;\\n }\\n\\n /// @dev It may revert depending on the _onError parameter.\\n function _stakingFailed(OnError _onError, StakingResult _result) internal pure virtual {\\n if (_onError == OnError.Return) return;\\n if (_result == StakingResult.StakingTransferFailed) revert StakingTransferFailed();\\n if (_result == StakingResult.UnstakingTransferFailed) revert UnstakingTransferFailed();\\n if (_result == StakingResult.CannotStakeInMoreCourts) revert StakingInTooManyCourts();\\n if (_result == StakingResult.CannotStakeInThisCourt) revert StakingNotPossibleInThisCourt();\\n if (_result == StakingResult.CannotStakeLessThanMinStake) revert StakingLessThanCourtMinStake();\\n if (_result == StakingResult.CannotStakeZeroWhenNoStake) revert StakingZeroWhenNoStake();\\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 >= disputeKits.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 GuardianOrGovernorOnly();\\n error DisputeKitOnly();\\n error SortitionModuleOnly();\\n error UnsuccessfulCall();\\n error InvalidDisputKitParent();\\n error MinStakeLowerThanParentCourt();\\n error UnsupportedDisputeKit();\\n error InvalidForkingCourtAsParent();\\n error WrongDisputeKitIndex();\\n error CannotDisableClassicDK();\\n error StakingInTooManyCourts();\\n error StakingNotPossibleInThisCourt();\\n error StakingLessThanCourtMinStake();\\n error StakingTransferFailed();\\n error UnstakingTransferFailed();\\n error ArbitrationFeesNotEnough();\\n error DisputeKitNotSupportedByCourt();\\n error MustSupportDisputeKitClassic();\\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 NotExecutionPeriod();\\n error RulingAlreadyExecuted();\\n error DisputePeriodIsFinal();\\n error TransferFailed();\\n error WhenNotPausedOnly();\\n error WhenPausedOnly();\\n error StakingZeroWhenNoStake();\\n}\\n\",\"keccak256\":\"0xf61bd3332825d5b69e71b57d7c0b3acb5f4c3e64a1755004008ece59db228f56\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitClassicBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport {KlerosCore, KlerosCoreBase, IDisputeKit, ISortitionModule} from \\\"../KlerosCore.sol\\\";\\nimport {Initializable} from \\\"../../proxy/Initializable.sol\\\";\\nimport {UUPSProxiable} from \\\"../../proxy/UUPSProxiable.sol\\\";\\n\\n/// @title DisputeKitClassicBase\\n/// Abstract Dispute kit classic 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.\\nabstract contract DisputeKitClassicBase is IDisputeKit, 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 choiceId => uint256) paidFees; // Tracks the fees paid for each choice in this round.\\n mapping(uint256 choiceId => bool) hasPaid; // True if this choice was fully funded, false otherwise.\\n mapping(address account => mapping(uint256 choiceId => 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 mapping(address drawnAddress => bool) alreadyDrawn; // Set to 'true' if the address has already been drawn, so it can't be drawn more than once.\\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 bool public singleDrawPerJuror; // Whether each juror can only draw once per dispute, false by default.\\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 Initializer.\\n /// @param _governor The governor's address.\\n /// @param _core The KlerosCore arbitrator.\\n function __DisputeKitClassicBase_initialize(address _governor, KlerosCore _core) internal onlyInitializing {\\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 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 drawnAddress = sortitionModule.draw(key, _coreDisputeID, _nonce);\\n\\n if (_postDrawCheck(round, _coreDisputeID, drawnAddress)) {\\n round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false}));\\n round.alreadyDrawn[drawnAddress] = true;\\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 commitment hash.\\n function castCommit(uint256 _coreDisputeID, uint256[] calldata _voteIDs, bytes32 _commit) external {\\n _castCommit(_coreDisputeID, _voteIDs, _commit);\\n }\\n\\n function _castCommit(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit\\n ) internal notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCoreBase.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 {\\n _castVote(_coreDisputeID, _voteIDs, _choice, _salt, _justification);\\n }\\n\\n function _castVote(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) internal notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCoreBase.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 bytes32 voteHash = hashVote(_choice, _salt, _justification);\\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 || round.votes[_voteIDs[i]].commit == voteHash,\\n \\\"The vote hash must match the commitment 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 /// Note that withdrawals are not possible if the core contract is paused.\\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 require(!core.paused(), \\\"Core is paused\\\");\\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 // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Computes the hash of a vote using ABI encoding\\n * @dev The unused parameters may be used by overriding contracts.\\n * @param _choice The choice being voted for\\n * @param _justification The justification for the vote\\n * @param _salt A random salt for commitment\\n * @return bytes32 The hash of the encoded vote parameters\\n */\\n function hashVote(\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) public pure virtual returns (bytes32) {\\n return keccak256(abi.encodePacked(_choice, _salt));\\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 == KlerosCoreBase.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 uint256 /* _feePerJuror */,\\n uint256 /* _pnkAtStakePerJuror */\\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 /// Note that this function is to be called directly by the core contract and is not for off-chain usage.\\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\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , , ) = core.courts(courtID);\\n uint256 expectedTotalVoted = hiddenVotes ? round.totalCommitted : round.votes.length;\\n\\n return round.totalVoted == expectedTotalVoted;\\n }\\n\\n /// @dev Returns true if the appeal funding is finished prematurely (e.g. when losing side didn't fund).\\n /// Note that this function is to be called directly by the core contract and is not for off-chain usage.\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether the appeal funding is finished.\\n function isAppealFunded(uint256 _coreDisputeID) external view override returns (bool) {\\n (uint256 appealPeriodStart, uint256 appealPeriodEnd) = core.appealPeriod(_coreDisputeID);\\n\\n uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);\\n // Uses block.timestamp from the current tx when called by the core contract.\\n return (fundedChoices.length == 0 &&\\n block.timestamp - appealPeriodStart >=\\n ((appealPeriodEnd - appealPeriodStart) * LOSER_APPEAL_PERIOD_MULTIPLIER) / ONE_BASIS_POINT);\\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 /// Note that we don't check the minStake requirement here because of the implicit staking in parent courts.\\n /// minStake is checked directly during staking process however it's possible for the juror to get drawn\\n /// while having < minStake if it is later increased by governance.\\n /// This issue is expected and harmless since we check for insolvency anyway.\\n /// @param _round The round in which the juror is being drawn.\\n /// @param _coreDisputeID ID of the dispute in the core contract.\\n /// @param _juror Chosen address.\\n /// @return result Whether the address passes the check or not.\\n function _postDrawCheck(\\n Round storage _round,\\n uint256 _coreDisputeID,\\n address _juror\\n ) internal view virtual returns (bool result) {\\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.sortitionModule().getJurorBalance(_juror, courtID);\\n result = totalStaked >= totalLocked + lockedAmountPerJuror;\\n\\n if (singleDrawPerJuror) {\\n result = result && !_round.alreadyDrawn[_juror];\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf11760d6d9407a37f0d0fc7adc7ec1a5056c167bffc1c1c785247909fcf64cc4\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitShutter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport {DisputeKitClassicBase, KlerosCore} from \\\"./DisputeKitClassicBase.sol\\\";\\n\\n/// @title DisputeKitShutter\\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.\\n/// Added functionality: an Shutter-specific event emitted when a vote is cast.\\ncontract DisputeKitShutter is DisputeKitClassicBase {\\n string public constant override version = \\\"0.9.2\\\";\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /// @dev Emitted when a vote is cast.\\n /// @param _commit The commitment hash.\\n /// @param _identity The Shutter identity used for encryption.\\n /// @param _encryptedVote The Shutter encrypted vote.\\n event CommitCastShutter(bytes32 indexed _commit, bytes32 _identity, bytes _encryptedVote);\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\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 __DisputeKitClassicBase_initialize(_governor, _core);\\n }\\n\\n function initialize4() external reinitializer(4) {\\n // NOP\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /// @dev Access Control to perform implementation upgrades (UUPS Proxiable)\\n /// Only the governor can perform upgrades (`onlyByGovernor`)\\n function _authorizeUpgrade(address) internal view override onlyByGovernor {\\n // NOP\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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 commitment hash including the justification.\\n /// @param _identity The Shutter identity used for encryption.\\n /// @param _encryptedVote The Shutter encrypted vote.\\n function castCommitShutter(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit,\\n bytes32 _identity,\\n bytes calldata _encryptedVote\\n ) external notJumped(_coreDisputeID) {\\n _castCommit(_coreDisputeID, _voteIDs, _commit);\\n emit CommitCastShutter(_commit, _identity, _encryptedVote);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Computes the hash of a vote using ABI encoding\\n * @param _choice The choice being voted for\\n * @param _justification The justification for the vote\\n * @param _salt A random salt for commitment\\n * @return bytes32 The hash of the encoded vote parameters\\n */\\n function hashVote(\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) public pure override returns (bytes32) {\\n bytes32 justificationHash = keccak256(bytes(_justification));\\n return keccak256(abi.encode(_choice, _salt, justificationHash));\\n }\\n}\\n\",\"keccak256\":\"0x68706bd6beb162156f5a73c7c9ca4f79bc211169e082b9fbf5747ea67859e5c7\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitrableV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./IArbitratorV2.sol\\\";\\n\\n/// @title IArbitrableV2\\n/// @notice Arbitrable interface.\\n/// @dev 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 _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 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 _arbitratorDisputeID,\\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\":\"0xe841a4fe8ec109ce17dde4457bf1583c8b499109b05887c53a49a3207fc6e80b\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IArbitratorV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\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\":\"0xa4dc6b958197adead238de4246cd04e7389c3dc1b9f968acd10985f8fc5b74cf\",\"license\":\"MIT\"},\"src/arbitration/interfaces/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\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 /// @param _nbVotes Maximal number of votes this dispute can get. DEPRECATED as we don't need to pass it now. KC handles the count.\\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 /// @param _feePerJuror The fee per juror.\\n /// @param _pnkAtStakePerJuror The PNK at stake per juror.\\n /// @return The degree of coherence in basis points.\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID,\\n uint256 _feePerJuror,\\n uint256 _pnkAtStakePerJuror\\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 appeal funding is finished prematurely (e.g. when losing side didn't fund).\\n /// @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n /// @return Whether the appeal funding is finished.\\n function isAppealFunded(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\":\"0xa505a76fe06515f6fd2feb1e8a8e7e6d1522038c8ed02438409bc06a29d520ce\",\"license\":\"MIT\"},\"src/arbitration/interfaces/ISortitionModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.24;\\n\\nimport \\\"../../libraries/Constants.sol\\\";\\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 event NewPhase(Phase _phase);\\n\\n function createTree(bytes32 _key, bytes memory _extraData) external;\\n\\n function setStake(\\n address _account,\\n uint96 _courtID,\\n uint256 _newStake,\\n bool _alreadyTransferred\\n ) external returns (uint256 pnkDeposit, uint256 pnkWithdrawal, StakingResult stakingResult);\\n\\n function setJurorInactive(address _account) external;\\n\\n function lockStake(address _account, uint256 _relativeAmount) external;\\n\\n function unlockStake(address _account, uint256 _relativeAmount) external;\\n\\n function penalizeStake(address _account, uint256 _relativeAmount) 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 getJurorBalance(\\n address _juror,\\n uint96 _courtID\\n ) external view returns (uint256 totalStaked, uint256 totalLocked, uint256 stakedInCourt, uint256 nbCourts);\\n\\n function getJurorCourtIDs(address _juror) external view returns (uint96[] memory);\\n\\n function isJurorStaked(address _juror) external view returns (bool);\\n\\n function createDisputeHook(uint256 _disputeID, uint256 _roundID) external;\\n\\n function postDrawHook(uint256 _disputeID, uint256 _roundID) external;\\n}\\n\",\"keccak256\":\"0x18a4ff126bb51e7b5b0e3fbff7cf0dbbcfff7195ad79307e69cdbc9226e63502\",\"license\":\"MIT\"},\"src/libraries/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n// Courts\\nuint96 constant FORKING_COURT = 0; // Index of the forking court.\\nuint96 constant GENERAL_COURT = 1; // Index of the default (general) court.\\n\\n// Dispute Kits\\nuint256 constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. DEPRECATED, as its main purpose was to accommodate forest structure which is not used now.\\nuint256 constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n\\n// Sortition Module\\nuint256 constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\nuint256 constant DEFAULT_K = 6; // Default number of children per node.\\n\\n// Defaults\\nuint256 constant DEFAULT_NB_OF_JURORS = 3; // The default number of jurors in a dispute.\\nIERC20 constant NATIVE_CURRENCY = IERC20(address(0)); // The native currency, such as ETH on Arbitrum, Optimism and Ethereum L1.\\n\\nenum OnError {\\n Revert,\\n Return\\n}\\n\\nenum StakingResult {\\n Successful,\\n StakingTransferFailed,\\n UnstakingTransferFailed,\\n CannotStakeInMoreCourts,\\n CannotStakeInThisCourt,\\n CannotStakeLessThanMinStake,\\n CannotStakeMoreThanMaxStakePerJuror,\\n CannotStakeMoreThanMaxTotalStaked,\\n CannotStakeZeroWhenNoStake\\n}\\n\",\"keccak256\":\"0x5bbda7c304b3681b90feae33be694d04dc129edd60e1d07cb593b895fdc9cd4e\",\"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.24;\\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\":\"0x3e39adb9cdd9f86b0defc8f6e1223533d86f82c804e186193f729c32c10161b1\",\"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.24;\\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 * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\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\":\"0x560ea64115636ecd6b3596248817125551c038ce1648019fde3cbe02d9759a30\",\"license\":\"MIT\"},\"src/proxy/UUPSProxiable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\n/// @title UUPS Proxiable\\n/// @author Simon Malatrait \\n/// @dev This contract implements an upgradeability mechanism designed for UUPS proxies.\\n/// @dev Adapted from \\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.\\nabstract contract UUPSProxiable {\\n // ************************************* //\\n // * Event * //\\n // ************************************* //\\n\\n /// @dev Emitted when the `implementation` has been successfully upgraded.\\n /// @param newImplementation Address of the new implementation the proxy is now forwarding calls to.\\n event Upgraded(address indexed newImplementation);\\n\\n // ************************************* //\\n // * Error * //\\n // ************************************* //\\n\\n /// @dev The call is from an unauthorized context.\\n error UUPSUnauthorizedCallContext();\\n\\n /// @dev The storage `slot` is unsupported as a UUID.\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /// @dev 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 /// @dev Storage slot with the address of the current implementation.\\n /// @dev This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n /// @dev validated in the constructor.\\n /// @dev NOTE: bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /// @dev Storage variable of the proxiable contract address.\\n /// @dev It is used to check whether or not the current call is from the proxy.\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n address private immutable __self = address(this);\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /// @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract.\\n /// @dev Called by {upgradeToAndCall}.\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n // ************************************* //\\n // * State Modifiers * //\\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 /// @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 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 /// @custom:oz-upgrades-unsafe-allow delegatecall\\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 /// @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 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 /// @dev Returns the version of the implementation.\\n /// @return Version string.\\n function version() external view virtual returns (string memory);\\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\":\"0xa8bb02ed2b2fc165296226762299c2ee3328f2a0c6e90c6fe7029fa5b01d0b60\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000d9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e805468010000000000000000900460ff1615620000765760405162dc149f60e41b815260040160405180910390fd5b80546001600160401b0390811614620000d65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516144cb62000103600039600081816118150152818161183e0152611a3601526144cb6000f3fe6080604052600436106101c45760003560e01c8063675926f6116100f8578063b6ede54011610090578063b6ede540146105c4578063ba66fde7146105e4578063be46760414610604578063caeb50ed1461061a578063d2b8035a1461062f578063da3beb8c1461064f578063e349ad301461050c578063e4c0aaf41461066f578063f2f4eb261461068f57600080fd5b8063675926f61461045f57806369f3f0411461047f5780636d4cd8ea146104cc578063751accd0146104ec578063796490f91461050c5780637c04034e146105225780638e42646014610542578063a7cc08fe14610562578063b34bfaa8146105ae57600080fd5b8063362c34791161016b578063362c34791461032a578063485cc9551461034a5780634b2f0ea01461036a5780634f1ef2861461037d57806352d1902d1461039057806354fd4d50146103a5578063564a565d146103e35780635c92e2f61461041257806365540b961461043257600080fd5b80630855bbe9146101c957806309cc41b8146101fe5780630baa64d1146102205780630c340a24146102405780631200aabc146102785780631c3db16d146102b35780631cc3423a146102f05780632621b9a214610310575b600080fd5b3480156101d557600080fd5b506101e96101e43660046136a3565b6106af565b60405190151581526020015b60405180910390f35b34801561020a57600080fd5b5061021e610219366004613748565b610777565b005b34801561022c57600080fd5b506101e961023b3660046136a3565b61082a565b34801561024c57600080fd5b50600054610260906001600160a01b031681565b6040516001600160a01b0390911681526020016101f5565b34801561028457600080fd5b506102a56102933660046136a3565b60036020526000908152604090205481565b6040519081526020016101f5565b3480156102bf57600080fd5b506102d36102ce3660046136a3565b6108a1565b6040805193845291151560208401521515908201526060016101f5565b3480156102fc57600080fd5b506102a561030b3660046138b2565b610a0f565b34801561031c57600080fd5b506004546101e99060ff1681565b34801561033657600080fd5b506102a5610345366004613916565b610a4c565b34801561035657600080fd5b5061021e610365366004613953565b610ed2565b61021e61037836600461398c565b610f9a565b61021e61038b3660046139ae565b611801565b34801561039c57600080fd5b506102a5611a29565b3480156103b157600080fd5b506103d66040518060400160405280600581526020016418171c971960d91b81525081565b6040516101f59190613a4d565b3480156103ef57600080fd5b506104036103fe3660046136a3565b611a87565b6040516101f593929190613a67565b34801561041e57600080fd5b5061021e61042d366004613a88565b611b4d565b34801561043e57600080fd5b5061045261044d3660046136a3565b611b59565b6040516101f59190613ada565b34801561046b57600080fd5b506102a561047a366004613b1e565b611c1d565b34801561048b57600080fd5b5061049f61049a366004613b59565b611d60565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f5565b3480156104d857600080fd5b506101e96104e73660046136a3565b611e18565b3480156104f857600080fd5b5061021e610507366004613b85565b611f9b565b34801561051857600080fd5b506102a561271081565b34801561052e57600080fd5b5061021e61053d366004613bc7565b612067565b34801561054e57600080fd5b5061021e61055d366004613c4b565b61207d565b34801561056e57600080fd5b5061058261057d366004613b59565b6120c9565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f5565b3480156105ba57600080fd5b506102a5614e2081565b3480156105d057600080fd5b5061021e6105df366004613c68565b61218f565b3480156105f057600080fd5b506101e96105ff366004613b59565b612352565b34801561061057600080fd5b506102a561138881565b34801561062657600080fd5b5061021e6123ed565b34801561063b57600080fd5b5061026061064a36600461398c565b61249e565b34801561065b57600080fd5b506102a561066a36600461398c565b6127b8565b34801561067b57600080fd5b5061021e61068a366004613c4b565b61290b565b34801561069b57600080fd5b50600154610260906001600160a01b031681565b60015460405163afe15cfb60e01b815260048101839052600091829182916001600160a01b03169063afe15cfb906024016040805180830381865afa1580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107209190613cc2565b91509150600061072f85611b59565b90508051600014801561076e575061271061138861074d8585613cfc565b6107579190613d0f565b6107619190613d26565b61076b8442613cfc565b10155b95945050505050565b60008781526003602052604090205460028054899290811061079b5761079b613d48565b600091825260209091206002600590920201015460ff16156107d85760405162461bcd60e51b81526004016107cf90613d5e565b60405180910390fd5b6107e488888888612957565b847f053dc5fd28575f5a9be86157f2079ab29d3aec5096f11b17e81b50409b88781c85858560405161081893929190613dbe565b60405180910390a25050505050505050565b60008181526003602052604081205460028054839290811061084e5761084e613d48565b6000918252602082206005909102018054909250829061087090600190613cfc565b8154811061088057610880613d48565b60009182526020909120600d90910201805460059091015414949350505050565b60008060008060026003600087815260200190815260200160002054815481106108cd576108cd613d48565b600091825260208220600590910201805490925082906108ef90600190613cfc565b815481106108ff576108ff613d48565b60009182526020909120600d90910201600381015460ff16945090508361092a57806001015461092d565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190613e04565b50909350600492506109b0915050565b8160048111156109c2576109c2613e6b565b03610a055760006109d288611b59565b90508051600103610a0357806000815181106109f0576109f0613d48565b6020026020010151965060009550600194505b505b5050509193909250565b8051602091820120604080518084019590955284810193909352606080850191909152825180850390910181526080909301909152815191012090565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015610a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abe9190613e04565b50935050505080610b115760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064016107cf565b600160009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b889190613e81565b15610bc65760405162461bcd60e51b815260206004820152600e60248201526d10dbdc99481a5cc81c185d5cd95960921b60448201526064016107cf565b600086815260036020526040812054600280549091908110610bea57610bea613d48565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610c1e57610c1e613d48565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600d9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190613e9c565b5050600087815260078401602052604090205490915060ff16610ce7576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610e2c565b808603610d5c576000868152600683016020526040902054610d0a576000610d55565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610d4b9190613d0f565b610d559190613d26565b9450610e2c565b600081815260078301602052604090205460ff16610e2c5781600601600083600a01600181548110610d9057610d90613d48565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610dc657610dc6613d48565b9060005260206000200154815260200190815260200160002054610dea9190613ed8565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610e1f9190613d0f565b610e299190613d26565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610ec6576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b60016000610ede612c5c565b8054909150600160401b900460ff1680610f05575080546001600160401b03808416911610155b15610f225760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b03831617600160401b178155610f4d8484612c80565b805460ff60401b191681556040516001600160401b03831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b600082815260036020526040902054600280548492908110610fbe57610fbe613d48565b600091825260209091206002600590920201015460ff1615610ff25760405162461bcd60e51b81526004016107cf90613d5e565b60008381526003602052604081205460028054909190811061101657611016613d48565b90600052602060002090600502019050806001015483111561107a5760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e60448201526064016107cf565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa1580156110c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110eb9190613cc2565b915091508142101580156110fe57508042105b6111435760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b60448201526064016107cf565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015611184573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a89190613e9c565b505090508681036111bd57612710915061123e565b6127106113886111cd8686613cfc565b6111d79190613d0f565b6111e19190613d26565b6111eb8542613cfc565b106112385760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f7365720060448201526064016107cf565b614e2091505b8454600090869061125190600190613cfc565b8154811061126157611261613d48565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600d949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa1580156112c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e49190613eeb565b6112ee9190613cfc565b60008a815260078401602052604090205490915060ff16156113525760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e000000000060448201526064016107cf565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa15801561139c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c09190613eeb565b905060006127106113d18784613d0f565b6113db9190613d26565b6113e59083613ed8565b60008c8152600686016020526040812054919250908211156114965760008c8152600686016020526040902054349061141e9084613cfc565b116114435760008c815260068601602052604090205461143e9083613cfc565b611445565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f8560405161148d929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906114c2908490613ed8565b909155505060008c8152600686016020526040812080548392906114e7908490613ed8565b909155505060008c815260068601602052604090205482116115b95760008c815260068601602052604081205460098701805491929091611529908490613ed8565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156117c4578285600901546115d69190613cfc565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190613e81565b156116615760028a01805460ff19166001179055611744565b895460038b016000611674876001613ed8565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600d02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b81526004016116ef91815260200190565b602060405180830381865afa15801561170c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117309190613eeb565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161179193929190613f3e565b6000604051808303818588803b1580156117aa57600080fd5b505af11580156117be573d6000803e3d6000fd5b50505050505b803411156117f257336108fc6117da8334613cfc565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b61180a82612cb6565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061188857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661187c6000805160206144768339815191525490565b6001600160a01b031614155b156118a65760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611900575060408051601f3d908101601f191682019092526118fd91810190613eeb565b60015b61192857604051630c76093760e01b81526001600160a01b03831660048201526024016107cf565b600080516020614476833981519152811461195957604051632a87526960e21b8152600481018290526024016107cf565b6000805160206144768339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2815115611a24576000836001600160a01b0316836040516119c09190613fdd565b600060405180830381855af49150503d80600081146119fb576040519150601f19603f3d011682016040523d82523d6000602084013e611a00565b606091505b5050905080611a22576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a745760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061447683398151915290565b60028181548110611a9757600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff9091169291611aca90613f04565b80601f0160208091040260200160405190810160405280929190818152602001828054611af690613f04565b8015611b435780601f10611b1857610100808354040283529160200191611b43565b820191906000526020600020905b815481529060010190602001808311611b2657829003601f168201915b5050505050905083565b611a2284848484612957565b6000818152600360205260408120546002805460609392908110611b7f57611b7f613d48565b60009182526020822060059091020180549092508290611ba190600190613cfc565b81548110611bb157611bb1613d48565b90600052602060002090600d0201905080600a01805480602002602001604051908101604052809291908181526020018280548015611c0f57602002820191906000526020600020905b815481526020019060010190808311611bfb575b505050505092505050919050565b600085815260036020526040812054600280548392908110611c4157611c41613d48565b60009182526020808320898452600360059093020191820190526040822054815491935083918110611c7557611c75613d48565b90600052602060002090600d02016000018681548110611c9757611c97613d48565b600091825260208220600154604051631c3db16d60e01b815260048082018e905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa158015611cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d199190613e9c565b506003850154919350915060ff168015611d3d57508183600201541480611d3d5750805b15611d505761271094505050505061076e565b5060009998505050505050505050565b60008060008060008060006002600360008c81526020019081526020016000205481548110611d9157611d91613d48565b600091825260208083208c8452600360059093020191820190526040822054815491935083918110611dc557611dc5613d48565b600091825260208083206001600d909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611e3c57611e3c613d48565b60009182526020822060059091020180549092508290611e5e90600190613cfc565b81548110611e6e57611e6e613d48565b60009182526020822060015460405163564a565d60e01b815260048101899052600d9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015611ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eed9190613e04565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015611f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6c9190613ff9565b5050505050915050600081611f82578354611f88565b83600501545b6004909401549093149695505050505050565b6000546001600160a01b03163314611fc55760405162461bcd60e51b81526004016107cf90614063565b6000836001600160a01b03168383604051611fe09190613fdd565b60006040518083038185875af1925050503d806000811461201d576040519150601f19603f3d011682016040523d82523d6000602084013e612022565b606091505b5050905080611a225760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b60448201526064016107cf565b612075868686868686612ce3565b505050505050565b6000546001600160a01b031633146120a75760405162461bcd60e51b81526004016107cf90614063565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008060008060006002600360008a815260200190815260200160002054815481106120f7576120f7613d48565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061212b5761212b613d48565b90600052602060002090600d0201600001878154811061214d5761214d613d48565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146121b95760405162461bcd60e51b81526004016107cf906140a5565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad201612244858783614131565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa15801561229b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bf9190613eeb565b6122c99190613cfc565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600d909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab5810890610818908a908a908a90613dbe565b60008381526003602052604081205460028054839290811061237657612376613d48565b600091825260208083208784526003600590930201918201905260408220548154919350839181106123aa576123aa613d48565b90600052602060002090600d020160000184815481106123cc576123cc613d48565b600091825260209091206004909102016003015460ff169695505050505050565b600460006123f9612c5c565b8054909150600160401b900460ff1680612420575080546001600160401b03808416911610155b1561243d5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b1760ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050565b6001546000906001600160a01b031633146124cb5760405162461bcd60e51b81526004016107cf906140a5565b6000838152600360205260409020546002805485929081106124ef576124ef613d48565b600091825260209091206002600590920201015460ff16156125235760405162461bcd60e51b81526004016107cf90613d5e565b60008481526003602052604081205460028054909190811061254757612547613d48565b6000918252602082206005909102018054909250829061256990600190613cfc565b8154811061257957612579613d48565b90600052602060002090600d020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260291906141f1565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126759190613e04565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa1580156126d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fd91906141f1565b965061270a848a896133a6565b156127a757604080516080810182526001600160a01b03808a1680835260006020808501828152858701838152606087018481528c5460018181018f558e8752858720995160049092029099018054919098166001600160a01b0319909116178755915186880155516002860155516003909401805494151560ff19958616179055918152600c89019091529290922080549092161790556127ac565b600096505b50505050505092915050565b6000828152600360205260408120546002805483929081106127dc576127dc613d48565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061281057612810613d48565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600d93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa15801561286f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128939190613e9c565b50915091508260040154600014806128c25750801580156128c257506000828152600284016020526040902054155b156128d4576000945050505050612905565b80156128e95750506004015491506129059050565b5060009081526002909101602052604090205491506129059050565b92915050565b6000546001600160a01b031633146129355760405162461bcd60e51b81526004016107cf90614063565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008481526003602052604090205460028054869290811061297b5761297b613d48565b600091825260209091206002600590920201015460ff16156129af5760405162461bcd60e51b81526004016107cf90613d5e565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa1580156129f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1d9190613e04565b5090935060019250612a2d915050565b816004811115612a3f57612a3f613e6b565b14612a9c5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b60648201526084016107cf565b82612ad95760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b60448201526064016107cf565b600086815260036020526040812054600280549091908110612afd57612afd613d48565b60009182526020822060059091020180549092508290612b1f90600190613cfc565b81548110612b2f57612b2f613d48565b90600052602060002090600d0201905060005b86811015612bf5573382898984818110612b5e57612b5e613d48565b9050602002013581548110612b7557612b75613d48565b60009182526020909120600490910201546001600160a01b031614612bac5760405162461bcd60e51b81526004016107cf9061420e565b8582898984818110612bc057612bc0613d48565b9050602002013581548110612bd757612bd7613d48565b60009182526020909120600160049092020181019190915501612b42565b5086869050816005016000828254612c0d9190613ed8565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890612c4a908b908b908b90614277565b60405180910390a35050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e90565b612c88613662565b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055565b6000546001600160a01b03163314612ce05760405162461bcd60e51b81526004016107cf90614063565b50565b600086815260036020526040902054600280548892908110612d0757612d07613d48565b600091825260209091206002600590920201015460ff1615612d3b5760405162461bcd60e51b81526004016107cf90613d5e565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015612d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612da99190613e04565b5090935060029250612db9915050565b816004811115612dcb57612dcb613e6b565b14612e265760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b60648201526084016107cf565b85612e685760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b60448201526064016107cf565b600088815260036020526040812054600280549091908110612e8c57612e8c613d48565b906000526020600020906005020190508060010154861115612ee75760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b60448201526064016107cf565b80546000908290612efa90600190613cfc565b81548110612f0a57612f0a613d48565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600d9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015612f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f899190613e04565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015612fe4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130089190613ff9565b5050505050915050600061301d8a8a8a610a0f565b905060005b8b81101561326b5733858e8e8481811061303e5761303e613d48565b905060200201358154811061305557613055613d48565b60009182526020909120600490910201546001600160a01b03161461308c5760405162461bcd60e51b81526004016107cf9061420e565b8215806130d3575081858e8e848181106130a8576130a8613d48565b90506020020135815481106130bf576130bf613d48565b906000526020600020906004020160010154145b6131535760405162461bcd60e51b8152602060048201526044602482018190527f54686520766f74652068617368206d757374206d617463682074686520636f6d908201527f6d69746d656e7420696e20636f7572747320776974682068696464656e20766f6064820152633a32b99760e11b608482015260a4016107cf565b848d8d8381811061316657613166613d48565b905060200201358154811061317d5761317d613d48565b600091825260209091206003600490920201015460ff16156131d65760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b60448201526064016107cf565b8a858e8e848181106131ea576131ea613d48565b905060200201358154811061320157613201613d48565b60009182526020909120600260049092020101556001858e8e8481811061322a5761322a613d48565b905060200201358154811061324157613241613d48565b60009182526020909120600490910201600301805460ff1916911515919091179055600101613022565b508b8b90508460040160008282546132839190613ed8565b909155505060008a8152600285016020526040812080548d92906132a8908490613ed8565b909155505060018401548a036132d757600384015460ff16156132d25760038401805460ff191690555b613350565b60018401546000908152600285016020526040808220548c83529120540361331957600384015460ff166132d25760038401805460ff19166001179055613350565b60018401546000908152600285016020526040808220548c8352912054111561335057600184018a905560038401805460ff191690555b89336001600160a01b03168e7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48f8f8d60405161338f9392919061429b565b60405180910390a450505050505050505050505050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156133f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134189190613e04565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015613477573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349b9190613eeb565b6134a59190613cfc565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa1580156134e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261350e919081019061435e565b602001519050600080600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561356a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358e91906141f1565b604051631a383be960e31b81526001600160a01b0388811660048301526001600160601b0387166024830152919091169063d1c1df4890604401608060405180830381865afa1580156135e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613609919061443f565b505091509150828161361b9190613ed8565b60045490831015955060ff16156136575784801561365457506001600160a01b0386166000908152600c8901602052604090205460ff16155b94505b505050509392505050565b61366a613689565b61368757604051631afcd79f60e31b815260040160405180910390fd5b565b6000613693612c5c565b54600160401b900460ff16919050565b6000602082840312156136b557600080fd5b5035919050565b60008083601f8401126136ce57600080fd5b5081356001600160401b038111156136e557600080fd5b6020830191508360208260051b850101111561370057600080fd5b9250929050565b60008083601f84011261371957600080fd5b5081356001600160401b0381111561373057600080fd5b60208301915083602082850101111561370057600080fd5b600080600080600080600060a0888a03121561376357600080fd5b8735965060208801356001600160401b038082111561378157600080fd5b61378d8b838c016136bc565b909850965060408a0135955060608a0135945060808a01359150808211156137b457600080fd5b506137c18a828b01613707565b989b979a50959850939692959293505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561380d5761380d6137d4565b60405290565b604051601f8201601f191681016001600160401b038111828210171561383b5761383b6137d4565b604052919050565b600082601f83011261385457600080fd5b81356001600160401b0381111561386d5761386d6137d4565b613880601f8201601f1916602001613813565b81815284602083860101111561389557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156138c757600080fd5b833592506020840135915060408401356001600160401b038111156138eb57600080fd5b6138f786828701613843565b9150509250925092565b6001600160a01b0381168114612ce057600080fd5b6000806000806080858703121561392c57600080fd5b84359350602085013561393e81613901565b93969395505050506040820135916060013590565b6000806040838503121561396657600080fd5b823561397181613901565b9150602083013561398181613901565b809150509250929050565b6000806040838503121561399f57600080fd5b50508035926020909101359150565b600080604083850312156139c157600080fd5b82356139cc81613901565b915060208301356001600160401b038111156139e757600080fd5b6139f385828601613843565b9150509250929050565b60005b83811015613a18578181015183820152602001613a00565b50506000910152565b60008151808452613a398160208601602086016139fd565b601f01601f19169290920160200192915050565b602081526000613a606020830184613a21565b9392505050565b838152821515602082015260606040820152600061076e6060830184613a21565b60008060008060608587031215613a9e57600080fd5b8435935060208501356001600160401b03811115613abb57600080fd5b613ac7878288016136bc565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613b1257835183529284019291840191600101613af6565b50909695505050505050565b600080600080600060a08688031215613b3657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b600080600060608486031215613b6e57600080fd5b505081359360208301359350604090920135919050565b600080600060608486031215613b9a57600080fd5b8335613ba581613901565b92506020840135915060408401356001600160401b038111156138eb57600080fd5b60008060008060008060a08789031215613be057600080fd5b8635955060208701356001600160401b0380821115613bfe57600080fd5b613c0a8a838b016136bc565b909750955060408901359450606089013593506080890135915080821115613c3157600080fd5b50613c3e89828a01613843565b9150509295509295509295565b600060208284031215613c5d57600080fd5b8135613a6081613901565b600080600080600060808688031215613c8057600080fd5b853594506020860135935060408601356001600160401b03811115613ca457600080fd5b613cb088828901613707565b96999598509660600135949350505050565b60008060408385031215613cd557600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561290557612905613ce6565b808202811582820484141761290557612905613ce6565b600082613d4357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b83815260406020820152600061076e604083018486613d95565b80516001600160601b0381168114613def57600080fd5b919050565b80518015158114613def57600080fd5b600080600080600060a08688031215613e1c57600080fd5b613e2586613dd8565b94506020860151613e3581613901565b604087015190945060058110613e4a57600080fd5b9250613e5860608701613df4565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613e9357600080fd5b613a6082613df4565b600080600060608486031215613eb157600080fd5b83519250613ec160208501613df4565b9150613ecf60408501613df4565b90509250925092565b8082018082111561290557612905613ce6565b600060208284031215613efd57600080fd5b5051919050565b600181811c90821680613f1857607f821691505b602082108103613f3857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208460208401526060604084015260008454613f5f81613f04565b8060608701526080600180841660008114613f815760018114613f9d57613fcd565b60ff19851660808a0152608084151560051b8a01019550613fcd565b89600052602060002060005b85811015613fc45781548b8201860152908301908801613fa9565b8a016080019650505b50939a9950505050505050505050565b60008251613fef8184602087016139fd565b9190910192915050565b600080600080600080600060e0888a03121561401457600080fd5b61401d88613dd8565b965061402b60208901613df4565b955060408801519450606088015193506080880151925060a0880151915061405560c08901613df4565b905092959891949750929550565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f821115611a24576000816000526020600020601f850160051c810160208610156141125750805b601f850160051c820191505b818110156120755782815560010161411e565b6001600160401b03831115614148576141486137d4565b61415c836141568354613f04565b836140e9565b6000601f84116001811461419057600085156141785750838201355b600019600387901b1c1916600186901b1783556141ea565b600083815260209020601f19861690835b828110156141c157868501358255602094850194600190920191016141a1565b50868210156141de5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60006020828403121561420357600080fd5b8151613a6081613901565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b81835260006001600160fb1b0383111561425e57600080fd5b8260051b80836020870137939093016020019392505050565b60408152600061428b604083018587614245565b9050826020830152949350505050565b6040815260006142af604083018587614245565b82810360208401526142c18185613a21565b9695505050505050565b600082601f8301126142dc57600080fd5b815160206001600160401b038211156142f7576142f76137d4565b8160051b614306828201613813565b928352848101820192828101908785111561432057600080fd5b83870192505b8483101561434857825161433981613901565b82529183019190830190614326565b979650505050505050565b8051613def81613901565b60006020828403121561437057600080fd5b81516001600160401b038082111561438757600080fd5b90830190610160828603121561439c57600080fd5b6143a46137ea565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c0830151828111156143ec57600080fd5b6143f8878286016142cb565b60c08301525060e0838101519082015261010080840151908201526101209150614423828401614353565b9181019190915261014091820151918101919091529392505050565b6000806000806080858703121561445557600080fd5b50508251602084015160408501516060909501519196909550909250905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203ada2f3e13f6acb3c61148590d88e774a75ff8a53adb5bb0bd110996f279319e64736f6c63430008180033", + "deployedBytecode": "0x6080604052600436106101c45760003560e01c8063675926f6116100f8578063b6ede54011610090578063b6ede540146105c4578063ba66fde7146105e4578063be46760414610604578063caeb50ed1461061a578063d2b8035a1461062f578063da3beb8c1461064f578063e349ad301461050c578063e4c0aaf41461066f578063f2f4eb261461068f57600080fd5b8063675926f61461045f57806369f3f0411461047f5780636d4cd8ea146104cc578063751accd0146104ec578063796490f91461050c5780637c04034e146105225780638e42646014610542578063a7cc08fe14610562578063b34bfaa8146105ae57600080fd5b8063362c34791161016b578063362c34791461032a578063485cc9551461034a5780634b2f0ea01461036a5780634f1ef2861461037d57806352d1902d1461039057806354fd4d50146103a5578063564a565d146103e35780635c92e2f61461041257806365540b961461043257600080fd5b80630855bbe9146101c957806309cc41b8146101fe5780630baa64d1146102205780630c340a24146102405780631200aabc146102785780631c3db16d146102b35780631cc3423a146102f05780632621b9a214610310575b600080fd5b3480156101d557600080fd5b506101e96101e43660046136a3565b6106af565b60405190151581526020015b60405180910390f35b34801561020a57600080fd5b5061021e610219366004613748565b610777565b005b34801561022c57600080fd5b506101e961023b3660046136a3565b61082a565b34801561024c57600080fd5b50600054610260906001600160a01b031681565b6040516001600160a01b0390911681526020016101f5565b34801561028457600080fd5b506102a56102933660046136a3565b60036020526000908152604090205481565b6040519081526020016101f5565b3480156102bf57600080fd5b506102d36102ce3660046136a3565b6108a1565b6040805193845291151560208401521515908201526060016101f5565b3480156102fc57600080fd5b506102a561030b3660046138b2565b610a0f565b34801561031c57600080fd5b506004546101e99060ff1681565b34801561033657600080fd5b506102a5610345366004613916565b610a4c565b34801561035657600080fd5b5061021e610365366004613953565b610ed2565b61021e61037836600461398c565b610f9a565b61021e61038b3660046139ae565b611801565b34801561039c57600080fd5b506102a5611a29565b3480156103b157600080fd5b506103d66040518060400160405280600581526020016418171c971960d91b81525081565b6040516101f59190613a4d565b3480156103ef57600080fd5b506104036103fe3660046136a3565b611a87565b6040516101f593929190613a67565b34801561041e57600080fd5b5061021e61042d366004613a88565b611b4d565b34801561043e57600080fd5b5061045261044d3660046136a3565b611b59565b6040516101f59190613ada565b34801561046b57600080fd5b506102a561047a366004613b1e565b611c1d565b34801561048b57600080fd5b5061049f61049a366004613b59565b611d60565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f5565b3480156104d857600080fd5b506101e96104e73660046136a3565b611e18565b3480156104f857600080fd5b5061021e610507366004613b85565b611f9b565b34801561051857600080fd5b506102a561271081565b34801561052e57600080fd5b5061021e61053d366004613bc7565b612067565b34801561054e57600080fd5b5061021e61055d366004613c4b565b61207d565b34801561056e57600080fd5b5061058261057d366004613b59565b6120c9565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f5565b3480156105ba57600080fd5b506102a5614e2081565b3480156105d057600080fd5b5061021e6105df366004613c68565b61218f565b3480156105f057600080fd5b506101e96105ff366004613b59565b612352565b34801561061057600080fd5b506102a561138881565b34801561062657600080fd5b5061021e6123ed565b34801561063b57600080fd5b5061026061064a36600461398c565b61249e565b34801561065b57600080fd5b506102a561066a36600461398c565b6127b8565b34801561067b57600080fd5b5061021e61068a366004613c4b565b61290b565b34801561069b57600080fd5b50600154610260906001600160a01b031681565b60015460405163afe15cfb60e01b815260048101839052600091829182916001600160a01b03169063afe15cfb906024016040805180830381865afa1580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107209190613cc2565b91509150600061072f85611b59565b90508051600014801561076e575061271061138861074d8585613cfc565b6107579190613d0f565b6107619190613d26565b61076b8442613cfc565b10155b95945050505050565b60008781526003602052604090205460028054899290811061079b5761079b613d48565b600091825260209091206002600590920201015460ff16156107d85760405162461bcd60e51b81526004016107cf90613d5e565b60405180910390fd5b6107e488888888612957565b847f053dc5fd28575f5a9be86157f2079ab29d3aec5096f11b17e81b50409b88781c85858560405161081893929190613dbe565b60405180910390a25050505050505050565b60008181526003602052604081205460028054839290811061084e5761084e613d48565b6000918252602082206005909102018054909250829061087090600190613cfc565b8154811061088057610880613d48565b60009182526020909120600d90910201805460059091015414949350505050565b60008060008060026003600087815260200190815260200160002054815481106108cd576108cd613d48565b600091825260208220600590910201805490925082906108ef90600190613cfc565b815481106108ff576108ff613d48565b60009182526020909120600d90910201600381015460ff16945090508361092a57806001015461092d565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190613e04565b50909350600492506109b0915050565b8160048111156109c2576109c2613e6b565b03610a055760006109d288611b59565b90508051600103610a0357806000815181106109f0576109f0613d48565b6020026020010151965060009550600194505b505b5050509193909250565b8051602091820120604080518084019590955284810193909352606080850191909152825180850390910181526080909301909152815191012090565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015610a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abe9190613e04565b50935050505080610b115760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e000000000060448201526064016107cf565b600160009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b889190613e81565b15610bc65760405162461bcd60e51b815260206004820152600e60248201526d10dbdc99481a5cc81c185d5cd95960921b60448201526064016107cf565b600086815260036020526040812054600280549091908110610bea57610bea613d48565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610c1e57610c1e613d48565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600d9390930290910193506001600160a01b031690631c3db16d90602401606060405180830381865afa158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190613e9c565b5050600087815260078401602052604090205490915060ff16610ce7576001600160a01b038816600090815260088301602090815260408083208984529091529020549450610e2c565b808603610d5c576000868152600683016020526040902054610d0a576000610d55565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610d4b9190613d0f565b610d559190613d26565b9450610e2c565b600081815260078301602052604090205460ff16610e2c5781600601600083600a01600181548110610d9057610d90613d48565b906000526020600020015481526020019081526020016000205482600601600084600a01600081548110610dc657610dc6613d48565b9060005260206000200154815260200190815260200160002054610dea9190613ed8565b60098301546001600160a01b038a16600090815260088501602090815260408083208b8452909152902054610e1f9190613d0f565b610e299190613d26565b94505b6001600160a01b038816600090815260088301602090815260408083208984529091528120558415610ec6576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b60016000610ede612c5c565b8054909150600160401b900460ff1680610f05575080546001600160401b03808416911610155b15610f225760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b03831617600160401b178155610f4d8484612c80565b805460ff60401b191681556040516001600160401b03831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b600082815260036020526040902054600280548492908110610fbe57610fbe613d48565b600091825260209091206002600590920201015460ff1615610ff25760405162461bcd60e51b81526004016107cf90613d5e565b60008381526003602052604081205460028054909190811061101657611016613d48565b90600052602060002090600502019050806001015483111561107a5760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e60448201526064016107cf565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb906024016040805180830381865afa1580156110c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110eb9190613cc2565b915091508142101580156110fe57508042105b6111435760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b60448201526064016107cf565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d90602401606060405180830381865afa158015611184573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a89190613e9c565b505090508681036111bd57612710915061123e565b6127106113886111cd8686613cfc565b6111d79190613d0f565b6111e19190613d26565b6111eb8542613cfc565b106112385760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f7365720060448201526064016107cf565b614e2091505b8454600090869061125190600190613cfc565b8154811061126157611261613d48565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600d949094029092019450916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa1580156112c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e49190613eeb565b6112ee9190613cfc565b60008a815260078401602052604090205490915060ff16156113525760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e000000000060448201526064016107cf565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e90602401602060405180830381865afa15801561139c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c09190613eeb565b905060006127106113d18784613d0f565b6113db9190613d26565b6113e59083613ed8565b60008c8152600686016020526040812054919250908211156114965760008c8152600686016020526040902054349061141e9084613cfc565b116114435760008c815260068601602052604090205461143e9083613cfc565b611445565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f8560405161148d929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f8452909152812080548392906114c2908490613ed8565b909155505060008c8152600686016020526040812080548392906114e7908490613ed8565b909155505060008c815260068601602052604090205482116115b95760008c815260068601602052604081205460098701805491929091611529908490613ed8565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a850154600110156117c4578285600901546115d69190613cfc565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b8152990602401602060405180830381865afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190613e81565b156116615760028a01805460ff19166001179055611744565b895460038b016000611674876001613ed8565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600d02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b81526004016116ef91815260200190565b602060405180830381865afa15801561170c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117309190613eeb565b600b820155600301805460ff191660011790555b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161179193929190613f3e565b6000604051808303818588803b1580156117aa57600080fd5b505af11580156117be573d6000803e3d6000fd5b50505050505b803411156117f257336108fc6117da8334613cfc565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b61180a82612cb6565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061188857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661187c6000805160206144768339815191525490565b6001600160a01b031614155b156118a65760405163703e46dd60e11b815260040160405180910390fd5b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611900575060408051601f3d908101601f191682019092526118fd91810190613eeb565b60015b61192857604051630c76093760e01b81526001600160a01b03831660048201526024016107cf565b600080516020614476833981519152811461195957604051632a87526960e21b8152600481018290526024016107cf565b6000805160206144768339815191528390556040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2815115611a24576000836001600160a01b0316836040516119c09190613fdd565b600060405180830381855af49150503d80600081146119fb576040519150601f19603f3d011682016040523d82523d6000602084013e611a00565b606091505b5050905080611a22576040516339b21b5d60e11b815260040160405180910390fd5b505b505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a745760405163703e46dd60e11b815260040160405180910390fd5b5060008051602061447683398151915290565b60028181548110611a9757600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff9091169291611aca90613f04565b80601f0160208091040260200160405190810160405280929190818152602001828054611af690613f04565b8015611b435780601f10611b1857610100808354040283529160200191611b43565b820191906000526020600020905b815481529060010190602001808311611b2657829003601f168201915b5050505050905083565b611a2284848484612957565b6000818152600360205260408120546002805460609392908110611b7f57611b7f613d48565b60009182526020822060059091020180549092508290611ba190600190613cfc565b81548110611bb157611bb1613d48565b90600052602060002090600d0201905080600a01805480602002602001604051908101604052809291908181526020018280548015611c0f57602002820191906000526020600020905b815481526020019060010190808311611bfb575b505050505092505050919050565b600085815260036020526040812054600280548392908110611c4157611c41613d48565b60009182526020808320898452600360059093020191820190526040822054815491935083918110611c7557611c75613d48565b90600052602060002090600d02016000018681548110611c9757611c97613d48565b600091825260208220600154604051631c3db16d60e01b815260048082018e905293909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa158015611cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d199190613e9c565b506003850154919350915060ff168015611d3d57508183600201541480611d3d5750805b15611d505761271094505050505061076e565b5060009998505050505050505050565b60008060008060008060006002600360008c81526020019081526020016000205481548110611d9157611d91613d48565b600091825260208083208c8452600360059093020191820190526040822054815491935083918110611dc557611dc5613d48565b600091825260208083206001600d909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b600081815260036020526040812054600280548392908110611e3c57611e3c613d48565b60009182526020822060059091020180549092508290611e5e90600190613cfc565b81548110611e6e57611e6e613d48565b60009182526020822060015460405163564a565d60e01b815260048101899052600d9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015611ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eed9190613e04565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015611f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6c9190613ff9565b5050505050915050600081611f82578354611f88565b83600501545b6004909401549093149695505050505050565b6000546001600160a01b03163314611fc55760405162461bcd60e51b81526004016107cf90614063565b6000836001600160a01b03168383604051611fe09190613fdd565b60006040518083038185875af1925050503d806000811461201d576040519150601f19603f3d011682016040523d82523d6000602084013e612022565b606091505b5050905080611a225760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b60448201526064016107cf565b612075868686868686612ce3565b505050505050565b6000546001600160a01b031633146120a75760405162461bcd60e51b81526004016107cf90614063565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008060008060006002600360008a815260200190815260200160002054815481106120f7576120f7613d48565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061212b5761212b613d48565b90600052602060002090600d0201600001878154811061214d5761214d613d48565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146121b95760405162461bcd60e51b81526004016107cf906140a5565b60028054600181018255600091909152600581027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf81018690557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace8101907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad201612244858783614131565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f1690602401602060405180830381865afa15801561229b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bf9190613eeb565b6122c99190613cfc565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600d909302019182018890556003808301805460ff19169092179091558b855290925291829020849055905188907fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab5810890610818908a908a908a90613dbe565b60008381526003602052604081205460028054839290811061237657612376613d48565b600091825260208083208784526003600590930201918201905260408220548154919350839181106123aa576123aa613d48565b90600052602060002090600d020160000184815481106123cc576123cc613d48565b600091825260209091206004909102016003015460ff169695505050505050565b600460006123f9612c5c565b8054909150600160401b900460ff1680612420575080546001600160401b03808416911610155b1561243d5760405162dc149f60e41b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b038316908117600160401b1760ff60401b191682556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050565b6001546000906001600160a01b031633146124cb5760405162461bcd60e51b81526004016107cf906140a5565b6000838152600360205260409020546002805485929081106124ef576124ef613d48565b600091825260209091206002600590920201015460ff16156125235760405162461bcd60e51b81526004016107cf90613d5e565b60008481526003602052604081205460028054909190811061254757612547613d48565b6000918252602082206005909102018054909250829061256990600190613cfc565b8154811061257957612579613d48565b90600052602060002090600d020190506000600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260291906141f1565b60015460405163564a565d60e01b8152600481018a90529192506000916001600160a01b039091169063564a565d9060240160a060405180830381865afa158015612651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126759190613e04565b5050604051632638506b60e11b81526001600160601b03841660048201819052602482018d9052604482018c90529394506001600160a01b0386169250634c70a0d69150606401602060405180830381865afa1580156126d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fd91906141f1565b965061270a848a896133a6565b156127a757604080516080810182526001600160a01b03808a1680835260006020808501828152858701838152606087018481528c5460018181018f558e8752858720995160049092029099018054919098166001600160a01b0319909116178755915186880155516002860155516003909401805494151560ff19958616179055918152600c89019091529290922080549092161790556127ac565b600096505b50505050505092915050565b6000828152600360205260408120546002805483929081106127dc576127dc613d48565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061281057612810613d48565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600d93909302909101935082916001600160a01b0390911690631c3db16d90602401606060405180830381865afa15801561286f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128939190613e9c565b50915091508260040154600014806128c25750801580156128c257506000828152600284016020526040902054155b156128d4576000945050505050612905565b80156128e95750506004015491506129059050565b5060009081526002909101602052604090205491506129059050565b92915050565b6000546001600160a01b031633146129355760405162461bcd60e51b81526004016107cf90614063565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008481526003602052604090205460028054869290811061297b5761297b613d48565b600091825260209091206002600590920201015460ff16156129af5760405162461bcd60e51b81526004016107cf90613d5e565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a060405180830381865afa1580156129f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1d9190613e04565b5090935060019250612a2d915050565b816004811115612a3f57612a3f613e6b565b14612a9c5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b60648201526084016107cf565b82612ad95760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b60448201526064016107cf565b600086815260036020526040812054600280549091908110612afd57612afd613d48565b60009182526020822060059091020180549092508290612b1f90600190613cfc565b81548110612b2f57612b2f613d48565b90600052602060002090600d0201905060005b86811015612bf5573382898984818110612b5e57612b5e613d48565b9050602002013581548110612b7557612b75613d48565b60009182526020909120600490910201546001600160a01b031614612bac5760405162461bcd60e51b81526004016107cf9061420e565b8582898984818110612bc057612bc0613d48565b9050602002013581548110612bd757612bd7613d48565b60009182526020909120600160049092020181019190915501612b42565b5086869050816005016000828254612c0d9190613ed8565b9091555050604051339089907f05cc2f1c94966f1c961b410a50f3d3ffb64501346753a258177097ea23707f0890612c4a908b908b908b90614277565b60405180910390a35050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0e90565b612c88613662565b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055565b6000546001600160a01b03163314612ce05760405162461bcd60e51b81526004016107cf90614063565b50565b600086815260036020526040902054600280548892908110612d0757612d07613d48565b600091825260209091206002600590920201015460ff1615612d3b5760405162461bcd60e51b81526004016107cf90613d5e565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a060405180830381865afa158015612d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612da99190613e04565b5090935060029250612db9915050565b816004811115612dcb57612dcb613e6b565b14612e265760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b60648201526084016107cf565b85612e685760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b60448201526064016107cf565b600088815260036020526040812054600280549091908110612e8c57612e8c613d48565b906000526020600020906005020190508060010154861115612ee75760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b60448201526064016107cf565b80546000908290612efa90600190613cfc565b81548110612f0a57612f0a613d48565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600d9390930290910193506001600160a01b03169063564a565d9060240160a060405180830381865afa158015612f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f899190613e04565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160e060405180830381865afa158015612fe4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130089190613ff9565b5050505050915050600061301d8a8a8a610a0f565b905060005b8b81101561326b5733858e8e8481811061303e5761303e613d48565b905060200201358154811061305557613055613d48565b60009182526020909120600490910201546001600160a01b03161461308c5760405162461bcd60e51b81526004016107cf9061420e565b8215806130d3575081858e8e848181106130a8576130a8613d48565b90506020020135815481106130bf576130bf613d48565b906000526020600020906004020160010154145b6131535760405162461bcd60e51b8152602060048201526044602482018190527f54686520766f74652068617368206d757374206d617463682074686520636f6d908201527f6d69746d656e7420696e20636f7572747320776974682068696464656e20766f6064820152633a32b99760e11b608482015260a4016107cf565b848d8d8381811061316657613166613d48565b905060200201358154811061317d5761317d613d48565b600091825260209091206003600490920201015460ff16156131d65760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b60448201526064016107cf565b8a858e8e848181106131ea576131ea613d48565b905060200201358154811061320157613201613d48565b60009182526020909120600260049092020101556001858e8e8481811061322a5761322a613d48565b905060200201358154811061324157613241613d48565b60009182526020909120600490910201600301805460ff1916911515919091179055600101613022565b508b8b90508460040160008282546132839190613ed8565b909155505060008a8152600285016020526040812080548d92906132a8908490613ed8565b909155505060018401548a036132d757600384015460ff16156132d25760038401805460ff191690555b613350565b60018401546000908152600285016020526040808220548c83529120540361331957600384015460ff166132d25760038401805460ff19166001179055613350565b60018401546000908152600285016020526040808220548c8352912054111561335057600184018a905560038401805460ff191690555b89336001600160a01b03168e7fa000893c71384499023d2d7b21234f7b9e80c78e0330f357dcd667ff578bd3a48f8f8d60405161338f9392919061429b565b60405180910390a450505050505050505050505050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a060405180830381865afa1580156133f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134189190613e04565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f1690602401602060405180830381865afa158015613477573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349b9190613eeb565b6134a59190613cfc565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa1580156134e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261350e919081019061435e565b602001519050600080600160009054906101000a90046001600160a01b03166001600160a01b0316632e1daf2f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561356a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358e91906141f1565b604051631a383be960e31b81526001600160a01b0388811660048301526001600160601b0387166024830152919091169063d1c1df4890604401608060405180830381865afa1580156135e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613609919061443f565b505091509150828161361b9190613ed8565b60045490831015955060ff16156136575784801561365457506001600160a01b0386166000908152600c8901602052604090205460ff16155b94505b505050509392505050565b61366a613689565b61368757604051631afcd79f60e31b815260040160405180910390fd5b565b6000613693612c5c565b54600160401b900460ff16919050565b6000602082840312156136b557600080fd5b5035919050565b60008083601f8401126136ce57600080fd5b5081356001600160401b038111156136e557600080fd5b6020830191508360208260051b850101111561370057600080fd5b9250929050565b60008083601f84011261371957600080fd5b5081356001600160401b0381111561373057600080fd5b60208301915083602082850101111561370057600080fd5b600080600080600080600060a0888a03121561376357600080fd5b8735965060208801356001600160401b038082111561378157600080fd5b61378d8b838c016136bc565b909850965060408a0135955060608a0135945060808a01359150808211156137b457600080fd5b506137c18a828b01613707565b989b979a50959850939692959293505050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561380d5761380d6137d4565b60405290565b604051601f8201601f191681016001600160401b038111828210171561383b5761383b6137d4565b604052919050565b600082601f83011261385457600080fd5b81356001600160401b0381111561386d5761386d6137d4565b613880601f8201601f1916602001613813565b81815284602083860101111561389557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156138c757600080fd5b833592506020840135915060408401356001600160401b038111156138eb57600080fd5b6138f786828701613843565b9150509250925092565b6001600160a01b0381168114612ce057600080fd5b6000806000806080858703121561392c57600080fd5b84359350602085013561393e81613901565b93969395505050506040820135916060013590565b6000806040838503121561396657600080fd5b823561397181613901565b9150602083013561398181613901565b809150509250929050565b6000806040838503121561399f57600080fd5b50508035926020909101359150565b600080604083850312156139c157600080fd5b82356139cc81613901565b915060208301356001600160401b038111156139e757600080fd5b6139f385828601613843565b9150509250929050565b60005b83811015613a18578181015183820152602001613a00565b50506000910152565b60008151808452613a398160208601602086016139fd565b601f01601f19169290920160200192915050565b602081526000613a606020830184613a21565b9392505050565b838152821515602082015260606040820152600061076e6060830184613a21565b60008060008060608587031215613a9e57600080fd5b8435935060208501356001600160401b03811115613abb57600080fd5b613ac7878288016136bc565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613b1257835183529284019291840191600101613af6565b50909695505050505050565b600080600080600060a08688031215613b3657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b600080600060608486031215613b6e57600080fd5b505081359360208301359350604090920135919050565b600080600060608486031215613b9a57600080fd5b8335613ba581613901565b92506020840135915060408401356001600160401b038111156138eb57600080fd5b60008060008060008060a08789031215613be057600080fd5b8635955060208701356001600160401b0380821115613bfe57600080fd5b613c0a8a838b016136bc565b909750955060408901359450606089013593506080890135915080821115613c3157600080fd5b50613c3e89828a01613843565b9150509295509295509295565b600060208284031215613c5d57600080fd5b8135613a6081613901565b600080600080600060808688031215613c8057600080fd5b853594506020860135935060408601356001600160401b03811115613ca457600080fd5b613cb088828901613707565b96999598509660600135949350505050565b60008060408385031215613cd557600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561290557612905613ce6565b808202811582820484141761290557612905613ce6565b600082613d4357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b83815260406020820152600061076e604083018486613d95565b80516001600160601b0381168114613def57600080fd5b919050565b80518015158114613def57600080fd5b600080600080600060a08688031215613e1c57600080fd5b613e2586613dd8565b94506020860151613e3581613901565b604087015190945060058110613e4a57600080fd5b9250613e5860608701613df4565b9150608086015190509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613e9357600080fd5b613a6082613df4565b600080600060608486031215613eb157600080fd5b83519250613ec160208501613df4565b9150613ecf60408501613df4565b90509250925092565b8082018082111561290557612905613ce6565b600060208284031215613efd57600080fd5b5051919050565b600181811c90821680613f1857607f821691505b602082108103613f3857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208460208401526060604084015260008454613f5f81613f04565b8060608701526080600180841660008114613f815760018114613f9d57613fcd565b60ff19851660808a0152608084151560051b8a01019550613fcd565b89600052602060002060005b85811015613fc45781548b8201860152908301908801613fa9565b8a016080019650505b50939a9950505050505050505050565b60008251613fef8184602087016139fd565b9190910192915050565b600080600080600080600060e0888a03121561401457600080fd5b61401d88613dd8565b965061402b60208901613df4565b955060408801519450606088015193506080880151925060a0880151915061405560c08901613df4565b905092959891949750929550565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b601f821115611a24576000816000526020600020601f850160051c810160208610156141125750805b601f850160051c820191505b818110156120755782815560010161411e565b6001600160401b03831115614148576141486137d4565b61415c836141568354613f04565b836140e9565b6000601f84116001811461419057600085156141785750838201355b600019600387901b1c1916600186901b1783556141ea565b600083815260209020601f19861690835b828110156141c157868501358255602094850194600190920191016141a1565b50868210156141de5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60006020828403121561420357600080fd5b8151613a6081613901565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b81835260006001600160fb1b0383111561425e57600080fd5b8260051b80836020870137939093016020019392505050565b60408152600061428b604083018587614245565b9050826020830152949350505050565b6040815260006142af604083018587614245565b82810360208401526142c18185613a21565b9695505050505050565b600082601f8301126142dc57600080fd5b815160206001600160401b038211156142f7576142f76137d4565b8160051b614306828201613813565b928352848101820192828101908785111561432057600080fd5b83870192505b8483101561434857825161433981613901565b82529183019190830190614326565b979650505050505050565b8051613def81613901565b60006020828403121561437057600080fd5b81516001600160401b038082111561438757600080fd5b90830190610160828603121561439c57600080fd5b6143a46137ea565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c0830151828111156143ec57600080fd5b6143f8878286016142cb565b60c08301525060e0838101519082015261010080840151908201526101209150614423828401614353565b9181019190915261014091820151918101919091529392505050565b6000806000806080858703121561445557600080fd5b50508251602084015160408501516060909501519196909550909250905056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212203ada2f3e13f6acb3c61148590d88e774a75ff8a53adb5bb0bd110996f279319e64736f6c63430008180033", + "devdoc": { + "errors": { + "AlreadyInitialized()": [ + { + "details": "The contract is already initialized." + } + ], + "InvalidImplementation(address)": [ + { + "details": "The `implementation` is not UUPS-compliant" + } + ], + "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." + } + }, + "CommitCastShutter(bytes32,bytes32,bytes)": { + "details": "Emitted when a vote is cast.", + "params": { + "_commit": "The commitment hash.", + "_encryptedVote": "The Shutter encrypted vote.", + "_identity": "The Shutter identity used for encryption." + } + }, + "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." + } + }, + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "details": "Emitted when the `implementation` has been successfully upgraded.", + "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. Note that this function is to be called directly by the core contract and is not for off-chain usage.", + "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 commitment hash.", + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_voteIDs": "The IDs of the votes." + } + }, + "castCommitShutter(uint256,uint256[],bytes32,bytes32,bytes)": { + "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 commitment hash including the justification.", + "_coreDisputeID": "The ID of the dispute in Kleros Core.", + "_encryptedVote": "The Shutter encrypted vote.", + "_identity": "The Shutter identity used for encryption.", + "_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": { + "custom:oz-upgrades-unsafe-allow": "constructor" + }, + "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,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." + } + }, + "hashVote(uint256,uint256,string)": { + "details": "Computes the hash of a vote using ABI encoding", + "params": { + "_choice": "The choice being voted for", + "_justification": "The justification for the vote", + "_salt": "A random salt for commitment" + }, + "returns": { + "_0": "bytes32 The hash of the encoded vote parameters" + } + }, + "initialize(address,address)": { + "details": "Initializer.", + "params": { + "_core": "The KlerosCore arbitrator.", + "_governor": "The governor's address." + } + }, + "isAppealFunded(uint256)": { + "details": "Returns true if the appeal funding is finished prematurely (e.g. when losing side didn't fund). Note that this function is to be called directly by the core contract and is not for off-chain usage.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit." + }, + "returns": { + "_0": "Whether the appeal funding is finished." + } + }, + "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." + }, + "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. Note that withdrawals are not possible if the core contract is paused.", + "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." + } + } + }, + "stateVariables": { + "version": { + "details": "Returns the version of the implementation.", + "return": "Version string.", + "returns": { + "_0": "Version string." + } + } + }, + "title": "DisputeKitShutter 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. Added functionality: an Shutter-specific event emitted when a vote is cast.", + "version": 1 + }, + "userdoc": { + "errors": { + "FailedDelegateCall()": [ + { + "notice": "Failed Delegated call" + } + ] + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3945, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 3948, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "core", + "offset": 0, + "slot": "1", + "type": "t_contract(KlerosCore)165" + }, + { + "astId": 3952, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "disputes", + "offset": 0, + "slot": "2", + "type": "t_array(t_struct(Dispute)3880_storage)dyn_storage" + }, + { + "astId": 3956, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "coreDisputeIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3958, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "singleDrawPerJuror", + "offset": 0, + "slot": "4", + "type": "t_bool" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(Dispute)3880_storage)dyn_storage": { + "base": "t_struct(Dispute)3880_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassicBase.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)3922_storage)dyn_storage": { + "base": "t_struct(Round)3922_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassicBase.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Vote)3931_storage)dyn_storage": { + "base": "t_struct(Vote)3931_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassicBase.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)165": { + "encoding": "inplace", + "label": "contract KlerosCore", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "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)3880_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassicBase.Dispute", + "members": [ + { + "astId": 3869, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "rounds", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Round)3922_storage)dyn_storage" + }, + { + "astId": 3871, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "numberOfChoices", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3873, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "jumped", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 3877, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "coreRoundIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3879, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "extraData", + "offset": 0, + "slot": "4", + "type": "t_bytes_storage" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Round)3922_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassicBase.Round", + "members": [ + { + "astId": 3884, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "votes", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Vote)3931_storage)dyn_storage" + }, + { + "astId": 3886, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "winningChoice", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3890, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "counts", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3892, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "tied", + "offset": 0, + "slot": "3", + "type": "t_bool" + }, + { + "astId": 3894, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "totalVoted", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3896, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "totalCommitted", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 3900, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "paidFees", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3904, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "hasPaid", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 3910, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "contributions", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 3912, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "feeRewards", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 3915, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "fundedChoices", + "offset": 0, + "slot": "10", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 3917, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "nbVotes", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 3921, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "alreadyDrawn", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_bool)" + } + ], + "numberOfBytes": "416" + }, + "t_struct(Vote)3931_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassicBase.Vote", + "members": [ + { + "astId": 3924, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 3926, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "commit", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 3928, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "choice", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 3930, + "contract": "src/arbitration/dispute-kits/DisputeKitShutter.sol:DisputeKitShutter", + "label": "voted", + "offset": 0, + "slot": "3", + "type": "t_bool" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json new file mode 100644 index 000000000..416445053 --- /dev/null +++ b/contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json @@ -0,0 +1,81 @@ +{ + "address": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "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": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "receipt": { + "to": null, + "from": "0xf1C7c037891525E360C59f708739Ac09A7670c59", + "contractAddress": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "transactionIndex": 2, + "gasUsed": "240379", + "logsBloom": "0x00000000000000000000000400000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe962e1a9d690b93ef86a8757e1d9d97537e53577738fbe29092cb9dc27bd112b", + "transactionHash": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 148194178, + "transactionHash": "0x6274653a9b2599193a56cb902e82ea9860ac9321588e6b5daa2e2d93bf0c1274", + "address": "0x09F3d00B995186D76Af9AA8627D06351d0d9f950", + "topics": [ + "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 4, + "blockHash": "0xe962e1a9d690b93ef86a8757e1d9d97537e53577738fbe29092cb9dc27bd112b" + } + ], + "blockNumber": 148194178, + "cumulativeGasUsed": "361637", + "status": 1, + "byzantium": true + }, + "args": [ + "0x56b95cD6fd660c6E631c65C0d0F62B33A093D9a4", + "0x485cc955000000000000000000000000f1c7c037891525e360c59f708739ac09a7670c590000000000000000000000004838e31e0ea315232c431598110fe677caf2d6e6" + ], + "numDeployments": 1, + "solcInputHash": "96b8e3f55478438b6784f67c1730309e", + "metadata": "{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"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\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/proxy/KlerosProxies.sol\":\"DisputeKitShutterProxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/proxy/KlerosProxies.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\n\\nimport \\\"./UUPSProxy.sol\\\";\\n\\n/// Workaround to get meaningful names for the proxy contracts\\n/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers\\n\\ncontract DisputeKitClassicNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitClassicProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitGatedProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitShutterProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeKitSybilResistantProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract DisputeTemplateRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract EvidenceModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract ForeignGatewayOnEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract HomeGatewayToEthereumProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreRulerProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract KlerosCoreProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract PolicyRegistryProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract RandomizerRNGProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleNeoProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleUniversityProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\\ncontract SortitionModuleProxy is UUPSProxy {\\n constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}\\n}\\n\",\"keccak256\":\"0x209228b56d42a8444ca70919e1ded5711fba434a746f26d426e230f57526fc6c\",\"license\":\"MIT\"},\"src/proxy/UUPSProxy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.24;\\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/// @dev Adapted from \\ncontract UUPSProxy {\\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 bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /// @dev Initializes the upgradeable proxy with an initial implementation specified by `_implementation`.\\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 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 /// @dev Delegates the current call to `implementation`.\\n /// NOTE: This function does not return to its internal call site, it will return directly to the external caller.\\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 /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.\\n /// @dev Will run if no other function in the contract matches the call data.\\n fallback() external payable {\\n _delegate(_getImplementation());\\n }\\n\\n receive() external payable {\\n _delegate(_getImplementation());\\n }\\n}\\n\",\"keccak256\":\"0xc3e0b18f846a62cc6c274680fc10014d1267885f8eefc6767292d3e174a081c0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161030238038061030283398101604081905261002f91610151565b8181817f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55805160001461010e576000826001600160a01b031682604051610077919061021f565b600060405180830381855af49150503d80600081146100b2576040519150601f19603f3d011682016040523d82523d6000602084013e6100b7565b606091505b505090508061010c5760405162461bcd60e51b815260206004820152601860248201527f50726f787920436f6e7374727563746f72206661696c65640000000000000000604482015260640160405180910390fd5b505b5050505061023b565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610148578181015183820152602001610130565b50506000910152565b6000806040838503121561016457600080fd5b82516001600160a01b038116811461017b57600080fd5b60208401519092506001600160401b038082111561019857600080fd5b818501915085601f8301126101ac57600080fd5b8151818111156101be576101be610117565b604051601f8201601f19908116603f011681019083821181831017156101e6576101e6610117565b816040528281528860208487010111156101ff57600080fd5b61021083602083016020880161012d565b80955050505050509250929050565b6000825161023181846020870161012d565b9190910192915050565b60b9806102496000396000f3fe608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122027e73125daa8b508f0a75ecdac4efb44a8712d5d43b9293019c738684adf472464736f6c63430008180033", + "deployedBytecode": "0x608060405236603757603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6060565b005b603560317f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015607e573d6000f35b3d6000fdfea264697066735822122027e73125daa8b508f0a75ecdac4efb44a8712d5d43b9293019c738684adf472464736f6c63430008180033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/package.json b/contracts/package.json index 0b4d3dd75..a1b1a8b5d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -140,7 +140,6 @@ "hardhat-gas-reporter": "^2.2.2", "hardhat-tracer": "^3.1.0", "hardhat-watcher": "^2.5.0", - "node-fetch": "^3.3.2", "pino": "^8.21.0", "pino-pretty": "^10.3.1", "prettier": "^3.3.3", @@ -157,6 +156,8 @@ "@chainlink/contracts": "^1.3.0", "@kleros/vea-contracts": "^0.6.0", "@openzeppelin/contracts": "^5.2.0", + "@shutter-network/shutter-sdk": "^0.0.1", + "isomorphic-fetch": "^3.0.0", "viem": "^2.24.1" } } diff --git a/contracts/scripts/shutter.ts b/contracts/scripts/shutter.ts new file mode 100644 index 000000000..a1c05e1c3 --- /dev/null +++ b/contracts/scripts/shutter.ts @@ -0,0 +1,267 @@ +import { encryptData, decrypt as shutterDecrypt } from "@shutter-network/shutter-sdk"; +import { Hex, stringToHex, hexToString } from "viem"; +import crypto from "crypto"; +import "isomorphic-fetch"; + +// Time in seconds to wait before the message can be decrypted +export const DECRYPTION_DELAY = 5; + +interface ShutterApiMessageData { + eon: number; + identity: string; + identity_prefix: string; + eon_key: string; + tx_hash: string; +} + +interface ShutterApiResponse { + message: ShutterApiMessageData; + error?: string; +} + +interface ShutterDecryptionKeyData { + decryption_key: string; + identity: string; + decryption_timestamp: number; +} + +/** + * Fetches encryption data from the Shutter API + * @param decryptionTimestamp Unix timestamp when decryption should be possible + * @returns Promise with the eon key and identity + */ +async function fetchShutterData(decryptionTimestamp: number): Promise { + try { + console.log(`Sending request to Shutter API with decryption timestamp: ${decryptionTimestamp}`); + + // Generate a random identity prefix + const identityPrefix = generateRandomBytes32(); + console.log(`Generated identity prefix: ${identityPrefix}`); + + const response = await fetch("https://shutter-api.shutter.network/api/register_identity", { + method: "POST", + headers: { + accept: "application/json", + "Content-Type": "application/json", + }, + body: JSON.stringify({ + decryptionTimestamp, + identityPrefix, + }), + }); + + // Log the response status + console.log(`API response status: ${response.status}`); + + // Get the response text + const responseText = await response.text(); + + if (!response.ok) { + throw new Error(`API request failed with status ${response.status}: ${responseText}`); + } + + // Parse the JSON response + let jsonResponse: ShutterApiResponse; + try { + jsonResponse = JSON.parse(responseText); + } catch (error) { + throw new Error(`Failed to parse API response as JSON: ${responseText}`); + } + + // Check if we have the message data + if (!jsonResponse.message) { + throw new Error(`API response missing message data: ${JSON.stringify(jsonResponse)}`); + } + + return jsonResponse.message; + } catch (error) { + console.error("Error fetching data from Shutter API:", error); + throw error; + } +} + +/** + * Fetches the decryption key from the Shutter API + * @param identity The identity used for encryption + * @returns Promise with the decryption key data + */ +async function fetchDecryptionKey(identity: string): Promise { + console.log(`Fetching decryption key for identity: ${identity}`); + + const response = await fetch(`https://shutter-api.shutter.network/api/get_decryption_key?identity=${identity}`, { + method: "GET", + headers: { + accept: "application/json", + }, + }); + + // Get the response text + const responseText = await response.text(); + + // Try to parse the error response even if the request failed + let jsonResponse; + try { + jsonResponse = JSON.parse(responseText); + } catch (error) { + throw new Error(`Failed to parse API response as JSON: ${responseText}`); + } + + // Handle the "too early" error case specifically + if (!response.ok) { + if (jsonResponse?.description?.includes("timestamp not reached yet")) { + throw new Error( + `Cannot decrypt yet: The decryption timestamp has not been reached.\n` + + `Please wait at least ${DECRYPTION_DELAY} seconds after encryption before attempting to decrypt.\n` + + `Error details: ${jsonResponse.description}` + ); + } + throw new Error(`API request failed with status ${response.status}: ${responseText}`); + } + + // Check if we have the message data + if (!jsonResponse.message) { + throw new Error(`API response missing message data: ${JSON.stringify(jsonResponse)}`); + } + + return jsonResponse.message; +} + +/** + * Ensures a string is a valid hex string with 0x prefix + * @param hexString The hex string to validate + * @returns The validated hex string with 0x prefix + */ +function ensureHexString(hexString: string | undefined): `0x${string}` { + if (!hexString) { + throw new Error("Hex string is undefined or null"); + } + + // Add 0x prefix if it doesn't exist + const prefixedHex = hexString.startsWith("0x") ? hexString : `0x${hexString}`; + return prefixedHex as `0x${string}`; +} + +/** + * Generates a random 32 bytes + * @returns Random 32 bytes as a hex string with 0x prefix + */ +function generateRandomBytes32(): `0x${string}` { + return ("0x" + + crypto + .getRandomValues(new Uint8Array(32)) + .reduce((acc, byte) => acc + byte.toString(16).padStart(2, "0"), "")) as Hex; +} + +/** + * Encrypts a message using the Shutter API + * @param message The message to encrypt + * @returns Promise with the encrypted commitment and identity + */ +export async function encrypt(message: string): Promise<{ encryptedCommitment: string; identity: string }> { + // Set decryption timestamp + const decryptionTimestamp = Math.floor(Date.now() / 1000) + DECRYPTION_DELAY; + + // Fetch encryption data from Shutter API + console.log(`Fetching encryption data for decryption at timestamp ${decryptionTimestamp}...`); + const shutterData = await fetchShutterData(decryptionTimestamp); + + // Extract the eon key and identity from the response and ensure they have the correct format + const eonKeyHex = ensureHexString(shutterData.eon_key); + const identityHex = ensureHexString(shutterData.identity); + + // Message to encrypt + const msgHex = stringToHex(message); + + // Generate a random sigma + const sigmaHex = generateRandomBytes32(); + + console.log("Eon Key:", eonKeyHex); + console.log("Identity:", identityHex); + console.log("Sigma:", sigmaHex); + + // Encrypt the message + const encryptedCommitment = await encryptData(msgHex, identityHex, eonKeyHex, sigmaHex); + + return { encryptedCommitment, identity: identityHex }; +} + +/** + * Decrypts a message using the Shutter API + * @param encryptedMessage The encrypted message to decrypt + * @param identity The identity used for encryption + * @returns Promise with the decrypted message + */ +export async function decrypt(encryptedMessage: string, identity: string): Promise { + // Fetch the decryption key + const decryptionKeyData = await fetchDecryptionKey(identity); + console.log("Decryption key:", decryptionKeyData.decryption_key); + + // Ensure the decryption key is properly formatted + const decryptionKey = ensureHexString(decryptionKeyData.decryption_key); + + // Decrypt the message + const decryptedHexMessage = await shutterDecrypt(encryptedMessage, decryptionKey); + + // Convert the decrypted hex message back to a string + return hexToString(decryptedHexMessage as `0x${string}`); +} + +async function main() { + try { + const command = process.argv[2]?.toLowerCase(); + + if (!command) { + console.error(` +Usage: yarn ts-node shutter.ts [arguments] + +Commands: + encrypt Encrypt a message + decrypt Decrypt a message (requires the identity used during encryption) + +Examples: + yarn ts-node shutter.ts encrypt "my secret message" + yarn ts-node shutter.ts decrypt "encrypted-data" "0x1234..."`); + process.exit(1); + } + + switch (command) { + case "encrypt": { + const message = process.argv[3]; + if (!message) { + console.error("Error: Missing message to encrypt"); + console.error("Usage: yarn ts-node shutter.ts encrypt "); + process.exit(1); + } + const { encryptedCommitment, identity } = await encrypt(message); + console.log("\nEncrypted Commitment:", encryptedCommitment); + console.log("Identity:", identity); + break; + } + case "decrypt": { + const [encryptedMessage, identity] = [process.argv[3], process.argv[4]]; + if (!encryptedMessage || !identity) { + console.error("Error: Missing required arguments for decrypt"); + console.error("Usage: yarn ts-node shutter.ts decrypt "); + console.error("Note: The identity is the one returned during encryption"); + process.exit(1); + } + const decryptedMessage = await decrypt(encryptedMessage, identity); + console.log("\nDecrypted Message:", decryptedMessage); + break; + } + default: { + console.error(`Error: Unknown command '${command}'`); + console.error("Valid commands are: encrypt, decrypt"); + process.exit(1); + } + } + } catch (error) { + console.error("\nError:", error); + process.exit(1); + } +} + +// Execute if run directly +if (require.main === module) { + main(); +} diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol index bed4958d8..5e35ab6ad 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol @@ -238,12 +238,16 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi /// `n` is the number of votes. /// @param _coreDisputeID The ID of the dispute in Kleros Core. /// @param _voteIDs The IDs of the votes. - /// @param _commit The commit. Note that justification string is a part of the commit. - function castCommit( + /// @param _commit The commitment hash. + function castCommit(uint256 _coreDisputeID, uint256[] calldata _voteIDs, bytes32 _commit) external { + _castCommit(_coreDisputeID, _voteIDs, _commit); + } + + function _castCommit( uint256 _coreDisputeID, uint256[] calldata _voteIDs, bytes32 _commit - ) external notJumped(_coreDisputeID) { + ) internal notJumped(_coreDisputeID) { (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); require(period == KlerosCoreBase.Period.commit, "The dispute should be in Commit period."); require(_commit != bytes32(0), "Empty commit."); @@ -272,7 +276,17 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi uint256 _choice, uint256 _salt, string memory _justification - ) external notJumped(_coreDisputeID) { + ) external { + _castVote(_coreDisputeID, _voteIDs, _choice, _salt, _justification); + } + + function _castVote( + uint256 _coreDisputeID, + uint256[] calldata _voteIDs, + uint256 _choice, + uint256 _salt, + string memory _justification + ) internal notJumped(_coreDisputeID) { (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); require(period == KlerosCoreBase.Period.vote, "The dispute should be in Vote period."); require(_voteIDs.length > 0, "No voteID provided"); @@ -283,13 +297,14 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi Round storage round = dispute.rounds[dispute.rounds.length - 1]; (uint96 courtID, , , , ) = core.disputes(_coreDisputeID); (, bool hiddenVotes, , , , , ) = core.courts(courtID); + bytes32 voteHash = hashVote(_choice, _salt, _justification); // Save the votes. for (uint256 i = 0; i < _voteIDs.length; i++) { require(round.votes[_voteIDs[i]].account == msg.sender, "The caller has to own the vote."); require( - !hiddenVotes || round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _salt)), - "The commit must match the choice in courts with hidden votes." + !hiddenVotes || round.votes[_voteIDs[i]].commit == voteHash, + "The vote hash must match the commitment in courts with hidden votes." ); require(!round.votes[_voteIDs[i]].voted, "Vote already cast."); round.votes[_voteIDs[i]].choice = _choice; @@ -435,6 +450,22 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi // * Public Views * // // ************************************* // + /** + * @dev Computes the hash of a vote using ABI encoding + * @dev The unused parameters may be used by overriding contracts. + * @param _choice The choice being voted for + * @param _justification The justification for the vote + * @param _salt A random salt for commitment + * @return bytes32 The hash of the encoded vote parameters + */ + function hashVote( + uint256 _choice, + uint256 _salt, + string memory _justification + ) public pure virtual returns (bytes32) { + return keccak256(abi.encodePacked(_choice, _salt)); + } + function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices) { Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; Round storage lastRound = dispute.rounds[dispute.rounds.length - 1]; diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol b/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol new file mode 100644 index 000000000..2289f0481 --- /dev/null +++ b/contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.24; + +import {DisputeKitClassicBase, KlerosCore} from "./DisputeKitClassicBase.sol"; + +/// @title DisputeKitShutter +/// 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. +/// Added functionality: an Shutter-specific event emitted when a vote is cast. +contract DisputeKitShutter is DisputeKitClassicBase { + string public constant override version = "0.9.3"; + + // ************************************* // + // * Events * // + // ************************************* // + + /// @dev Emitted when a vote is cast. + /// @param _commit The commitment hash. + /// @param _identity The Shutter identity used for encryption. + /// @param _encryptedVote The Shutter encrypted vote. + event CommitCastShutter(bytes32 indexed _commit, bytes32 _identity, bytes _encryptedVote); + + // ************************************* // + // * Constructor * // + // ************************************* // + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + /// @dev Initializer. + /// @param _governor The governor's address. + /// @param _core The KlerosCore arbitrator. + function initialize(address _governor, KlerosCore _core) external reinitializer(1) { + __DisputeKitClassicBase_initialize(_governor, _core); + } + + function initialize5() external reinitializer(5) { + // NOP + } + + // ************************ // + // * Governance * // + // ************************ // + + /// @dev Access Control to perform implementation upgrades (UUPS Proxiable) + /// Only the governor can perform upgrades (`onlyByGovernor`) + function _authorizeUpgrade(address) internal view override onlyByGovernor { + // NOP + } + + // ************************************* // + // * State Modifiers * // + // ************************************* // + + /// @dev 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. + /// @param _coreDisputeID The ID of the dispute in Kleros Core. + /// @param _voteIDs The IDs of the votes. + /// @param _commit The commitment hash including the justification. + /// @param _identity The Shutter identity used for encryption. + /// @param _encryptedVote The Shutter encrypted vote. + function castCommitShutter( + uint256 _coreDisputeID, + uint256[] calldata _voteIDs, + bytes32 _commit, + bytes32 _identity, + bytes calldata _encryptedVote + ) external notJumped(_coreDisputeID) { + _castCommit(_coreDisputeID, _voteIDs, _commit); + emit CommitCastShutter(_commit, _identity, _encryptedVote); + } + + // ************************************* // + // * Public Views * // + // ************************************* // + + /** + * @dev Computes the hash of a vote using ABI encoding + * @param _choice The choice being voted for + * @param _justification The justification for the vote + * @param _salt A random salt for commitment + * @return bytes32 The hash of the encoded vote parameters + */ + function hashVote( + uint256 _choice, + uint256 _salt, + string memory _justification + ) public pure override returns (bytes32) { + bytes32 justificationHash = keccak256(bytes(_justification)); + return keccak256(abi.encode(_choice, _salt, justificationHash)); + } +} diff --git a/contracts/src/proxy/KlerosProxies.sol b/contracts/src/proxy/KlerosProxies.sol index 2a1a9381f..6490b917b 100644 --- a/contracts/src/proxy/KlerosProxies.sol +++ b/contracts/src/proxy/KlerosProxies.sol @@ -23,6 +23,10 @@ contract DisputeKitGatedProxy is UUPSProxy { constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {} } +contract DisputeKitShutterProxy is UUPSProxy { + constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {} +} + contract DisputeKitSybilResistantProxy is UUPSProxy { constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {} } diff --git a/contracts/test/arbitration/index.ts b/contracts/test/arbitration/index.ts index fa2bc24f3..dcc7d960f 100644 --- a/contracts/test/arbitration/index.ts +++ b/contracts/test/arbitration/index.ts @@ -1,23 +1,25 @@ import { expect } from "chai"; import { deployments, ethers } from "hardhat"; -import { KlerosCore, DisputeKitClassic } from "../../typechain-types"; +import { KlerosCore, DisputeKitClassic, DisputeKitShutter } from "../../typechain-types"; import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; describe("DisputeKitClassic", async () => { // eslint-disable-next-line no-unused-vars let deployer: HardhatEthersSigner; - let core: KlerosCore, disputeKit: DisputeKitClassic; + let core: KlerosCore, disputeKit: DisputeKitClassic, disputeKitShutter: DisputeKitShutter; before("Deploying", async () => { [deployer] = await ethers.getSigners(); - [core, disputeKit] = await deployContracts(); + [core, disputeKit, disputeKitShutter] = await deployContracts(); }); it("Kleros Core initialization", async () => { const events = await core.queryFilter(core.filters.DisputeKitCreated()); - expect(events.length).to.equal(1); + expect(events.length).to.equal(2); expect(events[0].args._disputeKitID).to.equal(1); expect(events[0].args._disputeKitAddress).to.equal(disputeKit.target); + expect(events[1].args._disputeKitID).to.equal(2); + expect(events[1].args._disputeKitAddress).to.equal(disputeKitShutter.target); // Reminder: the Forking court will be added which will break these expectations. const events2 = await core.queryFilter(core.filters.CourtCreated()); @@ -60,12 +62,13 @@ describe("DisputeKitClassic", async () => { }); }); -async function deployContracts(): Promise<[KlerosCore, DisputeKitClassic]> { +async function deployContracts(): Promise<[KlerosCore, DisputeKitClassic, DisputeKitShutter]> { await deployments.fixture(["Arbitration", "VeaMock"], { fallbackToGlobal: true, keepExistingDeployments: false, }); const disputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic; + const disputeKitShutter = (await ethers.getContract("DisputeKitShutter")) as DisputeKitShutter; const core = (await ethers.getContract("KlerosCore")) as KlerosCore; - return [core, disputeKit]; + return [core, disputeKit, disputeKitShutter]; } diff --git a/contracts/test/foundry/KlerosCore.t.sol b/contracts/test/foundry/KlerosCore.t.sol index 291b969d0..16d81cbe2 100644 --- a/contracts/test/foundry/KlerosCore.t.sol +++ b/contracts/test/foundry/KlerosCore.t.sol @@ -1654,11 +1654,11 @@ contract KlerosCoreTest is Test { // Check the require with the wrong choice and then with the wrong salt vm.prank(staker1); - vm.expectRevert(bytes("The commit must match the choice in courts with hidden votes.")); + vm.expectRevert(bytes("The vote hash must match the commitment in courts with hidden votes.")); disputeKit.castVote(disputeID, voteIDs, 2, salt, "XYZ"); vm.prank(staker1); - vm.expectRevert(bytes("The commit must match the choice in courts with hidden votes.")); + vm.expectRevert(bytes("The vote hash must match the commitment in courts with hidden votes.")); disputeKit.castVote(disputeID, voteIDs, YES, salt - 1, "XYZ"); vm.prank(staker1); diff --git a/subgraph/core-neo/subgraph.template.yaml b/subgraph/core-neo/subgraph.template.yaml new file mode 100644 index 000000000..5a16083d0 --- /dev/null +++ b/subgraph/core-neo/subgraph.template.yaml @@ -0,0 +1,204 @@ +specVersion: 0.0.5 +description: Kleros v2 Core Neo +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/core-neo +schema: + file: ./schema.graphql +features: + - fullTextSearch +dataSources: + - kind: ethereum + name: KlerosCore + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: KlerosCore + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - User + - Arbitrable + - TokenAndETHShift + - JurorTokensPerCourt + - Court + - Dispute + - Round + - Draw + - DisputeKit + - Counter + abis: + - name: SortitionModule + file: ../../contracts/deployments/_PLACEHOLDER_/SortitionModuleNeo.json + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassicNeo.json + - name: KlerosCore + file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCoreNeo.json + eventHandlers: + - event: AppealDecision(indexed uint256,indexed address) + handler: handleAppealDecision + - event: DisputeCreation(indexed uint256,indexed address) + handler: handleDisputeCreation + receipt: true + - event: Draw(indexed address,indexed uint256,uint256,uint256) + handler: handleDraw + - event: NewPeriod(indexed uint256,uint8) + handler: handleNewPeriod + - event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) + handler: handleCourtCreated + - event: CourtModified(indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4]) + handler: handleCourtModified + - event: DisputeKitCreated(indexed uint256,indexed address) + handler: handleDisputeKitCreated + - event: DisputeKitEnabled(indexed uint96,indexed uint256,indexed bool) + handler: handleDisputeKitEnabled + - event: TokenAndETHShift(indexed address,indexed uint256,indexed uint256,uint256,int256,int256,address) + handler: handleTokenAndETHShift + - event: Ruling(indexed address,indexed uint256,uint256) + handler: handleRuling + - event: AcceptedFeeToken(indexed address,indexed bool) + handler: handleAcceptedFeeToken + - event: CourtJump(indexed uint256,indexed uint256,indexed uint96,uint96) + handler: handleCourtJump + file: ./src/KlerosCore.ts + - kind: ethereum + name: PolicyRegistry + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: PolicyRegistry + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Court + abis: + - name: PolicyRegistry + file: ../../contracts/deployments/_PLACEHOLDER_/PolicyRegistry.json + eventHandlers: + - event: PolicyUpdate(indexed uint256,string,string) + handler: handlePolicyUpdate + file: ./src/PolicyRegistry.ts + - kind: ethereum + name: DisputeKitClassic + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeKitClassic + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassicNeo.json + - name: KlerosCore + file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCoreNeo.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: DisputeKitShutter + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeKitShutter + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitShutter + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitShutter.json + - name: KlerosCore + # FIX: temporarily point to abi with event addition + file: ./abi-migrations/KlerosCore.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: EvidenceModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: EvidenceModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicEvidenceGroup + - ClassicEvidence + abis: + - name: EvidenceModule + file: ../../contracts/deployments/_PLACEHOLDER_/EvidenceModule.json + eventHandlers: + - event: Evidence(indexed uint256,indexed address,string) + handler: handleEvidenceEvent + file: ./src/EvidenceModule.ts + - kind: ethereum + name: SortitionModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: SortitionModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - JurorTokensPerCourt + abis: + - name: SortitionModule + file: ../../contracts/deployments/_PLACEHOLDER_/SortitionModuleNeo.json + eventHandlers: + - event: StakeDelayedAlreadyTransferredDeposited(indexed address,uint256,uint256) + handler: handleStakeDelayedAlreadyTransferredDeposited + - event: StakeDelayedAlreadyTransferredWithdrawn(indexed address,indexed uint96,uint256) + handler: handleStakeDelayedAlreadyTransferredWithdrawn + - event: StakeDelayedNotTransferred(indexed address,uint256,uint256) + handler: handleStakeDelayedNotTransferred + - event: StakeLocked(indexed address,uint256,bool) + handler: handleStakeLocked + - event: StakeSet(indexed address,uint256,uint256,uint256) + handler: handleStakeSet + file: ./src/SortitionModule.ts diff --git a/subgraph/core-neo/subgraph.yaml b/subgraph/core-neo/subgraph.yaml index b7c0ef5d2..9544b7105 100644 --- a/subgraph/core-neo/subgraph.yaml +++ b/subgraph/core-neo/subgraph.yaml @@ -1,3 +1,4 @@ +# THIS FILE IS AUTO-GENERATED BY update.sh FROM subgraph.template.yaml, ANY CHANGES WILL BE LOST. specVersion: 0.0.5 schema: file: ./schema.graphql diff --git a/subgraph/core-university/subgraph.template.yaml b/subgraph/core-university/subgraph.template.yaml new file mode 100644 index 000000000..9e83ab0ee --- /dev/null +++ b/subgraph/core-university/subgraph.template.yaml @@ -0,0 +1,162 @@ +specVersion: 0.0.5 +description: Kleros v2 Core University +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/core-university +schema: + file: ./schema.graphql +features: + - fullTextSearch +dataSources: + - kind: ethereum + name: KlerosCore + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: KlerosCore + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - User + - Arbitrable + - TokenAndETHShift + - JurorTokensPerCourt + - Court + - Dispute + - Round + - Draw + - DisputeKit + - Counter + abis: + - name: SortitionModule + file: ../../contracts/deployments/_PLACEHOLDER_/SortitionModuleUniversity.json + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassicUniversity.json + - name: KlerosCore + file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCoreUniversity.json + eventHandlers: + - event: AppealDecision(indexed uint256,indexed address) + handler: handleAppealDecision + - event: DisputeCreation(indexed uint256,indexed address) + handler: handleDisputeCreation + receipt: true + - event: Draw(indexed address,indexed uint256,uint256,uint256) + handler: handleDraw + - event: NewPeriod(indexed uint256,uint8) + handler: handleNewPeriod + - event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) + handler: handleCourtCreated + - event: CourtModified(indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4]) + handler: handleCourtModified + - event: DisputeKitCreated(indexed uint256,indexed address) + handler: handleDisputeKitCreated + - event: DisputeKitEnabled(indexed uint96,indexed uint256,indexed bool) + handler: handleDisputeKitEnabled + - event: TokenAndETHShift(indexed address,indexed uint256,indexed uint256,uint256,int256,int256,address) + handler: handleTokenAndETHShift + - event: Ruling(indexed address,indexed uint256,uint256) + handler: handleRuling + - event: AcceptedFeeToken(indexed address,indexed bool) + handler: handleAcceptedFeeToken + - event: CourtJump(indexed uint256,indexed uint256,indexed uint96,uint96) + handler: handleCourtJump + file: ./src/KlerosCore.ts + - kind: ethereum + name: PolicyRegistry + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: PolicyRegistry + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Court + abis: + - name: PolicyRegistry + file: ../../contracts/deployments/_PLACEHOLDER_/PolicyRegistry.json + eventHandlers: + - event: PolicyUpdate(indexed uint256,string,string) + handler: handlePolicyUpdate + file: ./src/PolicyRegistry.ts + - kind: ethereum + name: DisputeKitClassic + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeKitClassic + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassicUniversity.json + - name: KlerosCore + file: ../../contracts/deployments/_PLACEHOLDER_/KlerosCoreUniversity.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: EvidenceModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: EvidenceModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicEvidenceGroup + - ClassicEvidence + abis: + - name: EvidenceModule + file: ../../contracts/deployments/_PLACEHOLDER_/EvidenceModule.json + eventHandlers: + - event: Evidence(indexed uint256,indexed address,string) + handler: handleEvidenceEvent + file: ./src/EvidenceModule.ts + - kind: ethereum + name: SortitionModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: SortitionModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - JurorTokensPerCourt + abis: + - name: SortitionModule + file: ../../contracts/deployments/_PLACEHOLDER_/SortitionModuleUniversity.json + eventHandlers: + - event: StakeLocked(indexed address,uint256,bool) + handler: handleStakeLocked + - event: StakeSet(indexed address,uint256,uint256,uint256) + handler: handleStakeSet + file: ./src/SortitionModule.ts diff --git a/subgraph/core-university/subgraph.yaml b/subgraph/core-university/subgraph.yaml index a0398c2f8..d820954c8 100644 --- a/subgraph/core-university/subgraph.yaml +++ b/subgraph/core-university/subgraph.yaml @@ -1,3 +1,4 @@ +# THIS FILE IS AUTO-GENERATED BY update.sh FROM subgraph.template.yaml, ANY CHANGES WILL BE LOST. specVersion: 0.0.5 schema: file: ./schema.graphql @@ -64,9 +65,9 @@ dataSources: name: PolicyRegistry network: arbitrum-sepolia source: - address: "0x2AC2EdFD336732bc6963f1AD03ED98B22dB949da" + address: "0x31d067405184d7FaA64b0834511cBcFAF32CdC4b" abi: PolicyRegistry - startBlock: 3084568 + startBlock: 141215158 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -119,9 +120,9 @@ dataSources: name: EvidenceModule network: arbitrum-sepolia source: - address: "0x57fd453FB0d16f8ca174E7386102D7170E17Be09" + address: "0x990f44d19a5F46889801B31bf58e0536fBECf27C" abi: EvidenceModule - startBlock: 3638735 + startBlock: 141215177 mapping: kind: ethereum/events apiVersion: 0.0.7 diff --git a/subgraph/core/src/DisputeKitClassic.ts b/subgraph/core/src/DisputeKitClassic.ts index c58147bf1..2b6e8b2c5 100644 --- a/subgraph/core/src/DisputeKitClassic.ts +++ b/subgraph/core/src/DisputeKitClassic.ts @@ -9,7 +9,7 @@ import { CommitCast, } from "../generated/DisputeKitClassic/DisputeKitClassic"; import { KlerosCore } from "../generated/KlerosCore/KlerosCore"; -import { ClassicDispute, ClassicJustification, ClassicRound, ClassicVote, Dispute } from "../generated/schema"; +import { ClassicDispute, ClassicJustification, ClassicRound, ClassicVote, Dispute, Round } from "../generated/schema"; import { ensureClassicContributionFromEvent } from "./entities/ClassicContribution"; import { createClassicDisputeFromEvent } from "./entities/ClassicDispute"; import { @@ -19,23 +19,36 @@ import { updateCountsAndGetCurrentRuling, } from "./entities/ClassicRound"; import { ensureClassicVote } from "./entities/ClassicVote"; -import { ONE, ZERO } from "./utils"; - -export const DISPUTEKIT_ID = "1"; +import { ONE, extractDisputeKitIDFromExtraData } from "./utils"; export function handleDisputeCreation(event: DisputeCreation): void { const disputeID = event.params._coreDisputeID.toString(); - createClassicDisputeFromEvent(event); - const numberOfChoices = event.params._numberOfChoices; - createClassicRound(disputeID, numberOfChoices, ZERO); + const disputeKitID = extractDisputeKitIDFromExtraData(event.params._extraData); + + const disputeKitClassic = DisputeKitClassic.bind(event.address); + const klerosCore = KlerosCore.bind(disputeKitClassic.core()); + const totalRounds = klerosCore.getNumberOfRounds(event.params._coreDisputeID); + const newRoundIndex = totalRounds.minus(ONE); + + createClassicDisputeFromEvent(event, disputeKitID, newRoundIndex); + createClassicRound(disputeID, event.params._numberOfChoices, newRoundIndex, disputeKitID); } export function handleCommitCast(event: CommitCast): void { - const coreDisputeID = event.params._coreDisputeID; - const coreDispute = Dispute.load(coreDisputeID.toString()); - const classicDisputeID = `${DISPUTEKIT_ID}-${coreDisputeID}`; + const coreDisputeID = event.params._coreDisputeID.toString(); + const coreDispute = Dispute.load(coreDisputeID); + if (!coreDispute) return; + + const coreCurrentRound = Round.load(coreDispute.currentRound); + if (!coreCurrentRound) return; + + const disputeKitID = coreCurrentRound.disputeKit; + + const classicDisputeID = `${disputeKitID}-${coreDisputeID}`; + const classicDispute = ClassicDispute.load(classicDisputeID); - if (!classicDispute || !coreDispute) return; + if (!classicDispute) return; + const currentLocalRoundID = classicDispute.id + "-" + classicDispute.currentLocalRoundIndex.toString(); const voteIDs = event.params._voteIDs; for (let i = 0; i < voteIDs.length; i++) { @@ -55,9 +68,18 @@ export function handleVoteCast(event: VoteCast): void { const juror = event.params._juror.toHexString(); const coreDisputeID = event.params._coreDisputeID.toString(); const coreDispute = Dispute.load(coreDisputeID); - const classicDisputeID = `${DISPUTEKIT_ID}-${coreDisputeID}`; + if (!coreDispute) return; + + const coreCurrentRound = Round.load(coreDispute.currentRound); + if (!coreCurrentRound) return; + + const disputeKitID = coreCurrentRound.disputeKit; + + const classicDisputeID = `${disputeKitID}-${coreDisputeID}`; + const classicDispute = ClassicDispute.load(classicDisputeID); - if (!classicDispute || !coreDispute) return; + if (!classicDispute) return; + const choice = event.params._choice; const currentLocalRoundID = classicDispute.id + "-" + classicDispute.currentLocalRoundIndex.toString(); const voteIDs = event.params._voteIDs; @@ -70,6 +92,7 @@ export function handleVoteCast(event: VoteCast): void { justification.transactionHash = event.transaction.hash.toHexString(); justification.timestamp = event.block.timestamp; justification.save(); + const currentRulingInfo = updateCountsAndGetCurrentRuling( currentLocalRoundID, choice, @@ -78,6 +101,7 @@ export function handleVoteCast(event: VoteCast): void { coreDispute.currentRuling = currentRulingInfo.ruling; coreDispute.tied = currentRulingInfo.tied; coreDispute.save(); + let classicVote: ClassicVote; for (let i = 0; i < voteIDs.length; i++) { classicVote = ensureClassicVote(currentLocalRoundID, juror, voteIDs[i], coreDispute); @@ -97,7 +121,16 @@ export function handleChoiceFunded(event: ChoiceFunded): void { const coreDisputeID = event.params._coreDisputeID.toString(); const coreRoundIndex = event.params._coreRoundID.toString(); const choice = event.params._choice; - const roundID = `${DISPUTEKIT_ID}-${coreDisputeID}-${coreRoundIndex}`; + + const coreDispute = Dispute.load(coreDisputeID); + if (!coreDispute) return; + + const roundId = `${coreDisputeID}-${coreRoundIndex}`; + const coreRound = Round.load(roundId); + if (!coreRound) return; + const disputeKitID = coreRound.disputeKit; + + const roundID = `${disputeKitID}-${coreDisputeID}-${coreRoundIndex}`; const localRound = ClassicRound.load(roundID); if (!localRound) return; @@ -123,13 +156,18 @@ export function handleChoiceFunded(event: ChoiceFunded): void { localRound.feeRewards = localRound.feeRewards.minus(appealCost); - const localDispute = ClassicDispute.load(`${DISPUTEKIT_ID}-${coreDisputeID}`); + const newDisputeKitID = roundInfo.disputeKitID; + + const localDispute = ClassicDispute.load(`${disputeKitID}-${coreDisputeID}`); if (!localDispute) return; - const newRoundIndex = localDispute.currentLocalRoundIndex.plus(ONE); - const numberOfChoices = localDispute.numberOfChoices; - localDispute.currentLocalRoundIndex = newRoundIndex; - localDispute.save(); - createClassicRound(coreDisputeID, numberOfChoices, newRoundIndex); + + if (BigInt.fromString(disputeKitID).equals(newDisputeKitID)) { + const newRoundIndex = localDispute.currentLocalRoundIndex.plus(ONE); + const numberOfChoices = localDispute.numberOfChoices; + localDispute.currentLocalRoundIndex = newRoundIndex; + localDispute.save(); + createClassicRound(coreDisputeID, numberOfChoices, newRoundIndex, disputeKitID); + } } localRound.save(); @@ -144,7 +182,16 @@ export function handleWithdrawal(event: Withdrawal): void { // check if all appeal fees have been withdrawn const coreDisputeID = event.params._coreDisputeID.toString(); const coreRoundIndex = event.params._coreRoundID.toString(); - const roundID = `${DISPUTEKIT_ID}-${coreDisputeID}-${coreRoundIndex}`; + + const coreDispute = Dispute.load(coreDisputeID); + if (!coreDispute) return; + + const roundId = `${coreDisputeID}-${coreRoundIndex}`; + const coreRound = Round.load(roundId); + if (!coreRound) return; + const disputeKitID = coreRound.disputeKit; + + const roundID = `${disputeKitID}-${coreDisputeID}-${coreRoundIndex}`; const localRound = ClassicRound.load(roundID); if (!localRound) return; diff --git a/subgraph/core/src/KlerosCore.ts b/subgraph/core/src/KlerosCore.ts index 42a54644f..18e9cb45e 100644 --- a/subgraph/core/src/KlerosCore.ts +++ b/subgraph/core/src/KlerosCore.ts @@ -156,7 +156,7 @@ export function handleNewPeriod(event: NewPeriod): void { updateTotalLeaderboardJurors(ONE, event.block.timestamp); } - // Since this is a ClassicVote entity, this will only work for the Classic DisputeKit (which has ID "1"). + // Since this is a ClassicVote entity, this will only work for the ClassicDisputeKit and ShutterDisputeKit. const vote = ClassicVote.load(`${round.disputeKit}-${draw.id}`); if (!vote) { diff --git a/subgraph/core/src/entities/ClassicContribution.ts b/subgraph/core/src/entities/ClassicContribution.ts index c9d11211f..0473d0f39 100644 --- a/subgraph/core/src/entities/ClassicContribution.ts +++ b/subgraph/core/src/entities/ClassicContribution.ts @@ -1,13 +1,23 @@ -import { ClassicContribution } from "../../generated/schema"; +import { ClassicContribution, Dispute, DisputeKit, Round } from "../../generated/schema"; import { Contribution as ContributionEvent, Withdrawal } from "../../generated/DisputeKitClassic/DisputeKitClassic"; -import { DISPUTEKIT_ID } from "../DisputeKitClassic"; import { ensureUser } from "./User"; export function ensureClassicContributionFromEvent(event: T): ClassicContribution | null { if (!(event instanceof ContributionEvent) && !(event instanceof Withdrawal)) return null; const coreDisputeID = event.params._coreDisputeID.toString(); const coreRoundIndex = event.params._coreRoundID.toString(); - const roundID = `${DISPUTEKIT_ID}-${coreDisputeID}-${coreRoundIndex}`; + + const coreDispute = Dispute.load(coreDisputeID); + if (!coreDispute) return null; + + const roundId = `${coreDisputeID}-${coreRoundIndex}`; + const coreRound = Round.load(roundId); + if (!coreRound) return null; + + const disputeKitID = coreRound.disputeKit; + + const roundID = `${disputeKitID}-${coreDisputeID}-${coreRoundIndex}`; + ensureUser(event.params._contributor.toHexString()); const contributor = event.params._contributor.toHexString(); const choice = event.params._choice; diff --git a/subgraph/core/src/entities/ClassicDispute.ts b/subgraph/core/src/entities/ClassicDispute.ts index bc0604517..dfdd24532 100644 --- a/subgraph/core/src/entities/ClassicDispute.ts +++ b/subgraph/core/src/entities/ClassicDispute.ts @@ -1,12 +1,12 @@ +import { BigInt } from "@graphprotocol/graph-ts"; import { DisputeCreation } from "../../generated/DisputeKitClassic/DisputeKitClassic"; import { ClassicDispute } from "../../generated/schema"; -import { ZERO } from "../utils"; -export function createClassicDisputeFromEvent(event: DisputeCreation): void { +export function createClassicDisputeFromEvent(event: DisputeCreation, disputeKitID: string, roundIndex: BigInt): void { const coreDisputeID = event.params._coreDisputeID.toString(); - const classicDispute = new ClassicDispute(`1-${coreDisputeID}`); + const classicDispute = new ClassicDispute(`${disputeKitID}-${coreDisputeID}`); classicDispute.coreDispute = coreDisputeID; - classicDispute.currentLocalRoundIndex = ZERO; + classicDispute.currentLocalRoundIndex = roundIndex; classicDispute.numberOfChoices = event.params._numberOfChoices; classicDispute.extraData = event.params._extraData; classicDispute.timestamp = event.block.timestamp; diff --git a/subgraph/core/src/entities/ClassicRound.ts b/subgraph/core/src/entities/ClassicRound.ts index 86dc57491..57862a347 100644 --- a/subgraph/core/src/entities/ClassicRound.ts +++ b/subgraph/core/src/entities/ClassicRound.ts @@ -1,10 +1,15 @@ import { BigInt } from "@graphprotocol/graph-ts"; import { Contribution } from "../../generated/DisputeKitClassic/DisputeKitClassic"; -import { Answer, ClassicRound } from "../../generated/schema"; +import { Answer, ClassicRound, Dispute, Round } from "../../generated/schema"; import { ZERO } from "../utils"; -export function createClassicRound(disputeID: string, numberOfChoices: BigInt, roundIndex: BigInt): void { - const localDisputeID = `1-${disputeID}`; +export function createClassicRound( + disputeID: string, + numberOfChoices: BigInt, + roundIndex: BigInt, + disputeKitID: string +): void { + const localDisputeID = `${disputeKitID}-${disputeID}`; const id = `${localDisputeID}-${roundIndex.toString()}`; const classicRound = new ClassicRound(id); classicRound.localDispute = localDisputeID; @@ -67,9 +72,16 @@ export function updateCountsAndGetCurrentRuling(id: string, choice: BigInt, delt } export function updateChoiceFundingFromContributionEvent(event: Contribution): void { - const disputeKitID = "1"; const coreDisputeID = event.params._coreDisputeID.toString(); const coreRoundIndex = event.params._coreRoundID.toString(); + const coreDispute = Dispute.load(coreDisputeID); + if (!coreDispute) return; + + const roundId = `${coreDisputeID}-${coreRoundIndex}`; + const coreRound = Round.load(roundId); + if (!coreRound) return; + const disputeKitID = coreRound.disputeKit; + const roundID = `${disputeKitID}-${coreDisputeID}-${coreRoundIndex}`; const classicRound = ClassicRound.load(roundID); diff --git a/subgraph/core/src/utils.ts b/subgraph/core/src/utils.ts index 73b2f99dc..78d2abaa4 100644 --- a/subgraph/core/src/utils.ts +++ b/subgraph/core/src/utils.ts @@ -1,4 +1,10 @@ -import { BigInt } from "@graphprotocol/graph-ts"; +import { BigInt, Bytes } from "@graphprotocol/graph-ts"; export const ZERO = BigInt.fromI32(0); export const ONE = BigInt.fromI32(1); + +export function extractDisputeKitIDFromExtraData(extraData: Bytes): string { + const start = extraData.length - 32; + const littleEndian = extraData.subarray(start, extraData.length).reverse(); + return BigInt.fromUnsignedBytes(Bytes.fromUint8Array(littleEndian)).toString(); +} diff --git a/subgraph/core/subgraph.template.yaml b/subgraph/core/subgraph.template.yaml new file mode 100644 index 000000000..e9373e727 --- /dev/null +++ b/subgraph/core/subgraph.template.yaml @@ -0,0 +1,218 @@ +specVersion: 0.0.5 +description: Kleros v2 Core +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/core +schema: + file: ./schema.graphql +features: + - fullTextSearch +dataSources: + - kind: ethereum + name: KlerosCore + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: KlerosCore + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - User + - Arbitrable + - TokenAndETHShift + - JurorTokensPerCourt + - Court + - Dispute + - Round + - Draw + - DisputeKit + - Counter + abis: + - name: SortitionModule + file: ../../contracts/deployments/_PLACEHOLDER_/SortitionModule.json + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassic.json + - name: KlerosCore + # FIX: temporarily point to the abi with event addition. + file: ./abi-migrations/KlerosCore.json + eventHandlers: + - event: AppealDecision(indexed uint256,indexed address) + handler: handleAppealDecision + - event: DisputeCreation(indexed uint256,indexed address) + handler: handleDisputeCreation + receipt: true + - event: Draw(indexed address,indexed uint256,uint256,uint256) + handler: handleDraw + - event: NewPeriod(indexed uint256,uint8) + handler: handleNewPeriod + - event: CourtCreated(indexed uint96,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) + handler: handleCourtCreated + # FIX: This is support for old signature + - event: CourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256[]) + handler: handleCourtCreated + - event: CourtModified(indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4]) + handler: handleCourtModified + - event: DisputeKitCreated(indexed uint256,indexed address) + handler: handleDisputeKitCreated + - event: DisputeKitEnabled(indexed uint96,indexed uint256,indexed bool) + handler: handleDisputeKitEnabled + - event: TokenAndETHShift(indexed address,indexed uint256,indexed uint256,uint256,int256,int256,address) + handler: handleTokenAndETHShift + - event: Ruling(indexed address,indexed uint256,uint256) + handler: handleRuling + - event: AcceptedFeeToken(indexed address,indexed bool) + handler: handleAcceptedFeeToken + - event: CourtJump(indexed uint256,indexed uint256,indexed uint96,uint96) + handler: handleCourtJump + file: ./src/KlerosCore.ts + - kind: ethereum + name: PolicyRegistry + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: PolicyRegistry + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Court + abis: + - name: PolicyRegistry + file: ../../contracts/deployments/_PLACEHOLDER_/PolicyRegistry.json + eventHandlers: + - event: PolicyUpdate(indexed uint256,string,string) + handler: handlePolicyUpdate + file: ./src/PolicyRegistry.ts + - kind: ethereum + name: DisputeKitClassic + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeKitClassic + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitClassic + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassic.json + - name: KlerosCore + # FIX: temporarily point to abi with event addition + file: ./abi-migrations/KlerosCore.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: DisputeKitShutter + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeKitShutter + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitShutter + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitShutter.json + - name: DisputeKitClassic # Required on Alchemy + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeKitClassic.json + - name: KlerosCore + # FIX: temporarily point to abi with event addition + file: ./abi-migrations/KlerosCore.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: EvidenceModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: EvidenceModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicEvidenceGroup + - ClassicEvidence + abis: + - name: EvidenceModule + file: ../../contracts/deployments/_PLACEHOLDER_/EvidenceModule.json + eventHandlers: + - event: Evidence(indexed uint256,indexed address,string) + handler: handleEvidenceEvent + file: ./src/EvidenceModule.ts + - kind: ethereum + name: SortitionModule + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: SortitionModule + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - JurorTokensPerCourt + abis: + - name: SortitionModule + # FIX: temporarily point to abi with event addition + file: ./abi-migrations/SortitionModule.json + eventHandlers: + - event: StakeDelayedAlreadyTransferredDeposited(indexed address,uint256,uint256) + handler: handleStakeDelayedAlreadyTransferredDeposited + # FIX: temporarily indexing old event name + - event: StakeDelayedAlreadyTransferred(indexed address,uint256,uint256) + handler: handleStakeDelayedAlreadyTransferred + - event: StakeDelayedAlreadyTransferredWithdrawn(indexed address,indexed uint96,uint256) + handler: handleStakeDelayedAlreadyTransferredWithdrawn + - event: StakeDelayedNotTransferred(indexed address,uint256,uint256) + handler: handleStakeDelayedNotTransferred + - event: StakeLocked(indexed address,uint256,bool) + handler: handleStakeLocked + - event: StakeSet(indexed address,uint256,uint256,uint256) + handler: handleStakeSet + # FIX: old stake set signature + - event: StakeSet(indexed address,uint256,uint256) + handler: handleStakeSet + file: ./src/SortitionModule.ts diff --git a/subgraph/core/subgraph.yaml b/subgraph/core/subgraph.yaml index d3aff9873..1a758b234 100644 --- a/subgraph/core/subgraph.yaml +++ b/subgraph/core/subgraph.yaml @@ -1,4 +1,7 @@ +# THIS FILE IS AUTO-GENERATED BY update.sh FROM subgraph.template.yaml, ANY CHANGES WILL BE LOST. specVersion: 0.0.5 +description: Kleros v2 Core +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/core schema: file: ./schema.graphql features: @@ -120,6 +123,44 @@ dataSources: - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) handler: handleCommitCast file: ./src/DisputeKitClassic.ts + - kind: ethereum + name: DisputeKitShutter + network: arbitrum-sepolia + source: + address: "0x09F3d00B995186D76Af9AA8627D06351d0d9f950" + abi: DisputeKitShutter + startBlock: 148194178 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicContribution + abis: + - name: DisputeKitShutter + file: ../../contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json + - name: DisputeKitClassic # Required on Alchemy + file: ../../contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json + - name: KlerosCore + # FIX: temporarily point to abi with event addition + file: ./abi-migrations/KlerosCore.json + eventHandlers: + - event: DisputeCreation(indexed uint256,uint256,bytes) + handler: handleDisputeCreation + - event: Contribution(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleContributionEvent + - event: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal + - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) + handler: handleChoiceFunded + - event: VoteCast(indexed uint256,indexed address,uint256[],indexed uint256,string) + handler: handleVoteCast + - event: CommitCast(indexed uint256,indexed address,uint256[],bytes32) + handler: handleCommitCast + file: ./src/DisputeKitClassic.ts - kind: ethereum name: EvidenceModule network: arbitrum-sepolia diff --git a/subgraph/dispute-template-registry/subgraph.template.yaml b/subgraph/dispute-template-registry/subgraph.template.yaml new file mode 100644 index 000000000..b45f5c1f7 --- /dev/null +++ b/subgraph/dispute-template-registry/subgraph.template.yaml @@ -0,0 +1,26 @@ +specVersion: 0.0.5 +description: Kleros v2 Dispute Template Registry +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/dispute-template-registry +schema: + file: schema.graphql +dataSources: + - kind: ethereum + name: DisputeTemplateRegistry + network: _PLACEHOLDER_ + source: + address: "_PLACEHOLDER_" + abi: DisputeTemplateRegistry + startBlock: _PLACEHOLDER_ + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DisputeTemplate + abis: + - name: DisputeTemplateRegistry + file: ../../contracts/deployments/_PLACEHOLDER_/DisputeTemplateRegistry.json + eventHandlers: + - event: DisputeTemplate(indexed uint256,indexed string,string,string) + handler: handleDisputeTemplate + file: src/DisputeTemplateRegistry.ts diff --git a/subgraph/dispute-template-registry/subgraph.yaml b/subgraph/dispute-template-registry/subgraph.yaml index 1fdfc46b6..4186d81c9 100644 --- a/subgraph/dispute-template-registry/subgraph.yaml +++ b/subgraph/dispute-template-registry/subgraph.yaml @@ -1,4 +1,7 @@ +# THIS FILE IS AUTO-GENERATED BY update.sh FROM subgraph.template.yaml, ANY CHANGES WILL BE LOST. specVersion: 0.0.5 +description: Kleros v2 Dispute Template Registry +repository: https://github.com/kleros/kleros-v2/tree/dev/subgraph/dispute-template-registry schema: file: schema.graphql dataSources: diff --git a/subgraph/package.json b/subgraph/package.json index 0a125ee5e..6b9ebb2cb 100644 --- a/subgraph/package.json +++ b/subgraph/package.json @@ -1,7 +1,7 @@ { "name": "@kleros/kleros-v2-subgraph", - "version": "0.15.2", - "drtVersion": "0.12.0", + "version": "0.16.3", + "drtVersion": "0.12.2", "license": "MIT", "scripts": { "update:core:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia core/subgraph.yaml", diff --git a/subgraph/scripts/all.sh b/subgraph/scripts/all.sh index 0902ec6f4..3c2b5269b 100755 --- a/subgraph/scripts/all.sh +++ b/subgraph/scripts/all.sh @@ -10,7 +10,7 @@ then exit 1 fi -for subgraph in core drt +for subgraph in core core-neo core-university drt do echo "Running for ${cmdPrefix}:${subgraph}${cmdPostfix:+:}${cmdPostfix}" yarn "${cmdPrefix}:${subgraph}${cmdPostfix:+:}${cmdPostfix}" diff --git a/subgraph/scripts/update.sh b/subgraph/scripts/update.sh index d1223e3ff..3459d30d9 100755 --- a/subgraph/scripts/update.sh +++ b/subgraph/scripts/update.sh @@ -1,9 +1,26 @@ #!/usr/bin/env bash -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -function update() #hardhatNetwork #graphNetwork #subgraphConfig #dataSourceIndex #contract -{ +function isContractDeployed() { #hardhatNetwork #graphNetwork #subgraphConfig #dataSourceIndex #contract + local hardhatNetwork="$1" + local graphNetwork="$2" + local subgraphConfig="$3" + local dataSourceIndex="$4" + local dataSourceName="$5" + + # Get the deployment artifact + local contractName=$(basename $(yq '.dataSources['$dataSourceIndex'].mapping.abis[] | select(.name == "'$dataSourceName'") | .file' "$subgraphConfig") .json) + local artifact="$SCRIPT_DIR/../../contracts/deployments/$hardhatNetwork/$contractName.json" + + if [ -f "$artifact" ]; then + return 0 # success in bash + else + return 1 # failure in bash + fi +} + +function update() { #hardhatNetwork #graphNetwork #subgraphConfig #dataSourceIndex #contract local hardhatNetwork="$1" local graphNetwork="$2" local subgraphConfig="$3" @@ -25,15 +42,14 @@ function update() #hardhatNetwork #graphNetwork #subgraphConfig #dataSourceIndex yq -i ".dataSources[$dataSourceIndex].source.startBlock=$blockNumber" "$subgraphConfig" # Set the Graph network - graphNetwork=$graphNetwork yq -i ".dataSources[$dataSourceIndex].network=env(graphNetwork)" "$subgraphConfig" + graphNetwork=$graphNetwork yq -i ".dataSources[$dataSourceIndex].network=env(graphNetwork)" "$subgraphConfig" # Set the ABIs path for this Hardhat network local abiIndex=0 - for f in $(yq e .dataSources[$dataSourceIndex].mapping.abis[].file "$subgraphConfig" -o json -I 0 | jq -sr '.[]') - do + for f in $(yq e .dataSources[$dataSourceIndex].mapping.abis[].file "$subgraphConfig" -o json -I 0 | jq -sr '.[]'); do f2=$(echo $f | sed "s|\(.*\/deployments\/\).*\/|\1$hardhatNetwork\/|") yq -i ".dataSources[$dataSourceIndex].mapping.abis[$abiIndex].file=\"$f2\"" "$subgraphConfig" - (( ++abiIndex )) + ((++abiIndex)) done } @@ -49,9 +65,31 @@ echo "Updating $subgraphConfig" # backup cp "$subgraphConfig" "$subgraphConfig.bak.$(date +%s)" +# initialize from template +template="${subgraphConfig%.yaml}.template.yaml" +echo '# THIS FILE IS AUTO-GENERATED BY update.sh FROM subgraph.template.yaml, ANY CHANGES WILL BE LOST.' > "$subgraphConfig" +cat "$template" >>"$subgraphConfig" + +# find contracts that are not deployed +notDeployedSourceIndices=() +i=0 +for contract in $(yq .dataSources[].name "$subgraphConfig"); do + if ! isContractDeployed $hardhatNetwork $graphNetwork "$subgraphConfig" $i $contract; then + echo -e "\e[1;31mContract $contract is not deployed\e[0m" + notDeployedSourceIndices+=($i) + fi + ((++i)) +done + +# delete the data sources for the contracts that are not deployed +for i in "${notDeployedSourceIndices[@]}"; do + echo -e "\e[1;31mDeleting data source $i\e[0m" + yq -i 'del(.dataSources['$i'])' "$subgraphConfig" +done + +# update the data sources i=0 -for contract in $(yq .dataSources[].name "$subgraphConfig") -do +for contract in $(yq .dataSources[].name "$subgraphConfig"); do update $hardhatNetwork $graphNetwork "$subgraphConfig" $i $contract - (( ++i )) + ((++i)) done diff --git a/yarn.lock b/yarn.lock index e613461d6..c38896dd1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5560,6 +5560,7 @@ __metadata: "@nomiclabs/hardhat-solhint": "npm:^4.0.1" "@openzeppelin/contracts": "npm:^5.2.0" "@openzeppelin/upgrades-core": "npm:^1.42.2" + "@shutter-network/shutter-sdk": "npm:^0.0.1" "@typechain/ethers-v6": "npm:^0.5.1" "@typechain/hardhat": "npm:^9.1.0" "@types/chai": "npm:^4.3.20" @@ -5585,7 +5586,7 @@ __metadata: hardhat-gas-reporter: "npm:^2.2.2" hardhat-tracer: "npm:^3.1.0" hardhat-watcher: "npm:^2.5.0" - node-fetch: "npm:^3.3.2" + isomorphic-fetch: "npm:^3.0.0" pino: "npm:^8.21.0" pino-pretty: "npm:^10.3.1" prettier: "npm:^3.3.3" @@ -6888,6 +6889,15 @@ __metadata: languageName: node linkType: hard +"@noble/curves@npm:1.8.2": + version: 1.8.2 + resolution: "@noble/curves@npm:1.8.2" + dependencies: + "@noble/hashes": "npm:1.7.2" + checksum: 10/540e7b7a8fe92ecd5cef846f84d07180662eb7fd7d8e9172b8960c31827e74f148fe4630da962138a6be093ae9f8992d14ab23d3682a2cc32be839aa57c03a46 + languageName: node + linkType: hard + "@noble/curves@npm:^1.7.0": version: 1.7.0 resolution: "@noble/curves@npm:1.7.0" @@ -6946,6 +6956,13 @@ __metadata: languageName: node linkType: hard +"@noble/hashes@npm:1.7.2": + version: 1.7.2 + resolution: "@noble/hashes@npm:1.7.2" + checksum: 10/b5af9e4b91543dcc46a811b5b2c57bfdeb41728361979a19d6110a743e2cb0459872553f68d3a46326d21959964db2776b8c8b4db85ac1d9f63ebcaddf7d59b6 + languageName: node + linkType: hard + "@noble/hashes@npm:^1.6.1": version: 1.6.1 resolution: "@noble/hashes@npm:1.6.1" @@ -8561,6 +8578,17 @@ __metadata: languageName: node linkType: hard +"@shutter-network/shutter-sdk@npm:^0.0.1": + version: 0.0.1 + resolution: "@shutter-network/shutter-sdk@npm:0.0.1" + dependencies: + browser-or-node: "npm:^3.0.0" + lodash: "npm:^4.17.21" + viem: "npm:^2.23.2" + checksum: 10/5e021c9dc27cb88dd487e1a289501394302d88fe349a873525610405eb2b351563556b1d0ef2ac789cff99b03ba6019c0a9761a093a0aef5a82941986ca58517 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.24.1": version: 0.24.51 resolution: "@sinclair/typebox@npm:0.24.51" @@ -12998,6 +13026,13 @@ __metadata: languageName: node linkType: hard +"browser-or-node@npm:^3.0.0": + version: 3.0.0 + resolution: "browser-or-node@npm:3.0.0" + checksum: 10/51d74cc5d0139da3d37e83ff3906fcca20d02c42aa8b81a48d9ea01806f36df1a4b55006670071b1d7423967777275920054ec8b723410534b580b0232c5093d + languageName: node + linkType: hard + "browser-process-hrtime@npm:^1.0.0": version: 1.0.0 resolution: "browser-process-hrtime@npm:1.0.0" @@ -21191,6 +21226,16 @@ __metadata: languageName: node linkType: hard +"isomorphic-fetch@npm:^3.0.0": + version: 3.0.0 + resolution: "isomorphic-fetch@npm:3.0.0" + dependencies: + node-fetch: "npm:^2.6.1" + whatwg-fetch: "npm:^3.4.1" + checksum: 10/568fe0307528c63405c44dd3873b7b6c96c0d19ff795cb15846e728b6823bdbc68cc8c97ac23324509661316f12f551e43dac2929bc7030b8bc4d6aa1158b857 + languageName: node + linkType: hard + "isomorphic-timers-promises@npm:^1.0.1": version: 1.0.1 resolution: "isomorphic-timers-promises@npm:1.0.1" @@ -33432,6 +33477,27 @@ __metadata: languageName: node linkType: hard +"viem@npm:^2.23.2": + version: 2.29.2 + resolution: "viem@npm:2.29.2" + dependencies: + "@noble/curves": "npm:1.8.2" + "@noble/hashes": "npm:1.7.2" + "@scure/bip32": "npm:1.6.2" + "@scure/bip39": "npm:1.5.4" + abitype: "npm:1.0.8" + isows: "npm:1.0.6" + ox: "npm:0.6.9" + ws: "npm:8.18.1" + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/deaddf43517beb44d1f17b6229a8c2a323f99533f27319e8176de071549aa9e6247c68ed915fb0f69bb84e2e85e880f17efc4564f7f23adb34c78f90b56c2c9c + languageName: node + linkType: hard + "vite-node@npm:1.6.1": version: 1.6.1 resolution: "vite-node@npm:1.6.1" @@ -34161,6 +34227,13 @@ __metadata: languageName: node linkType: hard +"whatwg-fetch@npm:^3.4.1": + version: 3.6.20 + resolution: "whatwg-fetch@npm:3.6.20" + checksum: 10/2b4ed92acd6a7ad4f626a6cb18b14ec982bbcaf1093e6fe903b131a9c6decd14d7f9c9ca3532663c2759d1bdf01d004c77a0adfb2716a5105465c20755a8c57c + languageName: node + linkType: hard + "whatwg-fetch@npm:^3.6.2": version: 3.6.2 resolution: "whatwg-fetch@npm:3.6.2"