diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9253ebfad..66950638d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -46,6 +46,7 @@ jobs: disable-sudo: true egress-policy: block allowed-endpoints: > + objects.githubusercontent.com:443 uploads.github.com:443 api.github.com:443 github.com:443 diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml new file mode 100644 index 000000000..07df78e92 --- /dev/null +++ b/.github/workflows/sentry-release.yml @@ -0,0 +1,47 @@ +name: Sentry Release + +on: + workflow_dispatch: + push: + branches: + - master + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + release: + runs-on: ubuntu-latest + environment: Master + outputs: + version: ${{ steps.set-version.outputs.version }} + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: Install dependencies + run: yarn workspace @kleros/kleros-v2-web install + + - name: Build and deploy subgraph + run: yarn @kleros/kleros-v2-web build + + - name: Set version + id: set-version + run: echo "version=v$(cat package.json | jq -r .version)-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + working-directory: web + + - name: Create Sentry release + uses: getsentry/action-release@v1.2.1 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + with: + environment: production + version: ${{ steps.set-version.outputs.version }} + sourcemaps: ./web/dist + diff --git a/.gitignore b/.gitignore index c90683599..a775b0544 100644 --- a/.gitignore +++ b/.gitignore @@ -200,3 +200,6 @@ tags # subgraph subgraph/generated/* subgraph/build/* + +# Local Netlify folder +.netlify diff --git a/contracts/.env.example b/contracts/.env.example index 1b3968e7f..2fdfa0ebb 100644 --- a/contracts/.env.example +++ b/contracts/.env.example @@ -6,6 +6,7 @@ INFURA_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 # If ETHERSCAN_API_KEY is set, it overrides any hardhat configuration. ETHERSCAN_API_KEY_FIX=ABC123ABC123ABC123ABC123ABC123ABC1 ARBISCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 +GNOSISSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 # Optionally for debugging # TENDERLY_USERNAME=your_username diff --git a/contracts/.gitignore b/contracts/.gitignore index b1d3ebd78..0b8d6e394 100644 --- a/contracts/.gitignore +++ b/contracts/.gitignore @@ -1,5 +1,6 @@ # Hardhat files cache +cache_hardhat artifacts coverage.json diff --git a/contracts/README.md b/contracts/README.md index c80c496cc..ff40a396a 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -8,6 +8,18 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments ### v2-prealpha-3 +#### Chiado + +- [ArbitrableExample](https://blockscout.com/gnosis/chiado/address/0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b) +- [ForeignGatewayOnGnosis](https://blockscout.com/gnosis/chiado/address/0x87142b7E9C7D026776499120D902AF8896C07894) +- [SortitionSumTreeFactory](https://blockscout.com/gnosis/chiado/address/0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636) +- [TokenBridge](https://blockscout.com/gnosis/chiado/address/0xbb3c86f9918C3C1d83668fA84e79E876d147fFf2) +- [WETH](https://blockscout.com/gnosis/chiado/address/0x014A442480DbAD767b7615E55E271799889FA1a7) +- [WETHFaucet](https://blockscout.com/gnosis/chiado/address/0x395014fddc3b12F9a78ED8E57DA162Fd77E12bE3) +- [WPNKFaucet](https://blockscout.com/gnosis/chiado/address/0x5898aeE045A25B276369914c3448B72a41758B2c) +- [WrappedPinakionV2](https://blockscout.com/gnosis/chiado/address/0xD75E27A56AaF9eE7F8d9A472a8C2EF2f65a764dd) +- [xKlerosLiquidV2](https://blockscout.com/gnosis/chiado/address/0x34E520dc1d2Db660113b64724e14CEdCD01Ee879) + #### Goerli - [PNK](https://goerli.etherscan.io/token/0xA3B02bA6E10F55fb177637917B1b472da0110CcC) @@ -19,14 +31,15 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments - [PNK](https://goerli.arbiscan.io/token/0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610/token-transfers) - [BlockHashRNG](https://goerli.arbiscan.io/address/0x68eE49dfD9d76f3386257a3D0e0A85c0A5519bBD) -- [DisputeKitClassic](https://goerli.arbiscan.io/address/0xde31F2245d164620d08f5b0f8D43dCe8B9708373) -- [DisputeResolver](https://goerli.arbiscan.io/address/0xa1f52474CFa1ee78758a4bBa35DE547133Bda62f) +- [DisputeKitClassic](https://goerli.arbiscan.io/address/0x86734488ABF0E1AD40bc4DE4F820e808f39Bea09) +- [DisputeResolver](https://goerli.arbiscan.io/address/0xDe3eCeB73C453E56F5661ad029a41341CF592b9A) - [FastBridgeSender](https://goerli.arbiscan.io/address/0x4d18b9792e0D8F5aF696E71dBEDff8fcBEed6e8C) - [HomeGatewayToEthereum](https://goerli.arbiscan.io/address/0xed12799915180a257985631fbD2ead261eD838cf) -- [KlerosCore](https://goerli.arbiscan.io/address/0x4d7858e73a8842b5e6422D08a3349924dD062AbB) -- [PolicyRegistry](https://goerli.arbiscan.io/address/0xAF0F49Fe110b48bd512F00d51D141F023c9a9106) -- [RandomizerRNG](https://goerli.arbiscan.io/address/0xb82D1eAD813C3a2E729F288276cc402343423Bad) -- [SortitionSumTreeFactory](https://goerli.arbiscan.io/address/0x40a78989317B953e427B3BD87C59eA003fcC2296) +- [HomeGatewayToGnosis](https://goerli.arbiscan.io/address/0x12613A66F1E5A2086374e103F66BF0eddA5d1478) +- [KlerosCore](https://goerli.arbiscan.io/address/0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24) +- [PolicyRegistry](https://goerli.arbiscan.io/address/0xC5655728387Ce5E2aAA22138114E5777370aBDae) +- [RandomizerRNG](https://goerli.arbiscan.io/address/0xa2d1A3CDF0becEdb724e5A34De7022B6FF5e4787) +- [SortitionSumTreeFactoryV2](https://goerli.arbiscan.io/address/0x678E676fd0048da8c35d5B03fabB53a7beBf73A6) ## Getting Started @@ -82,6 +95,7 @@ The ones below are optional: - `ETHERSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Etherscan**. - `ARBISCAN_API_KEY`: to verify the source of the newly deployed contracts on **Arbitrum**. +- `GNOSISSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Gnosis chain**. #### 1. Update the Constructor Parameters (optional) @@ -100,20 +114,25 @@ yarn hardhat node --tags nothing **Shell 2: the deploy script** ```bash -yarn deploy --network localhost --tags +yarn deploy --network localhost --tags ``` #### 3. Deploy to Public Testnets ```bash +# ArbitrumGoerli to Chiado +yarn deploy --network arbitrumGoerli --tags Arbitration +yarn deploy --network chiado --tags ForeignGatewayOnGnosis +yarn deploy --network chiado --tags KlerosLiquidOnGnosis +yarn deploy --network arbitrumGoerli --tags HomeGatewayToGnosis + # Goerli yarn deploy --network arbitrumGoerli --tags Arbitration -yarn deploy --network goerli --tags ForeignGateway -yarn deploy --network arbitrumGoerli --tags HomeGateway +yarn deploy --network goerli --tags ForeignGatewayOnEthereum +yarn deploy --network arbitrumGoerli --tags HomeGatewayToEthereum ``` -The deployed addresses should be output to the screen after the deployment is complete. -If you miss that, you can always go to the `deployments/` directory and look for the respective file. +The deployed addresses should be displayed to the screen after the deployment is complete. If you missed them, you can always go to the `deployments/` directory and look for the respective file. #### Running Test Fixtures @@ -134,7 +153,7 @@ yarn test --network localhost This must be done for each network separately. ```bash -yarn etherscan-verify --network +yarn etherscan-verify --network ``` ## Ad-hoc procedures @@ -144,12 +163,19 @@ yarn etherscan-verify --network
+``` + +#### Example: WETH on Gnosis chain + +```bash +scripts/generateDeploymentArtifact.sh gnosischain 0xf8d1677c8a0c961938bf2f9adc3f3cfda759a9d9 > deployments/gnosischain/WETH.json +``` + ### Push the contracts to a Tenderly project Ensure that your `$TENDERLY_PROJECT` and `$TENDERLY_USERNAME` is set correctly in `.env`. diff --git a/contracts/config/courts.v1.gnosischain.json b/contracts/config/courts.v1.gnosischain.json new file mode 100644 index 000000000..81a10e9e0 --- /dev/null +++ b/contracts/config/courts.v1.gnosischain.json @@ -0,0 +1,227 @@ +[ + { + "id": 0, + "parent": "0", + "hiddenVotes": true, + "minStake": "520000000000000000000", + "alpha": "5000", + "feeForJuror": "15000000000000000000", + "jurorsForCourtJump": "15000000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 1, + "parent": "0", + "hiddenVotes": false, + "minStake": "520000000000000000000", + "alpha": "3100", + "feeForJuror": "6900000000000000000", + "jurorsForCourtJump": "6900000000000000000", + "timesPerPeriod": [ + 140400, + 291600, + 291600, + 194400 + ] + }, + { + "id": 2, + "parent": "0", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "5000", + "feeForJuror": "22000000000000000000", + "jurorsForCourtJump": "22000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 3, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "1800", + "feeForJuror": "9400000000000000000", + "jurorsForCourtJump": "9400000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 4, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "1800", + "feeForJuror": "9400000000000000000", + "jurorsForCourtJump": "9400000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 5, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "1800", + "feeForJuror": "9400000000000000000", + "jurorsForCourtJump": "9400000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 6, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2200", + "feeForJuror": "12000000000000000000", + "jurorsForCourtJump": "12000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 7, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2200", + "feeForJuror": "12000000000000000000", + "jurorsForCourtJump": "12000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 8, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2800", + "feeForJuror": "15000000000000000000", + "jurorsForCourtJump": "15000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 9, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2800", + "feeForJuror": "15000000000000000000", + "jurorsForCourtJump": "15000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 10, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2800", + "feeForJuror": "15000000000000000000", + "jurorsForCourtJump": "15000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 11, + "parent": "2", + "hiddenVotes": false, + "minStake": "1200000000000000000000", + "alpha": "2800", + "feeForJuror": "15000000000000000000", + "jurorsForCourtJump": "15000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 12, + "parent": "0", + "hiddenVotes": false, + "minStake": "1400000000000000000000", + "alpha": "5000", + "feeForJuror": "30000000000000000000", + "jurorsForCourtJump": "30000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 13, + "parent": "12", + "hiddenVotes": false, + "minStake": "1400000000000000000000", + "alpha": "1600", + "feeForJuror": "30000000000000000000", + "jurorsForCourtJump": "30000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 14, + "parent": "12", + "hiddenVotes": false, + "minStake": "1400000000000000000000", + "alpha": "1600", + "feeForJuror": "30000000000000000000", + "jurorsForCourtJump": "30000000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + } +] diff --git a/contracts/config/courts.v1.mainnet.json b/contracts/config/courts.v1.mainnet.json new file mode 100644 index 000000000..cdb6c365c --- /dev/null +++ b/contracts/config/courts.v1.mainnet.json @@ -0,0 +1,362 @@ +[ + { + "id": 0, + "parent": "0", + "hiddenVotes": false, + "minStake": "1700000000000000000000", + "alpha": "10000", + "feeForJuror": "16000000000000000", + "jurorsForCourtJump": "16000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 1, + "parent": "0", + "hiddenVotes": false, + "minStake": "5000000000000000000000", + "alpha": "5000", + "feeForJuror": "20000000000000000", + "jurorsForCourtJump": "20000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 2, + "parent": "1", + "hiddenVotes": false, + "minStake": "5000000000000000000000", + "alpha": "3900", + "feeForJuror": "11000000000000000", + "jurorsForCourtJump": "11000000000000000", + "timesPerPeriod": [ + 151200, + 324000, + 324000, + 302400 + ] + }, + { + "id": 3, + "parent": "2", + "hiddenVotes": false, + "minStake": "10000000000000000000000", + "alpha": "5000", + "feeForJuror": "70000000000000000", + "jurorsForCourtJump": "70000000000000000", + "timesPerPeriod": [ + 367200, + 626400, + 626400, + 604800 + ] + }, + { + "id": 4, + "parent": "1", + "hiddenVotes": false, + "minStake": "23000000000000000000000", + "alpha": "5000", + "feeForJuror": "79000000000000000", + "jurorsForCourtJump": "79000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 5, + "parent": "0", + "hiddenVotes": false, + "minStake": "14000000000000000000000", + "alpha": "3250", + "feeForJuror": "100000000000000000", + "jurorsForCourtJump": "100000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 6, + "parent": "0", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "5000", + "feeForJuror": "36000000000000000", + "jurorsForCourtJump": "36000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 7, + "parent": "0", + "hiddenVotes": false, + "minStake": "14000000000000000000000", + "alpha": "3250", + "feeForJuror": "100000000000000000", + "jurorsForCourtJump": "100000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 8, + "parent": "0", + "hiddenVotes": false, + "minStake": "1700000000000000000000", + "alpha": "4000", + "feeForJuror": "4500000000000000", + "jurorsForCourtJump": "4500000000000000", + "timesPerPeriod": [ + 140400, + 291600, + 291600, + 194400 + ] + }, + { + "id": 9, + "parent": "0", + "hiddenVotes": false, + "minStake": "4600000000000000000000", + "alpha": "5000", + "feeForJuror": "25000000000000000", + "jurorsForCourtJump": "25000000000000000", + "timesPerPeriod": [ + 140400, + 291600, + 291600, + 194400 + ] + }, + { + "id": 10, + "parent": "0", + "hiddenVotes": false, + "minStake": "3800000000000000000000", + "alpha": "5000", + "feeForJuror": "25000000000000000", + "jurorsForCourtJump": "25000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 38800 + ] + }, + { + "id": 11, + "parent": "10", + "hiddenVotes": false, + "minStake": "4700000000000000000000", + "alpha": "5000", + "feeForJuror": "31000000000000000", + "jurorsForCourtJump": "31000000000000000", + "timesPerPeriod": [ + 367200, + 626400, + 626400, + 604800 + ] + }, + { + "id": 12, + "parent": "9", + "hiddenVotes": false, + "minStake": "4600000000000000000000", + "alpha": "4100", + "feeForJuror": "25000000000000000", + "jurorsForCourtJump": "25000000000000000", + "timesPerPeriod": [ + 210660, + 437400, + 437400, + 291600 + ] + }, + { + "id": 13, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4000", + "feeForJuror": "28000000000000000", + "jurorsForCourtJump": "28000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 14, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4000", + "feeForJuror": "28000000000000000", + "jurorsForCourtJump": "28000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 15, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4000", + "feeForJuror": "28000000000000000", + "jurorsForCourtJump": "28000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 16, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4000", + "feeForJuror": "29000000000000000", + "jurorsForCourtJump": "29000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 17, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4000", + "feeForJuror": "29000000000000000", + "jurorsForCourtJump": "29000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 18, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4300", + "feeForJuror": "31000000000000000", + "jurorsForCourtJump": "31000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 19, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4300", + "feeForJuror": "31000000000000000", + "jurorsForCourtJump": "31000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 20, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4300", + "feeForJuror": "31000000000000000", + "jurorsForCourtJump": "31000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 21, + "parent": "6", + "hiddenVotes": false, + "minStake": "3900000000000000000000", + "alpha": "4300", + "feeForJuror": "31000000000000000", + "jurorsForCourtJump": "31000000000000000", + "timesPerPeriod": [ + 280800, + 437400, + 437400, + 291600 + ] + }, + { + "id": 22, + "parent": "0", + "hiddenVotes": true, + "minStake": "2300000000000000000000", + "alpha": "10000", + "feeForJuror": "15000000000000000", + "jurorsForCourtJump": "15000000000000000", + "timesPerPeriod": [ + 280800, + 583200, + 583200, + 388800 + ] + }, + { + "id": 23, + "parent": "0", + "hiddenVotes": false, + "minStake": "14000000000000000000000", + "alpha": "5000", + "feeForJuror": "11000000000000000", + "jurorsForCourtJump": "11000000000000000", + "timesPerPeriod": [ + 540000, + 437400, + 437400, + 291600 + ] + } +] diff --git a/contracts/config/policies.v1.gnosischain.json b/contracts/config/policies.v1.gnosischain.json new file mode 100644 index 000000000..62a34c88c --- /dev/null +++ b/contracts/config/policies.v1.gnosischain.json @@ -0,0 +1,121 @@ +[ + { + "name": "xDai General Court", + "description": "**Court Purpose:**\n\nThe General court exists as the top court in the hierarchy. All appeals made in subcourts will make their way to the General Court.", + "summary": "**Guidelines:**\n - All policies of a court also apply to all of its child subcourts.\n - Jurors should cast their vote with a suitable verification.\n - Jurors should not rule in favor of a side who have engaged in immoral activities (example: rule reject on “revenge porn” images even if they would otherwise fit into the category).\n - “Refuse to arbitrate” should be used for disputes where both sides of the dispute have engaged in activities which are immoral (ex: refuse to rule on an assassination market dispute).\n Immoral activities include: Murder, slavery, rape, violence, theft and perjury.\n - Rulings should be made based on the “state of the world” at the time a dispute was created. (Ex: in a dispute concerning membership of a smart contract on a curated list of “bug free” contracts, jurors should not take into account changes made to the contract after the dispute is raised.) In particular, jurors should base their rulings on court policies and arbitrable application primary documents as they exist at the time of the creation of the dispute, disregarding later modifications.\n - To ensure fairness to jurors who vote at different times within a voting period, jurors should disregard any evidence that is both 1) submitted after the end of the evidence period of the initial round of a dispute AND 2) cannot be reasonably considered to have been readily, publicly available to jurors. Jurors may, however, consider arguments that are submitted later that are based upon existing evidence and/or information which a juror considering the case during the evidence period of the initial round could reasonably have been expected to find themselves. (Ex: a party submits a new photo of a damaged product in an insurance case after the evidence period; this photo should not be considered by jurors. Ex: in a dispute over whether a token satisfies the criteria of a curated list of ERC20 tokens, an argument that reminds jurors of a definitional element of the ERC20 standard is submitted; this is publicly available and can be considered by jurors. Ex: in a dispute over whether a token satisfies a decentralization criterion for an exchange listing, an argument that invokes the distribution of tokens over different Ethereum addresses, as publicly available from sites such as Etherscan, can be considered by jurors.)\n - When considering an appeal of a case that has originated in a lower court, jurors should consider whether 1) evaluating the case requires specialized skills which jurors in the appellate court cannot be expected to have (ex: evaluating the quality of an English to Korean translation when knowledge of Korean is not a requirement of the appellate court) and 2) whether there is evidence that an attack was performed against this case in the lower court (ex: bribes, p+epsilon attacks, 51% attacks, etc). If there is no evidence of an attack AND appellate court jurors cannot be reasonably expected to have the required skills to independently evaluate the case, jurors should vote to uphold the lower court ruling. Evidence related to the presence of attacks on Kleros should be considered by jurors even if it would otherwise violate the above points on evidence admissibility.\n - Jurors should attempt to interpret disputes according to the “spirit of the dispute” unless the arbitrable contract or the policies of the subcourt state otherwise.\n - Jurors should interpret disputes without assuming the existence of gods, spirits or other supernatural beings unless the arbitrable contract or the policies of the subcourt state otherwise.", + "court": 0, + "uri": "/ipfs/QmTsPLwhozEqjWnYKsnamZiJW47LFT7LzkQhKw5ygQxqyH/xDai-General-Court-Policy.json" + }, + { + "name": "xDai Curation", + "description": "**Court purpose:** \n\n In this court, jurors will solve micro-tasks related to curation or content moderation, such as for social media, when requirements for inclusion are relatively straightforward. Higher effort cases, requiring application of more nuanced rules should be placed in other courts but might arrive in this court upon appeal.", + "summary": "", + "requiredSkills": "No particular skills are required.", + "court": 1, + "uri": "/ipfs/QmWQDgtUWALrnCgakAAoFWdX1P7iDGmr5imZLZzyYtPqcE/xDai-Curation-Court-Policy.json" + }, + { + "name": "xDai English Language", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example**\n\n - Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to be accepted unless a target audience is specifically mentioned in the contract.", + "requiredSkills": "This court requires an advanced level of English. Jurors who are not native English speakers are advised to stake into this court only if they have C1+ level of English.\n\nThe following tests evaluates a C1 level: Cambridge Advanced (CAE), BEC Higher, BULATS score 75+, CLB/CELPIP 8+, CAEL 70+, IELTS level 7, TOEFL 110+, TOEIC score 880+.", + "court": 2, + "uri": "/ipfs/QmPLD9Zj8aZj5sVH9WcsHXbARR3RfRnEwHRrVeDM8AbPLt/xDai-English-Language-Court-Policy.json" + }, + { + "name": "xDai Spanish-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Spanish and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Spanish. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Spanish for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or Mexican/Argentinian/European Spanish.", + "court": 3, + "uri": "/ipfs/QmXJbzzuKQQVa7PFrwhb8r4in1yy1sRRQseCZ6g8EZWpHZ/xDai-Spanish-English-Language-Court-Policy.json" + }, + { + "name": "xDai French-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between French and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and French. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and French for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or European/Québécois French.", + "court": 4, + "uri": "/ipfs/QmUYsy6mVozbGn885ssCk3LKC8iXT363RwY7DH3QuRCu1Y/xDai-French-English-Language-Court-Policy.json" + }, + { + "name": "xDai Portuguese-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Portuguese and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Portuguese. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Portuguese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or Brazilian/European Portuguese.", + "court": 5, + "uri": "/ipfs/QmRZviKJzgkr6AyxcAULjnoQArt5DvNPssvEzVNxHjAUzb/xDai-Portuguese-English-Language-Court-Policy.json" + }, + { + "name": "xDai German-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between German and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and German. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and German for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 6, + "uri": "/ipfs/Qmf6hiaVdzHHVV5jAp7AM6MA9EHLoAtVbbDnFDhPqwU4TL/xDai-German-English-Language-Court-Policy.json" + }, + { + "name": "xDai Russian-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Russian and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Russian. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Russian for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 7, + "uri": "/ipfs/QmViD1v5PBkYwtAeWiLktDZtBVCRvDd3LrLSzQ7TTEsTtb/xDai-Russian-English-Language-Court-Policy.json" + }, + { + "name": "xDai Korean-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Korean and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Korean. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Korean for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 8, + "uri": "/ipfs/QmZZaTxzkJsWd1JTKvSQsBPBSDWbPc5og6By7Vx8F7Wcdt/xDai-Korean-English-Language-Court-Policy.json" + }, + { + "name": "xDai Japanese-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Japanese and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Japanese. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Japanese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 9, + "uri": "/ipfs/QmWqxZhKFyR17JYU4GwXtumMinfACtw9z2r9cXumVcUbek/xDai-Japanese-English-Language-Court-Policy.json" + }, + { + "name": "xDai Turkish-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Turkish and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Turkish. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Turkish for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 10, + "uri": "/ipfs/QmZxbiUdvC9CwsTiLGhqnnYYBUJNFp28ZNFWJfhSXFXY8K/xDai-Turkish-English-Language-Court-Policy.json" + }, + { + "name": "xDai Chinese-English Translation", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the quality of translations between Chinese and English.", + "summary": "", + "requiredSkills": "Jurors in this court should have a strong command of both English and Chinese (written in simplified characters). While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Chinese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 11, + "uri": "/ipfs/QmTERr8X73QTnTXNDMSWew2znWYWrcgvFWTUbEJeXPXmBU/xDai-Chinese-English-Language-Court-Policy.json" + }, + { + "name": "xDai Development Court", + "description": "**Court purpose:** \n\n In this court, jurors will solve disputes involving the respect of specifications given by the client.", + "summary": "**Example** \n\n Developper does not respect indentation, does not name variables explicitly or has not made a clear file structure. In such cases, jurors should refuse the proposal made by the developer.", + "requiredSkills": "This court requires a good level of programmation. Jurors who are not intermediate developers are advised to stake into this court only if they have some basics of low-level programming languages, ​​algorithmic and knowledge of good practices of development.", + "court": 12, + "uri": "/ipfs/QmbgUL2iv9XH3jui7xdLBXp2Hqe4VqGnNkK7PnAorJ8XQa/xDai-Development-Court-Policy.json" + }, + { + "name": "xDai Solidity Court", + "description": "**Court purpose:** \n\n If the disputed code is of significant size (> 500 code lines), parties in the dispute should point out specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.", + "summary": "", + "requiredSkills": "This court requires a good level of solidity. Jurors who are not solidity intermediate developers are advised to stake into this court only if they also know how to make relatively simple contracts, know the main solidity hacks and can compute the complexity of simple functions.", + "court": 13, + "uri": "/ipfs/QmQbyk1qnD4e4MQrwSr6a21w2t82YJEMxU3F7QTYKkxuNS/xDai-Solidity-Court-Policy.json" + }, + { + "name": "xDai Javascript Court", + "description": "**Court purpose:** \n\n If the disputed code is of significant size (> 700 code lines), parties in the dispute should point out specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.", + "summary": "", + "requiredSkills": "This court requires a good level of javascript. Jurors who are not javascript intermediate developers are advised to stake into this court only if they know the main frameworks/libraries (ExpressJs, React, EthersJs…) and be comfortable with testing, APIs or languages to interact with databases.", + "court": 14, + "uri": "/ipfs/Qme15AUfpvLX3iwEtqswe26PQHMmKnF4eWGywBPqbkdqcD/xDai-Javascript-Court-Policy.json" + } +] diff --git a/contracts/config/policies.v1.mainnet.json b/contracts/config/policies.v1.mainnet.json new file mode 100644 index 000000000..6ace07dea --- /dev/null +++ b/contracts/config/policies.v1.mainnet.json @@ -0,0 +1,191 @@ +[ + { + "name": "General Court", + "description": "**Court Purpose:**\n\nThe General court exists as the top court in the hierarchy. All appeals made in subcourts will make their way to the General Court.", + "summary": "**Guidelines:**\n - All policies of a court also apply to all of its child subcourts.\n - Jurors should cast their vote with a suitable verification.\n - Jurors should not rule in favor of a side who have engaged in immoral activities (example: rule reject on “revenge porn” images even if they would otherwise fit into the category).\n - “Refuse to arbitrate” should be used for disputes where both sides of the dispute have engaged in activities which are immoral (ex: refuse to rule on an assassination market dispute).\n Immoral activities include: Murder, slavery, rape, violence, theft and perjury.\n - Rulings should be made based on the “state of the world” at the time a dispute was created. (Ex: in a dispute concerning membership of a smart contract on a curated list of “bug free” contracts, jurors should not take into account changes made to the contract after the dispute is raised.) In particular, jurors should base their rulings on court policies and arbitrable application primary documents as they exist at the time of the creation of the dispute, disregarding later modifications.\n - To ensure fairness to jurors who vote at different times within a voting period, jurors should disregard any evidence that is both 1) submitted after the end of the evidence period of the initial round of a dispute AND 2) cannot be reasonably considered to have been readily, publicly available to jurors. Jurors may, however, consider arguments that are submitted later that are based upon existing evidence and/or information which a juror considering the case during the evidence period of the initial round could reasonably have been expected to find themselves. (Ex: a party submits a new photo of a damaged product in an insurance case after the evidence period; this photo should not be considered by jurors. Ex: in a dispute over whether a token satisfies the criteria of a curated list of ERC20 tokens, an argument that reminds jurors of a definitional element of the ERC20 standard is submitted; this is publicly available and can be considered by jurors. Ex: in a dispute over whether a token satisfies a decentralization criterion for an exchange listing, an argument that invokes the distribution of tokens over different Ethereum addresses, as publicly available from sites such as Etherscan, can be considered by jurors.)\n - When considering an appeal of a case that has originated in a lower court, jurors should consider whether 1) evaluating the case requires specialized skills which jurors in the appellate court cannot be expected to have (ex: evaluating the quality of an English to Korean translation when knowledge of Korean is not a requirement of the appellate court) and 2) whether there is evidence that an attack was performed against this case in the lower court (ex: bribes, p+epsilon attacks, 51% attacks, etc). If there is no evidence of an attack AND appellate court jurors cannot be reasonably expected to have the required skills to independently evaluate the case, jurors should vote to uphold the lower court ruling. Evidence related to the presence of attacks on Kleros should be considered by jurors even if it would otherwise violate the above points on evidence admissibility.\n - Jurors should attempt to interpret disputes according to the “spirit of the dispute” unless the arbitrable contract or the policies of the subcourt state otherwise.\n - Jurors should interpret disputes without assuming the existence of gods, spirits or other supernatural beings unless the arbitrable contract or the policies of the subcourt state otherwise.", + "court": 0, + "uri": "/ipfs/Qmd1TMEbtic3TSonu5dfqa5k3aSrjxRGY8oJH3ruGgazRB" + }, + { + "name": "Blockchain", + "description": "**Court Purpose:**\n\nThis is the blockchain community subcourt. Disputes in this subcourt should be those that require that jurors have an understanding of the broad blockchain ecosystem. Cases in this court may come from varying aspects of the ecosystem and could also be from lower courts that have been appealed. For example, a case in the Token Curated Registry could arrive here on appeal.\n", + "summary": "", + "court": 1, + "uri": "/ipfs/QmYMdCkb7WULmiK6aQrgsayGG3VYisQwsHSLC3TLkzEHCm" + }, + { + "name": "Non-Technical", + "description": "**Court Purpose:**\n\nThis subcourt is for small non-technical blockchain disputes. It is used for disputes on challenged tokens from Kleros Token² Curated Registry Dapp, Cryptoasset Transfer and Exchange Listing agreement escrow disputes. This can include:\n\n- **Token² Curated Registry**: A curated list of verified tokens submitted by users. This includes, logo, token name, contract address and ticker. \n\n- **Cryptoasset Transfer Escrow**: This escrow can be used by users to safely and securely transfer cryptoassets between two parties, even if one cryptoasset is on a chain other than Ethereum. Funds are locked in a smart contract until the other party has complied with the agreement or a dispute is brought. An example use case could be transferring ETH for BTC P2P without knowledge of the other party. You deposit ETH into the escrow, the other party sends BTC and you release ETH.\n\n- **Exchange Listing Agreement Escrow**: This escrow can be used to delegate listing of tokens to token listing agents. A reward is paid to the agent if the token is appropriately listed on the agreed upon exchange.\n\n**Example:**\n\n- Someone submits the PNK token with the address “0x87c260900c391559fd2816c9fbf078de37e2f520”. Someone challenges the listing as incorrect as the real PNK address is “0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d”.\n\n- Parties make a contract to exchange 1 BTC for 30 ETH. After the deadline agreed in the contract, the address of the BTC buyer still hasn’t been credited.\n\n- Contractor agreed to list clients token or coin in both USD and DAI pairings but did not deliver USD.", + "summary": "**Policies:** \n\n- In escrow disputes involving privacy coins where “view key’s” are needed, those should be provided as evidence before the end of the evidence period. ", + "requiredSkills": "Jurors do not need a deep blockchain technical knowledge or coding skills but do need the ability to read blockchain explorers, look at cryptoassets listed on exchanges, understand how to verify a transaction and cross reference on-chain data. ", + "court": 2, + "uri": "/ipfs/QmdJYHubLGQCt2GxpJch2riSYVxZzDC4cBg2mNPXuiY6rX" + }, + { + "name": "Token Listing", + "description": "**Court Purpose:**\n\nThis court serves as the final validation for token listing for verified projects listing on the Ethfinex Exchange using Kleros’ Token Curated List Dapp.\nThis is a high level, high stake court requiring deep blockchain knowledge, legal experience and / or a knowledge of exchange listings in general. Jurors are required to stake a large amount of PNK and should only do so if they are confident in the above capabilities.", + "summary": "[Ethfinex Court Policy](https://ipfs.kleros.io/ipfs/QmVzwEBpGsbFY3UgyjA3SxgGXx3r5gFGynNpaoXkp6jenu/Ethfinex%20Court%20Policy.pdf)", + "court": 3, + "uri": "/ipfs/QmeyojE13mcQtWqQQddYypafDRChVND8z6dcHLbaarmbbx" + }, + { + "name": "Technical", + "description": "**Court Purpose:**\n\nThis court serves to arbitrate blockchain disputes of a technical nature. This can include:\n\n- Verifying that a smart contract meets a defined standard. \n\n- Verifying that a proposed contract call is the technical translation of a decision taken by governance.\n\n**Example:**\n\n- A dispute on whether or not a token should be given a badge indicating that it satisfies ERC20. \n\n- A dispute on whether or not a proposed Kleros governor call matches the decision which has been voted through governance.", + "summary": "**Policies:** \n\n- Disputes in this subcourt should only be of technical nature. ", + "requiredSkills": "A high understanding of blockchain technology, smart contract, solidity language and Ethereum ABI is required.", + "court": 4, + "uri": "/ipfs/QmcBjGYfmKmkpYc8HYkaiBa9ot2eoWAa2Mhfef7i7QKd5H" + }, + { + "name": "Marketing Services", + "description": "**Court Purpose:**\n\nIn this court, jurors will solve disputes on quality of paid marketing services including but not exclusive to sponsored articles, social media promotion and PR writing.\n\n**Example**\n\n- Marketing company promised to publish article on Cointelegraph and subsequently list on Google news, neither of these things happened.", + "summary": "**Policies:** \n\n- It is the responsibility of the marketing contractor to prove that the service has been delivered. This should be done by providing evidence.", + "requiredSkills": "A high level of reading and writing comprehension, data corroboration and web search.", + "court": 5, + "uri": "/ipfs/QmbSwJ4acdQP9EF6DfDU6czaG8ePha3eyvcSpPgAR8tPZ4" + }, + { + "name": "English Language", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "This subcourt requires an advanced level of English. Jurors who are not native English speakers are advised to stake into this court only if they have C1+ level of English.The following tests evaluates a C1 level: Cambridge Advanced (CAE), BEC Higher, BULATS score 75+, CLB/CELPIP 8+, CAEL 70+, IELTS level 7, TOEFL 110+, TOEIC score 880+.", + "court": 6, + "uri": "/ipfs/QmSn2RJX7a4BQ8rDtfvKLjKQSC3eHWjayPTSkFo3QMbjBx" + }, + { + "name": "Video Production", + "description": "**Court Purpose:**\n\nThis court is for disputes on video production created through agreements in the Kleros escrow. This included editing quality, resolution and final deliverable format.\n\n**Example:**\n\n- Freelancer did not complete video project as agreed in contract. Agreement stated video should be of 1min 30 seconds long but was only 59 seconds.", + "summary": "**Policies:**\n\n- If the video is longer than 1h, parties in the dispute should draw attention to certain sections of the video that do not meet the requirements of the agreement.", + "requiredSkills": "Knowledge of video editing programs / encoding standards and editing procedures. Ability to check resolutions, durations and visual branding on platforms such as YouTube, Vimeo etc.", + "court": 7, + "uri": "/ipfs/QmXvtokEk3qPiB2WPXXUpd4xCoAr5xeceS1n4BHHqNpP7p" + }, + { + "name": "Onboarding", + "description": "**Court Purpose:**\n\n- Allow new jurors to get a feel of Kleros by solving a variety of small disputes.\n- Allow projects considering Kleros use to have some disputes solved with Kleros in order to compare Kleros results with other methods.", + "summary": "**Policies:** \n\n- Disputes should be relatively simple. They should require less than 1 hour to solve.", + "requiredSkills": "No particular skills are required.", + "court": 8, + "uri": "/ipfs/QmbC7uhDEC33V8zyp8u6xozuD3GwtMp4Eaw25EzscEJk3R/Bce1VQaKwHGhMXxqgsmzJLH79ngeP4c57hGBeQQmSCZmPJcgrq4jBj3eFuMsgXuJhfYCXbARyNDx8oNvgusd9pDLjt" + }, + { + "name": "Curation", + "description": "**Court purpose:** \n\n In this court, jurors will solve micro-tasks related to curation or content moderation, such as for social media, when requirements for inclusion are relatively straightforward. Higher effort cases, requiring application of more nuanced rules should be placed in other courts but might arrive in this court upon appeal.", + "summary": "", + "requiredSkills": "No particular skills are required.", + "court": 9, + "uri": "/ipfs/QmWcf4mgnPyxUVbRMKmNjx9pzk3scQRg8bVbNjDdfgh2Nq" + }, + { + "name": "Data Analysis", + "description": "", + "summary": "", + "requiredSkills": "Jurors should be comfortable dealing with data sets, particularly in being able to understand the context of the data from the structure of the data set, and in estimating what percentage of entries are unusable/would need to be cleaned.", + "court": 10, + "uri": "/ipfs/Qmb3r65GXcoWfkpb6m3mnzgCyTyz7dk59UaY4iW6eTKkqJ" + }, + { + "name": "Statistical Modeling", + "description": "", + "summary": "", + "requiredSkills": "Jurors should be comfortable dealing with data sets. Furthermore, jurors should have a background in statistics equivalent to (at minimum) a university statistics course, and they should be able to analyze the assumptions taken in the creation of statistical models.", + "court": 11, + "uri": "/ipfs/QmSu7HxnTmQQz23EPTAMv7oF1NsBM752mEEytCDrgdoAUx" + }, + { + "name": "Curation (Medium)", + "description": "**Court purpose:** \n\n In this court, jurors will solve tasks of “medium difficulty” related to curation or content moderation. Here requirements to be analyzed can be more complicated than those of the micro-tasks in the Curation court; however, much higher effort cases should still be placed in other courts, but might arrive in this court upon appeal.", + "summary": "", + "requiredSkills": "No particular skills are required.", + "court": 12, + "uri": "/ipfs/QmeGQ5pq7eDcS3NmKXyPsRFLEXd9pJe3MHKdDviy3buDce" + }, + { + "name": "Spanish-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Spanish. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Spanish for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or Mexican/Argentinian/European Spanish.", + "court": 13, + "uri": "/ipfs/QmY79fya7FQAzvhjzS6S5w9N8TkXZTQ5TSajqdC26VVK6L" + }, + { + "name": "French-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and French. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and French for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or European/Québécois French.", + "court": 14, + "uri": "/ipfs/QmQtCrG1EQzLiboYtQ15oWYstPrBUgftBUHmhUSZGk3jWc" + }, + { + "name": "Portuguese-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Portuguese. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Portuguese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English, or Brazilian/European Portuguese.", + "court": 15, + "uri": "/ipfs/QmYdR9v8LzYnw9pT4ZCcWyoivFMPNyQcBFXgCW3PZRSMCF" + }, + { + "name": "German-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and German. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and German for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 16, + "uri": "/ipfs/QmcqBRYin9Ug4YX7ysGf65xDjAQecuRzWp7nSucGvBcpwP" + }, + { + "name": "Russian-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Russian. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Russian for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 17, + "uri": "/ipfs/QmXoSvQJCW4HVjB6vreL8YwXj2HHJSpwNzroMkojos7p6c" + }, + { + "name": "Korean-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Korean. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Korean for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 18, + "uri": "/ipfs/QmUJGjgDCX9Bsn5fL6ZAZdXRLke3Pbdhwo312hJSewsKwg" + }, + { + "name": "Japanese-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Japanese. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Japanese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 19, + "uri": "/ipfs/QmWQ5NCSjZM8NK3quv72wcD7nbs9MfMxWajYnUgrZRAWch" + }, + { + "name": "Turkish-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Turkish. While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Turkish for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 20, + "uri": "/ipfs/QmNSpBnACohhHwSpqg5nG8ZVxED2B4pMiputfZqZdbZvuc" + }, + { + "name": "Chinese-English Translation", + "description": "**Court Purpose:**\n\nIn this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n\n**Example:**\n\n- Contractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", + "summary": "**Policies:**\n\n- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", + "requiredSkills": "Jurors in this court should have a strong command of both English and Chinese (written in simplified characters). While jurors do not necessarily have to have the skills of a professional translator themselves, they should be able to review texts translated between English and Chinese for the quality of their translation. Particularly, when presented with passages that are flagged by challengers as potentially erroneous or inadequate and arguments given by the translator and the challenger for why the passage should or should not be considered acceptable, jurors should be able to make a determination on the quality of the passage. Jurors should be capable of these tasks even when the text is being translated to or from regional variations of these languages, such as US/British English.", + "court": 21, + "uri": "/ipfs/QmbuTx2dcWGSqGo7ykMhMDbvs6oM1AcbC8LvbfAQohup25" + }, + { + "name": "Corte General en Español", + "description": "**Propósito de la Corte:**\n\nLa Corte General en Español sirve como corte de uso múltiple para todo tipo de disputas que requieran un alto nivel de conocimiento del español para ser evaluadas. Los casos resueltos por cortes más especializadas que requieran conocimientos de español además de otras habilidades pueden ser revisados en esta corte tras el proceso de apelación.", + "summary": "**Políticas:**\n\nAdemás del requisito de que los jurados tengan un nivel suficiente de español, esta corte debe tener la misma política que la Corte General de Kleros.", + "requiredSkills": "**Habilidades Requeridas:**\n\nEste tribunal requiere un nivel avanzado de español. Los miembros del jurado deben poder leer la evidencia y proporcionar una justificación adecuada en español sobre una amplia gama de temas.", + "court": 22, + "uri": "/ipfs/QmRPz626unSwc7fxo3ikoZzXmCpVm5EHfiSz2bfErCsHti" + }, + { + "name": "Humanity Court", + "description": "**Court Purpose:**\n\nIn this court jurors will judge disputes related to establishing Sybil resistant lists of unique human identities, particularly for the Proof of Humanity protocol.\n\n", + "summary": "", + "requiredSkills": "Jurors should be capable of reasonably evaluating whether a proposed submission consisting of photo and video evidence corresponds to a unique human being, eventually making use of supplementary information that might be provided as evidence by relevant parties.", + "court": 23, + "uri": "/ipfs/QmQKEJbyw89Qh5AurQ4kvidCSr32ihQUdAQZ646cPkJV34" + } +] diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index e0a847ff3..b32231280 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -15,7 +15,7 @@ const pnkByChain = new Map([ const randomizerByChain = new Map([ [HomeChains.ARBITRUM_ONE, "0x00"], - [HomeChains.ARBITRUM_GOERLI, "0xE1B6CcAc0BB0355C01A049e78909231Bfa13620B"], + [HomeChains.ARBITRUM_GOERLI, "0xF25c6Ad3694dA9D3C97F4D316b0B31F96cEb39d5"], ]); const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { @@ -27,7 +27,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; const chainId = Number(await getChainId()); - console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); + console.log("Deploying to %s with deployer %s", HomeChains[chainId], deployer); if (chainId === HomeChains.HARDHAT) { pnkByChain.set( @@ -57,12 +57,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) log: true, }); - await deploy("BlockHashRNG", { - from: deployer, - args: [], - log: true, - }); - const randomizer = randomizerByChain.get(Number(await getChainId())) ?? AddressZero; const rng = await deploy("RandomizerRNG", { from: deployer, @@ -76,19 +70,20 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) log: true, }); - const sortitionSumTreeLibrary = await deploy("SortitionSumTreeFactory", { + const sortitionSumTreeLibrary = await deploy("SortitionSumTreeFactoryV2", { from: deployer, log: true, }); - const pnk = pnkByChain.get(Number(await getChainId())) ?? AddressZero; + const pnk = pnkByChain.get(chainId) ?? AddressZero; const minStake = BigNumber.from(10).pow(20).mul(2); const alpha = 10000; const feeForJuror = BigNumber.from(10).pow(17); + const sortitionSumTreeK = 3; const klerosCore = await deploy("KlerosCore", { from: deployer, libraries: { - SortitionSumTreeFactory: sortitionSumTreeLibrary.address, + SortitionSumTreeFactoryV2: sortitionSumTreeLibrary.address, }, args: [ deployer, @@ -99,7 +94,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) false, [minStake, alpha, feeForJuror, 3], // minStake, alpha, feeForJuror, jurorsForCourtJump [0, 0, 0, 0], // evidencePeriod, commitPeriod, votePeriod, appealPeriod - 3, + sortitionSumTreeK, ], log: true, }); @@ -117,7 +112,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }); }; -deployArbitration.tags = ["HomeChain", "Arbitration"]; +deployArbitration.tags = ["Arbitration"]; deployArbitration.skip = async ({ getChainId }) => { const chainId = Number(await getChainId()); return !HomeChains[chainId]; diff --git a/contracts/deploy/00-rng.ts b/contracts/deploy/00-rng.ts new file mode 100644 index 000000000..fa1a41b05 --- /dev/null +++ b/contracts/deploy/00-rng.ts @@ -0,0 +1,72 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; +import { BigNumber } from "ethers"; +import { DisputeKitClassic, RandomizerRNG } from "../typechain-types"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_GOERLI = 421613, + HARDHAT = 31337, +} + +const pnkByChain = new Map([ + [HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"], + [HomeChains.ARBITRUM_GOERLI, "0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610"], +]); + +const randomizerByChain = new Map([ + [HomeChains.ARBITRUM_ONE, "0x00"], + [HomeChains.ARBITRUM_GOERLI, "0x57F7a8aA8291A04B325F3f0d2c4d03353d3Ef25f"], +]); + +const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { deployments, getNamedAccounts, getChainId } = hre; + const { deploy, execute } = deployments; + const { AddressZero } = hre.ethers.constants; + const RNG_LOOKAHEAD = 20; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Deploying to %s with deployer %s", HomeChains[chainId], deployer); + + if (chainId === HomeChains.HARDHAT) { + pnkByChain.set( + HomeChains.HARDHAT, + ( + await deploy("PNK", { + from: deployer, + log: true, + }) + ).address + ); + randomizerByChain.set( + HomeChains.HARDHAT, + ( + await deploy("RandomizerMock", { + from: deployer, + args: [], + log: true, + }) + ).address + ); + } + + const randomizer = randomizerByChain.get(Number(await getChainId())) ?? AddressZero; + const rng = await deploy("RandomizerRNG", { + from: deployer, + args: [randomizer, deployer], + log: true, + }); + + const disputeKit = (await hre.ethers.getContract("DisputeKitClassic")) as DisputeKitClassic; + await disputeKit.changeRandomNumberGenerator(rng.address, RNG_LOOKAHEAD); +}; + +deployArbitration.tags = ["RNG"]; +deployArbitration.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !HomeChains[chainId]; +}; + +export default deployArbitration; diff --git a/contracts/deploy/01-foreign-gateway.ts b/contracts/deploy/01-foreign-gateway-on-ethereum.ts similarity index 86% rename from contracts/deploy/01-foreign-gateway.ts rename to contracts/deploy/01-foreign-gateway-on-ethereum.ts index a10f8b850..8503a1e4a 100644 --- a/contracts/deploy/01-foreign-gateway.ts +++ b/contracts/deploy/01-foreign-gateway-on-ethereum.ts @@ -1,4 +1,3 @@ -import { parseEther } from "ethers/lib/utils"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import getContractAddress from "../deploy-helpers/getContractAddress"; @@ -16,22 +15,23 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; const chainId = Number(await getChainId()); - console.log("deploying to chainId %s with deployer %s", chainId, deployer); + console.log("Deploying to chainId %s with deployer %s", chainId, deployer); const homeNetworks = { - 1: config.networks.arbitrum, - 5: config.networks.arbitrumGoerli, + ETHEREUM_MAINNET: config.networks.arbitrum, + ETHEREUM_GOERLI: config.networks.arbitrumGoerli, + HARDHAT: config.networks.localhost, }; // Hack to predict the deployment address on the home chain. // TODO: use deterministic deployments - const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[chainId].url); + const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); let nonce = await homeChainProvider.getTransactionCount(deployer); nonce += 2; // HomeGatewayToEthereum deploy tx will the third tx after this on its home network, so we add two to the current nonce. const homeChainId = (await homeChainProvider.getNetwork()).chainId; const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); const homeGatewayAddress = getContractAddress(deployer, nonce); - console.log("calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); + console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); const veaReceiver = await deployments.get("FastBridgeReceiverOnEthereum"); @@ -60,7 +60,7 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme }); }; -deployForeignGateway.tags = ["ForeignChain", "ForeignGateway"]; +deployForeignGateway.tags = ["ForeignGatewayOnEthereum"]; deployForeignGateway.skip = async ({ getChainId }) => { const chainId = Number(await getChainId()); return !ForeignChains[chainId]; diff --git a/contracts/deploy/01-foreign-gateway-on-gnosis.ts b/contracts/deploy/01-foreign-gateway-on-gnosis.ts new file mode 100644 index 000000000..f1966d7eb --- /dev/null +++ b/contracts/deploy/01-foreign-gateway-on-gnosis.ts @@ -0,0 +1,93 @@ +import { parseUnits } from "ethers/lib/utils"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; +import getContractAddress from "../deploy-helpers/getContractAddress"; + +enum ForeignChains { + GNOSIS_MAINNET = 100, + GNOSIS_CHIADO = 10200, + HARDHAT = 31337, +} + +const wethByChain = new Map([ + [ForeignChains.GNOSIS_MAINNET, "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1"], +]); + +const ONE_GWEI = parseUnits("1", "gwei"); + +const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { ethers, deployments, getNamedAccounts, getChainId, config } = hre; + const { deploy, execute } = deployments; + const { hexZeroPad, hexlify } = ethers.utils; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Deploying to chainId %s with deployer %s", chainId, deployer); + + const homeNetworks = { + GNOSIS_MAINNET: config.networks.arbitrum, + GNOSIS_CHIADO: config.networks.arbitrumGoerli, + HARDHAT: config.networks.localhost, + }; + + // Hack to predict the deployment address on the home chain. + // TODO: use deterministic deployments + const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url); + const nonce = await homeChainProvider.getTransactionCount(deployer); + const homeGatewayAddress = getContractAddress(deployer, nonce); // HomeGateway deploy tx will be the next tx home network + console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); + + const veaReceiver = await deployments.get("FastBridgeReceiverOnGnosis"); + console.log("Using FastBridgeReceiverOnGnosis at %s", veaReceiver.address); + + if (!wethByChain.get(chainId)) { + const weth = await deploy("WETH", { + from: deployer, + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + wethByChain.set(ForeignChains[ForeignChains[chainId]], weth.address); + + await deploy("WETHFaucet", { + from: deployer, + contract: "Faucet", + args: [weth.address], + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + } + + const wethAddress = wethByChain.get(ForeignChains[ForeignChains[chainId]]); + const homeChainId = (await homeChainProvider.getNetwork()).chainId; + const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32); + + await deploy("ForeignGatewayOnGnosis", { + from: deployer, + contract: "ForeignGatewayOnGnosis", + args: [deployer, veaReceiver.address, homeGatewayAddress, homeChainIdAsBytes32, wethAddress], + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + // TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary. + await execute( + "ForeignGatewayOnGnosis", + { from: deployer, log: true }, + "changeCourtJurorFee", + 0, + ethers.utils.parseEther("0.00001") + ); +}; + +deployForeignGateway.tags = ["ForeignGatewayOnGnosis"]; +deployForeignGateway.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !ForeignChains[chainId]; +}; + +export default deployForeignGateway; diff --git a/contracts/deploy/02-home-gateway.ts b/contracts/deploy/02-home-gateway-to-ethereum.ts similarity index 68% rename from contracts/deploy/02-home-gateway.ts rename to contracts/deploy/02-home-gateway-to-ethereum.ts index 5c02bee56..f85e9b2cd 100644 --- a/contracts/deploy/02-home-gateway.ts +++ b/contracts/deploy/02-home-gateway-to-ethereum.ts @@ -16,13 +16,16 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; const chainId = Number(await getChainId()); - console.log("deploying to chainId %s with deployer %s", chainId, deployer); + console.log("Deploying to chainId %s with deployer %s", chainId, deployer); - const veaSender = await deployments.get("FastBridgeSender"); + const veaSender = await deployments.get("FastBridgeSenderToEthereum"); const klerosCore = await deployments.get("KlerosCore"); - const foreignGateway = await hre.companionNetworks.foreign.deployments.get("ForeignGatewayOnEthereum"); - const foreignChainId = Number(await hre.companionNetworks.foreign.getChainId()); + const foreignGateway = await hre.companionNetworks.foreignGoerli.deployments.get("ForeignGatewayOnEthereum"); + const foreignChainId = Number(await hre.companionNetworks.foreignGoerli.getChainId()); + const foreignChainName = await hre.companionNetworks.foreignGoerli.deployments.getNetworkName(); + console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); + await deploy("HomeGatewayToEthereum", { from: deployer, contract: "HomeGateway", @@ -31,7 +34,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) }); // nonce+0 }; -deployHomeGateway.tags = ["HomeChain", "HomeGateway"]; +deployHomeGateway.tags = ["HomeGatewayToEthereum"]; deployHomeGateway.skip = async ({ getChainId }) => { const chainId = Number(await getChainId()); return !HomeChains[chainId]; diff --git a/contracts/deploy/02-home-gateway-to-gnosis.ts b/contracts/deploy/02-home-gateway-to-gnosis.ts new file mode 100644 index 000000000..4afc58ac8 --- /dev/null +++ b/contracts/deploy/02-home-gateway-to-gnosis.ts @@ -0,0 +1,42 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_GOERLI = 421613, +} + +// TODO: use deterministic deployments + +const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { deployments, getNamedAccounts, getChainId } = hre; + const { deploy } = deployments; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Deploying to chainId %s with deployer %s", chainId, deployer); + + const veaSender = await deployments.get("FastBridgeSenderToGnosis"); + const klerosCore = await deployments.get("KlerosCore"); + + const foreignGateway = await hre.companionNetworks.foreignChiado.deployments.get("ForeignGatewayOnGnosis"); + const foreignChainId = Number(await hre.companionNetworks.foreignChiado.getChainId()); + const foreignChainName = await hre.companionNetworks.foreignChiado.deployments.getNetworkName(); + console.log("Using ForeignGateway %s on chainId %s (%s)", foreignGateway.address, foreignChainId, foreignChainName); + + await deploy("HomeGatewayToGnosis", { + from: deployer, + contract: "HomeGateway", + args: [deployer, klerosCore.address, veaSender.address, foreignGateway.address, foreignChainId], + log: true, + }); // nonce+0 +}; + +deployHomeGateway.tags = ["HomeGatewayToGnosis"]; +deployHomeGateway.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !HomeChains[chainId]; +}; + +export default deployHomeGateway; diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index 82cf44030..09bdff156 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -14,7 +14,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; - console.log("deploying to chainId %s with deployer %s", HARDHAT_NETWORK, deployer); + console.log("Deploying to chainId %s with deployer %s", HARDHAT_NETWORK, deployer); const klerosCore = await deployments.get("KlerosCore"); @@ -25,7 +25,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const nonce = await ethers.provider.getTransactionCount(deployer); const homeGatewayAddress = getContractAddress(deployer, nonce + 1); - console.log("calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); + console.log("Calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress); const homeChainIdAsBytes32 = hexZeroPad(hexlify(HARDHAT_NETWORK), 32); const foreignGateway = await deploy("ForeignGatewayOnEthereum", { @@ -54,14 +54,14 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const metaEvidenceUri = `https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/goerli/MetaEvidence_ArbitrableExample.json`; - await deploy("ArbitrableExample", { + await deploy("ArbitrableExampleEthFee", { from: deployer, args: [foreignGateway.address, metaEvidenceUri], log: true, }); }; -deployHomeGateway.tags = ["HomeChain", "VeaMock"]; +deployHomeGateway.tags = ["VeaMock"]; deployHomeGateway.skip = async ({ getChainId }) => HARDHAT_NETWORK !== Number(await getChainId()); export default deployHomeGateway; diff --git a/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts new file mode 100644 index 000000000..04bdf0bbd --- /dev/null +++ b/contracts/deploy/04-klerosliquid-to-v2-gnosis.ts @@ -0,0 +1,170 @@ +import { parseUnits, parseEther } from "ethers/lib/utils"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; + +enum ForeignChains { + GNOSIS_MAINNET = 100, + GNOSIS_CHIADO = 10200, + HARDHAT = 31337, +} + +const wrappedPNKByChain = new Map([ + [ForeignChains.GNOSIS_MAINNET, "0xcb3231aBA3b451343e0Fddfc45883c842f223846"], +]); + +const ONE_GWEI = parseUnits("1", "gwei"); + +const deployKlerosLiquid: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { + const { ethers, deployments, getNamedAccounts, getChainId } = hre; + const { deploy, execute } = deployments; + + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address; + const chainId = Number(await getChainId()); + console.log("Deploying to chainId %s with deployer %s", chainId, deployer); + + if (!wrappedPNKByChain.get(chainId)) { + const wPnk = await deploy("WrappedPinakionV2", { + from: deployer, + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + wrappedPNKByChain.set(ForeignChains[ForeignChains[chainId]], wPnk.address); + + await deploy("WPNKFaucet", { + from: deployer, + contract: "Faucet", + args: [wPnk.address], + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + } + + const wPnkAddress = wrappedPNKByChain.get(ForeignChains[ForeignChains[chainId]]); + const rng = ethers.constants.AddressZero; + const minStakingTime = 99999999; + const maxFreezingTime = 0; + const minStake = parseEther("9999999"); + const alpha = 10000; + const feeForJuror = 0; + const jurorsForCourtJump = 9999999; + const sortitionSumTreeK = 3; + const foreignGateway = await deployments.get("ForeignGatewayOnGnosis"); + const weth = await deployments.get("WETH"); + + console.log( + "Using: \nwPNK at %s, \nForeignGateway at %s, \nWETH at %s", + wPnkAddress, + foreignGateway.address, + weth.address + ); + + const sortitionSumTreeLibrary = await deploy("SortitionSumTreeFactory", { + from: deployer, + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + const xKlerosLiquidV2 = await deploy("xKlerosLiquidV2", { + from: deployer, + log: true, + libraries: { + SortitionSumTreeFactory: sortitionSumTreeLibrary.address, + }, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + await execute( + "xKlerosLiquidV2", + { + from: deployer, + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }, + "initialize", + deployer, + wPnkAddress, + rng, + minStakingTime, + maxFreezingTime, + false, + [minStake, alpha, feeForJuror, jurorsForCourtJump], // minStake, alpha, feeForJuror, jurorsForCourtJump + [0, 0, 0, 0], // evidencePeriod, commitPeriod, votePeriod, appealPeriod + sortitionSumTreeK, + foreignGateway.address, + weth.address + ); + + // const xKlerosLiquidV2 = await deployments.get("xKlerosLiquidV2"); + await deploy("ArbitrableExample", { + from: deployer, + args: [ + xKlerosLiquidV2.address, + 0, + "/ipfs/bafkreifteme6tusnjwyzajk75fyvzdmtyycxctf7yhfijb6rfigz3n4lvq", // PoH registration + weth.address, + ], + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }); + + await execute( + "ArbitrableExample", + { + from: deployer, + log: true, + maxFeePerGas: ONE_GWEI, + maxPriorityFeePerGas: ONE_GWEI, + }, + "changeMetaEvidence", + 1, + "/ipfs/bafkreibiuxwejijwg4pxco7fqszawcwmpt26itbdxeqgh7cvpeuwtmlhoa" // PoH clearing + ); +}; + +// TODO: mock deployment on the hardhat network +// const xPinakionByChain = new Map([ +// [ForeignChains.GNOSIS_MAINNET, "0x37b60f4E9A31A64cCc0024dce7D0fD07eAA0F7B3"], +// [ForeignChains.GNOSIS_CHIADO, "0x00"], +// ]); +// const tokenBridgeByChain = new Map([ +// [ForeignChains.GNOSIS_MAINNET, "0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d"], +// [ForeignChains.GNOSIS_CHIADO, "0xbb3c86f9918C3C1d83668fA84e79E876d147fFf2"], +// ]); +// const hardhatDeployer = () => { +// // TODO: deploy mocks for xPinakion and tokenBridge for Hardhat network +// const wEth = await deployments.get("WETH"); +// const wEth = wethByChain[chainId]; +// // const xPnk = await deployments.get("WPNK"); +// const xPnk = xPinakionByChain[chainId]; +// const tokenBridge = tokenBridgeByChain[chainId]; +// const wPnk = await deploy("WrappedPinakionV2", { +// from: deployer, +// log: true, +// }); + +// await execute( +// "WrappedPinakionV2", +// { from: deployer, log: true }, +// "initialize", +// "Staking PNK on xDai", +// "stPNK", +// xPnk, +// tokenBridge +// ); +// }; + +deployKlerosLiquid.tags = ["KlerosLiquidOnGnosis"]; +deployKlerosLiquid.skip = async ({ getChainId }) => { + const chainId = Number(await getChainId()); + return !ForeignChains[chainId]; +}; + +export default deployKlerosLiquid; diff --git a/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json b/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json index f54e609cb..3f2655ad1 100644 --- a/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json +++ b/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json @@ -1,5 +1,5 @@ { - "address": "0xde31F2245d164620d08f5b0f8D43dCe8B9708373", + "address": "0x86734488ABF0E1AD40bc4DE4F820e808f39Bea09", "abi": [ { "inputs": [ @@ -142,12 +142,6 @@ { "anonymous": false, "inputs": [ - { - "indexed": true, - "internalType": "contract IArbitrator", - "name": "_arbitrator", - "type": "address" - }, { "indexed": true, "internalType": "uint256", @@ -982,33 +976,33 @@ "type": "function" } ], - "transactionHash": "0xe47fe5fee608a62d2931193a80dde4634724f82ac2da34af1ff46e45c46da3dc", + "transactionHash": "0x50aaf7931489af863956401738a1b56acf345e62733a7abfe5e343266b31a6f0", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xde31F2245d164620d08f5b0f8D43dCe8B9708373", + "contractAddress": "0x86734488ABF0E1AD40bc4DE4F820e808f39Bea09", "transactionIndex": 1, - "gasUsed": "20519251", + "gasUsed": "3988859", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7ed3b8b8a01a78a4083dc06b4fcf90277442afc02c55b9addd6187f137fa0616", - "transactionHash": "0xe47fe5fee608a62d2931193a80dde4634724f82ac2da34af1ff46e45c46da3dc", + "blockHash": "0xa8fb84f0b6a73d22ee45ecd82436d8ae3015cec6863c8eb5d1270ffecb4e93ed", + "transactionHash": "0x50aaf7931489af863956401738a1b56acf345e62733a7abfe5e343266b31a6f0", "logs": [], - "blockNumber": 4027976, - "cumulativeGasUsed": "20519251", + "blockNumber": 6456825, + "cumulativeGasUsed": "3988859", "status": 1, "byzantium": true }, "args": [ "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", "0x0000000000000000000000000000000000000000", - "0xb82D1eAD813C3a2E729F288276cc402343423Bad", + "0xa2d1A3CDF0becEdb724e5A34De7022B6FF5e4787", 20 ], - "numDeployments": 4, - "solcInputHash": "8e4e08d76a7f02df476a9f91ae4ef934", - "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"CommitCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Contribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_party\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"Evidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"Justification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum DisputeKitClassic.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhaseDisputeKit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOSER_APPEAL_PERIOD_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LOSER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ONE_BASIS_POINT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WINNER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areCommitsAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areVotesAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"castCommit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salt\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"castVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"changeCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"name\":\"changeRandomNumberGenerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\":[],\"name\":\"disputesWithoutJurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"fundAppeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"}],\"name\":\"getCoherentCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getDegreeOfCoherence\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"getFundedChoices\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"fundedChoices\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"totalVoted\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCommited\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVoters\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"choiceCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getVoteInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"commit\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"choice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"voted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isResolving\",\"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\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum DisputeKitClassic.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngLookahead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngRequestedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"submitEvidence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_beneficiary\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"withdrawFeesAndRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"areCommitsAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their commits for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their commits for the last round.\"}},\"areVotesAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their votes for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their votes for the last round.\"}},\"castCommit(uint256,uint256[],bytes32)\":{\"details\":\"Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.\",\"params\":{\"_commit\":\"The commit. Note that justification string is a part of the commit.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"castVote(uint256,uint256[],uint256,uint256,string)\":{\"details\":\"Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.\",\"params\":{\"_choice\":\"The choice.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_justification\":\"Justification of the choice.\",\"_salt\":\"The salt for the commit if the votes were hidden.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"changeCore(address)\":{\"details\":\"Changes the `core` storage variable.\",\"params\":{\"_core\":\"The new value for the `core` storage variable.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeRandomNumberGenerator(address,uint256)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\",\"_rngLookahead\":\"The new value for the `rngLookahead` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\",\"_rngLookahead\":\"Lookahead value for rng.\"}},\"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)\":{\"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.\"},\"returns\":{\"drawnAddress\":\"The drawn address.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"fundAppeal(uint256,uint256)\":{\"details\":\"Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.\",\"params\":{\"_choice\":\"A choice that receives funding.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\"}},\"getCoherentCount(uint256,uint256)\":{\"details\":\"Gets the number of jurors who are eligible to a reward in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"_0\":\"The number of coherent jurors.\"}},\"getDegreeOfCoherence(uint256,uint256,uint256)\":{\"details\":\"Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the vote.\"},\"returns\":{\"_0\":\"The degree of coherence in basis points.\"}},\"isResolving()\":{\"details\":\"Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\",\"returns\":{\"_0\":\"Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\"}},\"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.\"}},\"passPhase()\":{\"details\":\"Passes the phase.\"},\"submitEvidence(uint256,string)\":{\"details\":\"Submits evidence.\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\",\"_evidenceGroupID\":\"Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID.\"}},\"withdrawFeesAndRewards(uint256,address,uint256,uint256)\":{\"details\":\"Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\",\"params\":{\"_beneficiary\":\"The address whose rewards to withdraw.\",\"_choice\":\"The ruling option that the caller wants to withdraw from.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core contract.\",\"_coreRoundID\":\"The round in the Kleros Core contract the caller wants to withdraw from.\"},\"returns\":{\"amount\":\"The withdrawn amount.\"}}},\"stateVariables\":{\"disputesWithoutJurors\":{\"details\":\"Returns the number of disputes without jurors in the dispute kit.\",\"return\":\"The number of disputes without jurors in the dispute kit.\",\"returns\":{\"_0\":\"The number of disputes without jurors in the dispute kit.\"}}},\"title\":\"DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggreation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":\"DisputeKitClassic\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0xe63efdae904b4299c17efd4c6174869a49fbfe1b11ccfd05fcc22e735ced7b26\",\"license\":\"MIT\"},\"src/arbitration/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\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.\\n */\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /**\\n * @dev Emitted when casting a vote to provide the justification of juror's choice.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Address of the juror.\\n * @param _choice The choice juror voted for.\\n * @param _justification Justification of the choice.\\n */\\n event Justification(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\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 */\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() 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 * @return drawnAddress The drawn address.\\n */\\n function draw(uint256 _coreDisputeID) 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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\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 */\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 /** @dev Returns the number of disputes without jurors in the dispute kit.\\n * @return The number of disputes without jurors in the dispute kit.\\n */\\n function disputesWithoutJurors() external view returns (uint256);\\n\\n /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\\n * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\\n */\\n function isResolving() external view returns (bool);\\n}\\n\",\"keccak256\":\"0xecebcf3e67b261c5e521f6bd9fd184151833f521008f38e4935f907ca1f17d0f\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrator.sol\\\";\\nimport \\\"./IDisputeKit.sol\\\";\\nimport {SortitionSumTreeFactory} from \\\"../data-structures/SortitionSumTreeFactory.sol\\\";\\n\\n/**\\n * @title KlerosCore\\n * Core arbitrator contract for Kleros v2.\\n * Note that this contract trusts the token and the dispute kit contracts.\\n */\\ncontract KlerosCore is IArbitrator {\\n using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees; // Use library functions for sortition sum trees.\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n staking, // Stake can be updated during this phase.\\n freezing // Phase during which the dispute kits can undergo the drawing process. Staking is not allowed during this phase.\\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 tokens needed to stake in the court.\\n uint256 alpha; // Basis point of tokens that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrable 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 tokensAtStakePerJuror; // The amount of tokens 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 penalties; // The amount of tokens collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n mapping(uint96 => uint256) stakedTokens; // The number of tokens the juror has staked in the court in the form `stakedTokens[courtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the court in the form `lockedTokens[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n bool needsFreezing; // The dispute kit needs freezing.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n uint256 penalty; // Penalty value, in case the stake was set during execution.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Freezing if there are open disputes.\\n uint256 public maxFreezingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public freezeBlock; // Number of the block when Core was frozen.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n uint256[] public disputesKitIDsThatNeedFreezing; // The disputeKitIDs that need switching to Freezing phase.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n SortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking.\\n\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event NewPhase(Phase _phase);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount, uint256 _newTotalStake);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256 _sortitionSumTreeK,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(uint96 indexed _courtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n int256 _tokenAmount,\\n int256 _ethAmount\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _pinakion The address of the token contract.\\n * @param _jurorProsecutionModule The address of the juror prosecution module.\\n * @param _disputeKit The address of the default dispute kit.\\n * @param _phaseTimeouts minStakingTime and maxFreezingTime respectively\\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 _sortitionSumTreeK The number of children per node of the general court's sortition sum tree.\\n */\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n uint256[2] memory _phaseTimeouts,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionSumTrees.createTree(bytes32(uint256(FORKING_COURT)), _sortitionSumTreeK);\\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 sortitionSumTrees.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionSumTreeK);\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n new uint256[](0)\\n );\\n enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\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 */\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Changes the `pinakion` storage variable.\\n * @param _pinakion The new value for the `pinakion` storage variable.\\n */\\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 */\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /** @dev Changes the `minStakingTime` storage variable.\\n * @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n */\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /** @dev Changes the `maxFreezingTime` storage variable.\\n * @param _maxFreezingTime The new value for the `maxFreezingTime` storage variable.\\n */\\n function changeMaxFreezingTime(uint256 _maxFreezingTime) external onlyByGovernor {\\n maxFreezingTime = _maxFreezingTime;\\n }\\n\\n /** @dev Add a new supported dispute kit module to the court.\\n * @param _disputeKitAddress The address of the dispute kit contract.\\n * @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n * Note that the root DK must be supported by the general court.\\n */\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n require(_parent < disputeKitID, \\\"!Parent\\\");\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n require(depthLevel < SEARCH_ITERATIONS, \\\"Depth level max\\\");\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n needsFreezing: false,\\n depthLevel: depthLevel\\n })\\n );\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /** @dev Creates a court under a specified parent court.\\n * @param _parent The `parent` property value of the court.\\n * @param _hiddenVotes The `hiddenVotes` property value of the court.\\n * @param _minStake The `minStake` property value of the court.\\n * @param _alpha The `alpha` property value of the court.\\n * @param _feeForJuror The `feeForJuror` property value of the court.\\n * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n * @param _sortitionSumTreeK The number of children per node of the court's sortition sum tree.\\n * @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n */\\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 uint256 _sortitionSumTreeK,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n require(courts[_parent].minStake <= _minStake, \\\"MinStake lower than parent court\\\");\\n require(_supportedDisputeKits.length > 0, \\\"!Supported DK\\\");\\n require(_parent != FORKING_COURT, \\\"Invalid: Forking court as parent\\\");\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n require(\\n _supportedDisputeKits[i] > 0 && _supportedDisputeKits[i] < disputeKitNodes.length,\\n \\\"Wrong DK index\\\"\\n );\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionSumTrees.createTree(bytes32(courtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n _supportedDisputeKits\\n );\\n }\\n\\n /** @dev Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\\n * @param _courtID The ID of the court.\\n * @param _minStake The new value for the `minStake` property value.\\n */\\n function changeCourtMinStake(uint96 _courtID, uint256 _minStake) external onlyByGovernor {\\n require(\\n _courtID == GENERAL_COURT || courts[courts[_courtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n require(courts[courts[_courtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_courtID].minStake = _minStake;\\n emit CourtModified(_courtID, \\\"minStake\\\");\\n }\\n\\n /** @dev Changes the `alpha` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _alpha The new value for the `alpha` property value.\\n */\\n function changeCourtAlpha(uint96 _courtID, uint256 _alpha) external onlyByGovernor {\\n courts[_courtID].alpha = _alpha;\\n emit CourtModified(_courtID, \\\"alpha\\\");\\n }\\n\\n /** @dev Changes the `feeForJuror` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n courts[_courtID].feeForJuror = _feeForJuror;\\n emit CourtModified(_courtID, \\\"feeForJuror\\\");\\n }\\n\\n /** @dev Changes the `jurorsForCourtJump` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value.\\n */\\n function changeCourtJurorsForJump(uint96 _courtID, uint256 _jurorsForCourtJump) external onlyByGovernor {\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n emit CourtModified(_courtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeCourtHiddenVotes(uint96 _courtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n emit CourtModified(_courtID, \\\"hiddenVotes\\\");\\n }\\n\\n /** @dev Changes the `timesPerPeriod` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _timesPerPeriod The new value for the `timesPerPeriod` property value.\\n */\\n function changeCourtTimesPerPeriod(uint96 _courtID, uint256[4] memory _timesPerPeriod) external onlyByGovernor {\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(_courtID, \\\"timesPerPeriod\\\");\\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 */\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n require(_disputeKitIDs[i] > 0 && _disputeKitIDs[i] < disputeKitNodes.length, \\\"Wrong DK index\\\");\\n enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\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 _stake The new stake.\\n */\\n function setStake(uint96 _courtID, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _courtID, _stake, 0), \\\"Staking failed\\\");\\n }\\n\\n /** @dev Executes the next delayed stakes.\\n * @param _iterations The number of delayed stakes to execute.\\n */\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"!Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.courtID, delayedStake.stake, delayedStake.penalty);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n /** @dev Creates a dispute. Must be called by the arbitrable contract.\\n * @param _numberOfChoices Number of choices for the jurors to choose from.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes),\\n * the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n * @return disputeID The ID of the created dispute.\\n */\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 courtID, , uint256 disputeKitID) = extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[courtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by court\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = msg.value / court.feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = msg.value;\\n\\n if (!disputeKitNodes[disputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[disputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(disputeKitID);\\n }\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n /** @dev Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\\n */\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(block.timestamp - lastPhaseChange >= minStakingTime, \\\"MinStakingTime not passed\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"No DK needs freezing\\\");\\n phase = Phase.freezing;\\n freezeBlock = block.number;\\n } else {\\n // phase == Phase.freezing\\n bool timeout = this.freezingPhaseTimeout();\\n for (int256 i = int256(disputesKitIDsThatNeedFreezing.length) - 1; i >= 0; --i) {\\n uint256 disputeKitID = disputesKitIDsThatNeedFreezing[uint256(i)];\\n IDisputeKit disputeKit = disputeKitNodes[disputesKitIDsThatNeedFreezing[uint256(i)]].disputeKit;\\n if (timeout && !disputeKit.isResolving()) {\\n // Force the dispute kit to be ready for Staking phase.\\n disputeKit.passPhase(); // Should not be called if already in Resolving phase, because it reverts.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n if (disputeKit.disputesWithoutJurors() == 0) {\\n // The dispute kit had time to finish drawing jurors for all its disputes.\\n disputeKitNodes[disputeKitID].needsFreezing = false;\\n if (i < int256(disputesKitIDsThatNeedFreezing.length) - 1) {\\n // This is not the last element so copy the last element to the current one, then pop.\\n disputesKitIDsThatNeedFreezing[uint256(i)] = disputesKitIDsThatNeedFreezing[\\n disputesKitIDsThatNeedFreezing.length - 1\\n ];\\n }\\n disputesKitIDsThatNeedFreezing.pop();\\n }\\n }\\n }\\n phase = Phase.staking;\\n }\\n // Should not be reached if the phase is unchanged.\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /** @dev Passes the period of a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n */\\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 require(\\n currentRound > 0 ||\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Evidence not passed && !Appeal\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"Dispute still drawing\\\");\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID),\\n \\\"Commit period not passed\\\"\\n );\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID),\\n \\\"Vote period not passed\\\"\\n );\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Appeal period not passed\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"Dispute period is final\\\");\\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 */\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n require(phase == Phase.freezing, \\\"Wrong phase\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n require(dispute.period == Period.evidence, \\\"!Evidence period\\\");\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n uint256 startIndex = round.drawnJurors.length;\\n uint256 endIndex = startIndex + _iterations <= round.nbVotes ? startIndex + _iterations : round.nbVotes;\\n\\n for (uint256 i = startIndex; i < endIndex; i++) {\\n address drawnAddress = disputeKit.draw(_disputeID);\\n if (drawnAddress != address(0)) {\\n // In case no one has staked at the court yet.\\n jurors[drawnAddress].lockedTokens[dispute.courtID] += round.tokensAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n }\\n }\\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 */\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"ETH too low for appeal cost\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute not appealable\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), \\\"Dispute Kit only\\\");\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n if (!disputeKitNodes[newDisputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[newDisputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(newDisputeKitID);\\n }\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /** @dev Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\\n * @param _disputeID The ID of the dispute.\\n * @param _round The appeal round.\\n * @param _iterations The number of iterations to run.\\n */\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 end = round.repartitions + _iterations;\\n uint256 penaltiesInRoundCache = round.penalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n address account; // Address of the juror.\\n uint256 degreeOfCoherence; // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\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 penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n\\n for (uint256 i = round.repartitions; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n // Penalty.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i);\\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 // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.tokensAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n penaltiesInRoundCache += penalty;\\n\\n account = round.drawnJurors[i];\\n jurors[account].lockedTokens[dispute.courtID] -= penalty; // Release this part of locked tokens.\\n\\n // Can only update the stake if it is able to cover the minStake and penalty, otherwise unstake from the court.\\n if (jurors[account].stakedTokens[dispute.courtID] >= courts[dispute.courtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.courtID] - penalty;\\n setStakeForAccount(account, dispute.courtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.courtID] != 0) {\\n setStakeForAccount(account, dispute.courtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n uint96[] memory courtIDs = getJurorCourtIDs(account);\\n for (uint256 j = 0; j < courtIDs.length; j++) {\\n setStakeForAccount(account, courtIDs[j], 0, 0);\\n }\\n }\\n emit TokenAndETHShift(account, _disputeID, -int256(penalty), 0);\\n\\n if (i == numberOfVotesInRound - 1) {\\n if (coherentCount == 0) {\\n // No one was coherent. Send the rewards to governor.\\n payable(governor).send(round.totalFeesForJurors);\\n safeTransfer(governor, penaltiesInRoundCache);\\n }\\n }\\n } else {\\n // Reward.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);\\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 account = round.drawnJurors[i % numberOfVotesInRound];\\n\\n // Release the rest of the tokens of the juror for this round.\\n jurors[account].lockedTokens[dispute.courtID] -=\\n (round.tokensAtStakePerJuror * degreeOfCoherence) /\\n ALPHA_DIVISOR;\\n\\n // Give back the locked tokens in case the juror fully unstaked earlier.\\n if (jurors[account].stakedTokens[dispute.courtID] == 0) {\\n uint256 tokenLocked = (round.tokensAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenLocked);\\n }\\n\\n uint256 tokenReward = ((penaltiesInRoundCache / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n uint256 ethReward = ((round.totalFeesForJurors / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenReward);\\n payable(account).send(ethReward);\\n emit TokenAndETHShift(account, _disputeID, int256(tokenReward), int256(ethReward));\\n }\\n }\\n\\n if (round.penalties != penaltiesInRoundCache) {\\n round.penalties = penaltiesInRoundCache;\\n }\\n round.repartitions = end;\\n }\\n\\n /** @dev Executes a specified dispute's ruling. UNTRUSTED.\\n * @param _disputeID The ID of the dispute.\\n */\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n require(!dispute.ruled, \\\"Ruling already executed\\\");\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /** @dev Gets the cost of arbitration in a specified court.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes)\\n * and the minimum number of jurors required (next 32 bytes).\\n * @return cost The arbitration cost.\\n */\\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 Gets the cost of appealing a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n * @return cost The appeal cost.\\n */\\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 */\\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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(\\n uint256 _disputeID,\\n uint256 _round\\n )\\n external\\n view\\n returns (\\n uint256 tokensAtStakePerJuror,\\n uint256 totalFeesForJurors,\\n uint256 repartitions,\\n uint256 penalties,\\n address[] memory drawnJurors,\\n uint256 disputeKitID\\n )\\n {\\n Round storage round = disputes[_disputeID].rounds[_round];\\n return (\\n round.tokensAtStakePerJuror,\\n round.totalFeesForJurors,\\n round.repartitions,\\n round.penalties,\\n round.drawnJurors,\\n round.disputeKitID\\n );\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _courtID) external view returns (uint256 staked, uint256 locked) {\\n staked = jurors[_juror].stakedTokens[_courtID];\\n locked = jurors[_juror].lockedTokens[_courtID];\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /** @dev Gets non-primitive properties of a specified dispute kit node.\\n * @param _disputeKitID The ID of the dispute kit.\\n * @return children Indexes of children of this DK.\\n */\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /** @dev Gets the timesPerPeriod array for a given court.\\n * @param _courtID The ID of the court to get the times from.\\n * @return timesPerPeriod The timesPerPeriod array for the given court.\\n */\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) external view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTree(\\n bytes32 _key,\\n uint256 _nodeIndex\\n ) public view returns (uint256 K, uint256 length, bytes32 ID) {\\n SortitionSumTreeFactory.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n length = tree.nodes.length;\\n ID = tree.nodeIndexesToIDs[_nodeIndex];\\n }\\n\\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 function freezingPhaseTimeout() external view returns (bool) {\\n return phase == Phase.freezing && block.timestamp - lastPhaseChange >= maxFreezingTime;\\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 */\\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 getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /** @dev Sets the specified juror's stake in a court.\\n * `O(n + p * log_k(j))` where\\n * `n` is the number of courts the juror has staked in,\\n * `p` is the depth of the court tree,\\n * `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n * and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n * @param _account The address of the juror.\\n * @param _courtID The ID of the court.\\n * @param _stake The new stake.\\n * @param _penalty Penalized amount won't be transferred back to juror when the stake is lowered.\\n * @return succeeded True if the call succeeded, false otherwise.\\n */\\n function setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndCourtIDToStakePathID(_account, _courtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_courtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_courtID].minStake || _stake < juror.lockedTokens[_courtID]) return false;\\n if (currentStake == 0 && juror.courtIDs.length >= MAX_STAKE_PATHS) return false;\\n }\\n\\n // Delayed action logic.\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake,\\n penalty: _penalty\\n });\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_stake >= currentStake) {\\n transferredAmount = _stake - currentStake;\\n if (transferredAmount > 0) {\\n if (safeTransferFrom(_account, address(this), transferredAmount)) {\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n return false;\\n }\\n }\\n } else if (_stake == 0) {\\n // Keep locked tokens in the contract and release them after dispute is executed.\\n transferredAmount = currentStake - juror.lockedTokens[_courtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\n for (uint256 i = 0; i < juror.courtIDs.length; i++) {\\n if (juror.courtIDs[i] == _courtID) {\\n juror.courtIDs[i] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n } else {\\n return false;\\n }\\n }\\n } else {\\n transferredAmount = currentStake - _stake - _penalty;\\n if (transferredAmount > 0) {\\n if (!safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n }\\n\\n // Update juror's records.\\n uint256 newTotalStake = juror.stakedTokens[_courtID] - currentStake + _stake;\\n juror.stakedTokens[_courtID] = newTotalStake;\\n\\n // Update court parents.\\n bool finished = false;\\n uint256 currentCourtID = _courtID;\\n while (!finished) {\\n sortitionSumTrees.set(bytes32(currentCourtID), _stake, stakePathID);\\n if (currentCourtID == GENERAL_COURT) finished = true;\\n else currentCourtID = courts[currentCourtID].parent;\\n }\\n\\n emit StakeSet(_account, _courtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n * Note that if extradata contains an incorrect value then this value will be switched to default.\\n * @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return courtID The court ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\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 = MIN_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a court ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _courtID The court ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n\\n /** @dev Calls transfer() without reverting.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransfer(address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transfer.selector, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /** @dev Calls transferFrom() without reverting.\\n * @param _from Sender address.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0xde11c91f411945f1437a1dbd14995162def51b507086fa41d3113f121c047bf0\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/BaseDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"../IDisputeKit.sol\\\";\\nimport \\\"../KlerosCore.sol\\\";\\n\\n/**\\n * @title BaseDisputeKit\\n * Provides common basic behaviours to the Dispute Kit implementations.\\n */\\nabstract contract BaseDisputeKit is IDisputeKit {\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The Kleros Core arbitrator\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _core The KlerosCore arbitrator.\\n */\\n constructor(address _governor, KlerosCore _core) {\\n governor = _governor;\\n core = _core;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n require(success, \\\"Unsuccessful call\\\");\\n }\\n\\n /** @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Chosen address.\\n * @return Whether the address can be drawn or not.\\n */\\n function postDrawCheck(uint256 _coreDisputeID, address _juror) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1b7fe7456537ffe8a7f84b45e9d5081703895233827ba4a9aa0c545a4ae4f8\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./BaseDisputeKit.sol\\\";\\nimport \\\"../../rng/RNG.sol\\\";\\nimport \\\"../../evidence/IEvidence.sol\\\";\\n\\n/**\\n * @title DisputeKitClassic\\n * Dispute kit implementation of the Kleros v1 features including:\\n * - a drawing system: proportional to staked PNK,\\n * - a vote aggreation system: plurality,\\n * - an incentive system: equal split between coherent votes,\\n * - an appeal system: fund 2 choices only, vote on any choice.\\n */\\ncontract DisputeKitClassic is BaseDisputeKit, IEvidence {\\n // ************************************* //\\n // * Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n resolving, // No disputes that need drawing.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn.\\n }\\n\\n struct Dispute {\\n Round[] rounds; // Rounds of the dispute. 0 is the default round, and [1, ..n] are the appeal rounds.\\n uint256 numberOfChoices; // The number of choices jurors have when voting. This does not include choice `0` which is reserved for \\\"refuse to arbitrate\\\".\\n bool jumped; // True if dispute jumped to a parent dispute kit and won't be handled by this DK anymore.\\n mapping(uint256 => uint256) coreRoundIDToLocal; // Maps id of the round in the core contract to the index of the round of related local dispute.\\n bytes extraData; // Extradata for the dispute.\\n }\\n\\n struct Round {\\n Vote[] votes; // Former votes[_appeal][].\\n uint256 winningChoice; // The choice with the most votes. Note that in the case of a tie, it is the choice that reached the tied number of votes first.\\n mapping(uint256 => uint256) counts; // The sum of votes for each choice in the form `counts[choice]`.\\n bool tied; // True if there is a tie, false otherwise.\\n uint256 totalVoted; // Former uint[_appeal] votesInEachRound.\\n uint256 totalCommitted; // Former commitsInRound.\\n mapping(uint256 => uint256) paidFees; // Tracks the fees paid for each choice in this round.\\n mapping(uint256 => bool) hasPaid; // True if this choice was fully funded, false otherwise.\\n mapping(address => mapping(uint256 => uint256)) contributions; // Maps contributors to their contributions for each choice.\\n uint256 feeRewards; // Sum of reimbursable appeal fees available to the parties that made contributions to the ruling that ultimately wins a dispute.\\n uint256[] fundedChoices; // Stores the choices that are fully funded.\\n uint256 nbVotes; // Maximal number of votes this dispute can get.\\n }\\n\\n struct Vote {\\n address account; // The address of the juror.\\n bytes32 commit; // The commit of the juror. For courts with hidden votes.\\n uint256 choice; // The choice of the juror.\\n bool voted; // True if the vote has been cast.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant WINNER_STAKE_MULTIPLIER = 10000; // Multiplier of the appeal cost that the winner has to pay as fee stake for a round in basis points. Default is 1x of appeal fee.\\n uint256 public constant LOSER_STAKE_MULTIPLIER = 20000; // Multiplier of the appeal cost that the loser has to pay as fee stake for a round in basis points. Default is 2x of appeal fee.\\n uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period.\\n uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling.\\n\\n RNG public rng; // The random number generator\\n uint256 public rngRequestedBlock; // The block number requested to the random number.\\n uint256 public rngLookahead; // Minimum block distance between requesting and obtaining a random number.\\n uint256 public randomNumber; // The current random number.\\n Phase public phase; // Current phase of this dispute kit.\\n uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors.\\n Dispute[] public disputes; // Array of the locally created disputes.\\n mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event DisputeCreation(uint256 indexed _coreDisputeID, uint256 _numberOfChoices, bytes _extraData);\\n\\n event CommitCast(uint256 indexed _coreDisputeID, uint256[] _voteIDs, bytes32 _commit);\\n\\n event Contribution(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n event Withdrawal(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n event ChoiceFunded(uint256 indexed _coreDisputeID, uint256 indexed _coreRoundID, uint256 indexed _choice);\\n event NewPhaseDisputeKit(Phase _phase);\\n\\n // ************************************* //\\n // * Modifiers * //\\n // ************************************* //\\n\\n modifier notJumped(uint256 _coreDisputeID) {\\n require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, \\\"Dispute jumped to a parent DK!\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _core The KlerosCore arbitrator.\\n * @param _rng The random number generator.\\n * @param _rngLookahead Lookahead value for rng.\\n */\\n constructor(address _governor, KlerosCore _core, RNG _rng, uint256 _rngLookahead) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Changes the `governor` storage variable.\\n * @param _governor The new value for the `governor` storage variable.\\n */\\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 */\\n function changeCore(address _core) external onlyByGovernor {\\n core = KlerosCore(_core);\\n }\\n\\n /** @dev Changes the `_rng` storage variable.\\n * @param _rng The new value for the `RNGenerator` storage variable.\\n * @param _rngLookahead The new value for the `rngLookahead` storage variable.\\n */\\n function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n if (phase == Phase.generating) {\\n rngRequestedBlock = block.number + rngLookahead;\\n rng.requestRandomness(rngRequestedBlock);\\n }\\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 */\\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 disputesWithoutJurors++;\\n emit DisputeCreation(_coreDisputeID, _numberOfChoices, _extraData);\\n }\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() external override {\\n if (core.phase() == KlerosCore.Phase.staking || core.freezingPhaseTimeout()) {\\n require(phase != Phase.resolving, \\\"Already in Resolving phase\\\");\\n phase = Phase.resolving; // Safety net.\\n } else if (core.phase() == KlerosCore.Phase.freezing) {\\n if (phase == Phase.resolving) {\\n require(disputesWithoutJurors > 0, \\\"All the disputes have jurors\\\");\\n rngRequestedBlock = core.freezeBlock() + rngLookahead;\\n rng.requestRandomness(rngRequestedBlock);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n randomNumber = rng.receiveRandomness(rngRequestedBlock);\\n require(randomNumber != 0, \\\"Random number is not ready yet\\\");\\n phase = Phase.drawing;\\n } else if (phase == Phase.drawing) {\\n require(disputesWithoutJurors == 0, \\\"Not ready for Resolving phase\\\");\\n phase = Phase.resolving;\\n }\\n }\\n // Should not be reached if the phase is unchanged.\\n emit NewPhaseDisputeKit(phase);\\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 * @return drawnAddress The drawn address.\\n */\\n function draw(\\n uint256 _coreDisputeID\\n ) external override onlyByCore notJumped(_coreDisputeID) returns (address drawnAddress) {\\n require(phase == Phase.drawing, \\\"Should be in drawing phase\\\");\\n\\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 bytes32 key = bytes32(uint256(courtID)); // Get the ID of the tree.\\n\\n (uint256 K, uint256 nodesLength, ) = core.getSortitionSumTree(key, 0);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = uint256(\\n keccak256(abi.encodePacked(randomNumber, _coreDisputeID, round.votes.length))\\n );\\n currentDrawnNumber %= core.getSortitionSumTreeNode(key, 0);\\n\\n // TODO: Handle the situation when no one has staked yet.\\n\\n // While it still has children\\n while ((K * treeIndex) + 1 < nodesLength) {\\n for (uint256 i = 1; i <= K; i++) {\\n // Loop over children.\\n uint256 nodeIndex = (K * treeIndex) + i;\\n uint256 nodeValue = core.getSortitionSumTreeNode(key, nodeIndex);\\n\\n if (currentDrawnNumber >= nodeValue) {\\n // Go to the next child.\\n currentDrawnNumber -= nodeValue;\\n } else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n }\\n\\n (, , bytes32 ID) = core.getSortitionSumTree(key, treeIndex);\\n drawnAddress = stakePathIDToAccount(ID);\\n\\n if (postDrawCheck(_coreDisputeID, drawnAddress)) {\\n round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false}));\\n if (round.votes.length == round.nbVotes) {\\n disputesWithoutJurors--;\\n }\\n } else {\\n drawnAddress = address(0);\\n }\\n }\\n\\n /** @dev Sets the caller's commit for the specified votes. It can be called multiple times during the\\n * commit period, each call overrides the commits of the previous one.\\n * `O(n)` where\\n * `n` is the number of votes.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @param _voteIDs The IDs of the votes.\\n * @param _commit The commit. Note that justification string is a part of the commit.\\n */\\n function castCommit(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.commit, \\\"The dispute should be in Commit period.\\\");\\n require(_commit != bytes32(0), \\\"Empty commit.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n round.votes[_voteIDs[i]].commit = _commit;\\n }\\n round.totalCommitted += _voteIDs.length;\\n emit CommitCast(_coreDisputeID, _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 */\\n function castVote(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.vote, \\\"The dispute should be in Vote period.\\\");\\n require(_voteIDs.length > 0, \\\"No voteID provided\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"Choice out of bounds\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , ) = core.courts(courtID);\\n\\n // Save the votes.\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n require(\\n !hiddenVotes ||\\n round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),\\n \\\"The commit must match the choice in courts with hidden votes.\\\"\\n );\\n require(!round.votes[_voteIDs[i]].voted, \\\"Vote already cast.\\\");\\n round.votes[_voteIDs[i]].choice = _choice;\\n round.votes[_voteIDs[i]].voted = true;\\n }\\n\\n round.totalVoted += _voteIDs.length;\\n\\n round.counts[_choice] += _voteIDs.length;\\n if (_choice == round.winningChoice) {\\n if (round.tied) round.tied = false;\\n } else {\\n // Voted for another choice.\\n if (round.counts[_choice] == round.counts[round.winningChoice]) {\\n // Tie.\\n if (!round.tied) round.tied = true;\\n } else if (round.counts[_choice] > round.counts[round.winningChoice]) {\\n // New winner.\\n round.winningChoice = _choice;\\n round.tied = false;\\n }\\n }\\n emit Justification(_coreDisputeID, msg.sender, _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 */\\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 disputesWithoutJurors++;\\n }\\n core.appeal{value: appealCost}(_coreDisputeID, dispute.numberOfChoices, dispute.extraData);\\n }\\n\\n if (msg.value > contribution) payable(msg.sender).send(msg.value - contribution);\\n }\\n\\n /** @dev Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\\n * @param _coreDisputeID Index of the dispute in Kleros Core contract.\\n * @param _beneficiary The address whose rewards to withdraw.\\n * @param _coreRoundID The round in the Kleros Core contract the caller wants to withdraw from.\\n * @param _choice The ruling option that the caller wants to withdraw from.\\n * @return amount The withdrawn amount.\\n */\\n function withdrawFeesAndRewards(\\n uint256 _coreDisputeID,\\n address payable _beneficiary,\\n uint256 _coreRoundID,\\n uint256 _choice\\n ) external returns (uint256 amount) {\\n (, , , bool isRuled, ) = core.disputes(_coreDisputeID);\\n require(isRuled, \\\"Dispute should be resolved.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 finalRuling, , ) = core.currentRuling(_coreDisputeID);\\n\\n if (!round.hasPaid[_choice]) {\\n // Allow to reimburse if funding was unsuccessful for this ruling option.\\n amount = round.contributions[_beneficiary][_choice];\\n } else {\\n // Funding was successful for this ruling option.\\n if (_choice == finalRuling) {\\n // This ruling option is the ultimate winner.\\n amount = round.paidFees[_choice] > 0\\n ? (round.contributions[_beneficiary][_choice] * round.feeRewards) / round.paidFees[_choice]\\n : 0;\\n } else if (!round.hasPaid[finalRuling]) {\\n // The ultimate winner was not funded in this round. In this case funded ruling option(s) are reimbursed.\\n amount =\\n (round.contributions[_beneficiary][_choice] * round.feeRewards) /\\n (round.paidFees[round.fundedChoices[0]] + round.paidFees[round.fundedChoices[1]]);\\n }\\n }\\n round.contributions[_beneficiary][_choice] = 0;\\n\\n if (amount != 0) {\\n _beneficiary.send(amount); // Deliberate use of send to prevent reverting fallback. It's the user's responsibility to accept ETH.\\n emit Withdrawal(_coreDisputeID, _coreRoundID, _choice, _beneficiary, amount);\\n }\\n }\\n\\n /** @dev Submits evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID.\\n * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\\n */\\n function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external {\\n emit Evidence(core, _evidenceGroupID, msg.sender, _evidence);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return lastRound.fundedChoices;\\n }\\n\\n /** @dev Gets the current ruling of a specified dispute.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @return ruling The current ruling.\\n * @return tied Whether it's a tie or not.\\n * @return overridden Whether the ruling was overridden by appeal funding or not.\\n */\\n function currentRuling(\\n uint256 _coreDisputeID\\n ) external view override returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n tied = round.tied;\\n ruling = tied ? 0 : round.winningChoice;\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n // Override the final ruling if only one side funded the appeals.\\n if (period == KlerosCore.Period.execution) {\\n uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);\\n if (fundedChoices.length == 1) {\\n ruling = fundedChoices[0];\\n tied = false;\\n overridden = true;\\n }\\n }\\n }\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (uint256) {\\n // In this contract this degree can be either 0 or 1, but in other dispute kits this value can be something in between.\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (vote.voted && (vote.choice == winningChoice || tied)) {\\n return ONE_BASIS_POINT;\\n } else {\\n return 0;\\n }\\n }\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\n function areCommitsAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalCommitted == round.votes.length;\\n }\\n\\n /** @dev Returns true if all of the jurors have cast their votes for the last round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @return Whether all of the jurors have cast their votes for the last round.\\n */\\n function areVotesAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalVoted == round.votes.length;\\n }\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 function isResolving() external view override returns (bool) {\\n return phase == Phase.resolving;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /** @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Chosen address.\\n * @return Whether the address can be drawn or not.\\n */\\n function postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) {\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, courtID);\\n (, , uint256 minStake, , , ) = core.courts(courtID);\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror && stakedTokens >= minStake;\\n }\\n\\n /** @dev Retrieves a juror's address from the stake path ID.\\n * @param _stakePathID The stake path ID to unpack.\\n * @return account The account.\\n */\\n function stakePathIDToAccount(bytes32 _stakePathID) internal pure returns (address account) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(add(ptr, 0x0c), i), byte(i, _stakePathID))\\n }\\n account := mload(ptr)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9335de3cd52df282fe9f1999a943dded16eb6281a75276d1a17efc3ed2483ef1\",\"license\":\"MIT\"},\"src/data-structures/SortitionSumTreeFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactory\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactory {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _K\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _value,\\n bytes32 _ID\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n )\\n external\\n view\\n returns (\\n uint256 startIndex,\\n uint256[] memory values,\\n bool hasMore\\n )\\n {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n bytes32 _ID\\n ) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x158abfe345fecd93d3d6de008c01f4f72ffb03af5c6fbdf0208c7228fc978114\",\"license\":\"MIT\"},\"src/evidence/IEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IEvidence\\n * ERC-1497: Evidence Standard\\n */\\ninterface IEvidence {\\n /**\\n * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\\n * @param _arbitrator The arbitrator of the contract.\\n * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.\\n * @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\\n * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\\n */\\n event Evidence(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _evidenceGroupID,\\n address indexed _party,\\n string _evidence\\n );\\n}\\n\",\"keccak256\":\"0x9656bf34a7ec73bb3b42b6a880047736f395074ac1841096fec7f65337c197d4\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface RNG {\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRandomness(uint256 _block) external;\\n\\n /**\\n * @dev Receive the random number.\\n * @param _block Block the random number is linked to.\\n * @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x0075973344648673365c5a895e4315101e6ce896208a71eb7767f5a61bbf0fe1\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620046ea380380620046ea833981016040819052620000349162000093565b600080546001600160a01b03199081166001600160a01b0396871617909155600180548216948616949094179093556002805490931691909316179055600455620000ed565b6001600160a01b03811681146200009057600080fd5b50565b60008060008060808587031215620000aa57600080fd5b8451620000b7816200007a565b6020860151909450620000ca816200007a565b6040860151909350620000dd816200007a565b6060959095015193969295505050565b6145ed80620000fd6000396000f3fe6080604052600436106101cf5760003560e01c8063796490f9116100f8578063ba66fde711610090578063ba66fde7146105cd578063be467604146105ed578063c86ed89214610603578063ccbac9f514610618578063d605787b1461062e578063da3beb8c1461064e578063e349ad3014610498578063e4c0aaf41461066e578063f2f4eb261461068e57600080fd5b8063796490f9146104985780637c04034e146104ae5780637dc38f14146104ce5780638e426460146104e4578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b80634b2f0ea01161016b5780634b2f0ea01461033c5780634dbbebbc1461034f5780634fe264fb1461036f578063564a565d1461038f5780635c92e2f6146103be57806365540b96146103de57806369f3f0411461040b5780636d4cd8ea14610458578063751accd01461047857600080fd5b806303432744146101d45780630b274f2e146101fd5780630baa64d1146102145780630c340a24146102445780631200aabc1461027c5780631c3db16d146102a95780632cad95c0146102e6578063362c3479146102fc5780633b3041471461031c575b600080fd5b3480156101e057600080fd5b506101ea60075481565b6040519081526020015b60405180910390f35b34801561020957600080fd5b506102126106ae565b005b34801561022057600080fd5b5061023461022f366004613a08565b610c32565b60405190151581526020016101f4565b34801561025057600080fd5b50600054610264906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b34801561028857600080fd5b506101ea610297366004613a08565b60096020526000908152604090205481565b3480156102b557600080fd5b506102c96102c4366004613a08565b610ca9565b6040805193845291151560208401521515908201526060016101f4565b3480156102f257600080fd5b506101ea60035481565b34801561030857600080fd5b506101ea610317366004613a39565b610e28565b34801561032857600080fd5b50610264610337366004613a08565b611218565b61021261034a366004613a76565b6117f9565b34801561035b57600080fd5b5061021261036a366004613a98565b6120d2565b34801561037b57600080fd5b506101ea61038a366004613ac4565b6121af565b34801561039b57600080fd5b506103af6103aa366004613a08565b612301565b6040516101f493929190613b48565b3480156103ca57600080fd5b506102126103d9366004613bbd565b6123c7565b3480156103ea57600080fd5b506103fe6103f9366004613a08565b6126e1565b6040516101f49190613c0f565b34801561041757600080fd5b5061042b610426366004613ac4565b6127a5565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f4565b34801561046457600080fd5b50610234610473366004613a08565b61285d565b34801561048457600080fd5b50610212610493366004613cf0565b6128d4565b3480156104a457600080fd5b506101ea61271081565b3480156104ba57600080fd5b506102126104c9366004613d5c565b6129a6565b3480156104da57600080fd5b506101ea60045481565b3480156104f057600080fd5b506102126104ff366004613df4565b6130ac565b34801561051057600080fd5b5061021261051f366004613e52565b6130f8565b34801561053057600080fd5b5061054461053f366004613ac4565b61314a565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f4565b34801561057c57600080fd5b5060065461058a9060ff1681565b6040516101f49190613eb3565b3480156105a357600080fd5b506101ea614e2081565b3480156105b957600080fd5b506102126105c8366004613edb565b613210565b3480156105d957600080fd5b506102346105e8366004613ac4565b6133f3565b3480156105f957600080fd5b506101ea61138881565b34801561060f57600080fd5b5061023461348e565b34801561062457600080fd5b506101ea60055481565b34801561063a57600080fd5b50600254610264906001600160a01b031681565b34801561065a57600080fd5b506101ea610669366004613a76565b6134ae565b34801561067a57600080fd5b50610212610689366004613df4565b613610565b34801561069a57600080fd5b50600154610264906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613f35565b600181111561073c5761073c613e9d565b14806107c95750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190613f6b565b1561085457600060065460ff1660028111156107e7576107e7613e9d565b141561083a5760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600680546000919060ff19166001835b0217905550610bf1565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108db9190613f35565b60018111156108ec576108ec613e9d565b1415610bf157600060065460ff16600281111561090b5761090b613e9d565b1415610a6c576000600754116109635760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f7273000000006044820152606401610831565b600454600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b457600080fd5b505afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190613f86565b6109f69190613fb5565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b5050600680546001935090915060ff1916828061084a565b600160065460ff166002811115610a8557610a85613e9d565b1415610b77576002546003546040516304f3e41560e21b81526001600160a01b03909216916313cf905491610ac09160040190815260200190565b602060405180830381600087803b158015610ada57600080fd5b505af1158015610aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b129190613f86565b6005819055610b635760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610831565b600680546002919060ff191660018361084a565b600260065460ff166002811115610b9057610b90613e9d565b1415610bf15760075415610be65760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e672070686173650000006044820152606401610831565b6006805460ff191690555b6006546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c289160ff90911690613eb3565b60405180910390a1565b600081815260096020526040812054600880548392908110610c5657610c56613fcd565b60009182526020822060059091020180549092508290610c7890600190613fe3565b81548110610c8857610c88613fcd565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806008600960008781526020019081526020016000205481548110610cd557610cd5613fcd565b60009182526020822060059091020180549092508290610cf790600190613fe3565b81548110610d0757610d07613fcd565b60009182526020909120600c90910201600381015460ff169450905083610d32578060010154610d35565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190614011565b5090935060049250610dc7915050565b816004811115610dd957610dd9613e9d565b1415610e1e576000610dea886126e1565b9050805160011415610e1c5780600081518110610e0957610e09613fcd565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610e7157600080fd5b505afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190614011565b50935050505080610efc5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e00000000006044820152606401610831565b600086815260096020526040812054600880549091908110610f2057610f20613fcd565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610f5457610f54613fcd565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160606040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe29190614078565b5050600087815260078401602052604090205490915060ff1661102c576001600160a01b038816600090815260088301602090815260408083208984529091529020549450611172565b808614156110a257600086815260068301602052604090205461105057600061109b565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461109191906140b4565b61109b91906140e9565b9450611172565b600081815260078301602052604090205460ff166111725781600601600083600a016001815481106110d6576110d6613fcd565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061110c5761110c613fcd565b90600052602060002001548152602001908152602001600020546111309190613fb5565b60098301546001600160a01b038a16600090815260088501602090815260408083208b845290915290205461116591906140b4565b61116f91906140e9565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561120c576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146112455760405162461bcd60e51b8152600401610831906140fd565b60008281526009602052604090205460088054849290811061126957611269613fcd565b600091825260209091206002600590920201015460ff161561129d5760405162461bcd60e51b815260040161083190614141565b600260065460ff1660028111156112b6576112b6613e9d565b146113035760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e672070686173650000000000006044820152606401610831565b60008381526009602052604081205460088054909190811061132757611327613fcd565b6000918252602082206005909102018054909250829061134990600190613fe3565b8154811061135957611359613fcd565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190614011565b505060015460405163bfabfe8f60e01b81526001600160601b038516600482018190526000602483018190529596509493508392506001600160a01b039091169063bfabfe8f9060440160606040518083038186803b15801561144957600080fd5b505afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114819190614178565b50600554875460408051602081019390935282018d905260608201529193509150600090819060800160408051808303601f19018152908290528051602090910120600154630a48b58160e21b835260048301889052600060248401529092506001600160a01b031690632922d6049060440160206040518083038186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115449190613f86565b61154e90826141a6565b90505b8261155c83866140b4565b611567906001613fb5565b10156116545760015b84811161164e5760008161158485886140b4565b61158e9190613fb5565b600154604051630a48b58160e21b8152600481018a9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613f86565b90508084106116315761162a8185613fe3565b9350611639565b50925061164e565b50508080611646906141ba565b915050611570565b50611551565b60015460405163bfabfe8f60e01b815260048101879052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156116a057600080fd5b505afa1580156116b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d89190614178565b925050506116e58161365c565b9a506116f18c8c613687565b156117e5578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b0154886000018054905014156117e057600780549060006117da836141d5565b91905055505b6117ea565b60009a505b50505050505050505050919050565b60008281526009602052604090205460088054849290811061181d5761181d613fcd565b600091825260209091206002600590920201015460ff16156118515760405162461bcd60e51b815260040161083190614141565b60008381526009602052604081205460088054909190811061187557611875613fcd565b9060005260206000209060050201905080600101548311156118d95760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610831565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561192157600080fd5b505afa158015611935573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195991906141ec565b9150915081421015801561196c57508042105b6119b15760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610831565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d9060240160606040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a259190614078565b5050905086811415611a3b576127109150611abc565b612710611388611a4b8686613fe3565b611a5591906140b4565b611a5f91906140e9565b611a698542613fe3565b10611ab65760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610831565b614e2091505b84546000908690611acf90600190613fe3565b81548110611adf57611adf613fcd565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611b3957600080fd5b505afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b719190613f86565b611b7b9190613fe3565b60008a815260078401602052604090205490915060ff1615611bdf5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610831565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611c2457600080fd5b505afa158015611c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5c9190613f86565b90506000612710611c6d87846140b4565b611c7791906140e9565b611c819083613fb5565b60008c815260068601602052604081205491925090821115611d325760008c81526006860160205260409020543490611cba9084613fe3565b11611cdf5760008c8152600686016020526040902054611cda9083613fe3565b611ce1565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611d29929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f845290915281208054839290611d5e908490613fb5565b909155505060008c815260068601602052604081208054839290611d83908490613fb5565b909155505060008c81526006860160205260409020548211611e555760008c815260068601602052604081205460098701805491929091611dc5908490613fb5565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a8501546001101561209557828560090154611e729190613fe3565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611ebb57600080fd5b505afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef39190613f6b565b15611f0c5760028a01805460ff19166001179055612015565b895460038b016000611f1f876001613fb5565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b8152600401611f9a91815260200190565b60206040518083038186803b158015611fb257600080fd5b505afa158015611fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fea9190613f86565b600b82015560038101805460ff191660011790556007805490600061200e836141ba565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b81526004016120629392919061424b565b6000604051808303818588803b15801561207b57600080fd5b505af115801561208f573d6000803e3d6000fd5b50505050505b803411156120c357336108fc6120ab8334613fe3565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000546001600160a01b031633146120fc5760405162461bcd60e51b815260040161083190614303565b600280546001600160a01b0319166001600160a01b0384161790556004819055600160065460ff16600281111561213557612135613e9d565b14156121ab576004546121489043613fb5565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b15801561219257600080fd5b505af11580156121a6573d6000803e3d6000fd5b505050505b5050565b6000838152600960205260408120546008805483929081106121d3576121d3613fcd565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061220757612207613fcd565b90600052602060002090600c0201600001848154811061222957612229613fcd565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561228257600080fd5b505afa158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba9190614078565b506003850154919350915060ff1680156122de575081836002015414806122de5750805b156122f1576127109450505050506122fa565b60009450505050505b9392505050565b6008818154811061231157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161234490614210565b80601f016020809104026020016040519081016040528092919081815260200182805461237090614210565b80156123bd5780601f10612392576101008083540402835291602001916123bd565b820191906000526020600020905b8154815290600101906020018083116123a057829003601f168201915b5050505050905083565b6000848152600960205260409020546008805486929081106123eb576123eb613fcd565b600091825260209091206002600590920201015460ff161561241f5760405162461bcd60e51b815260040161083190614141565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561246457600080fd5b505afa158015612478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249c9190614011565b50909350600192506124ac915050565b8160048111156124be576124be613e9d565b1461251b5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610831565b826125585760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610831565b60008681526009602052604081205460088054909190811061257c5761257c613fcd565b6000918252602082206005909102018054909250829061259e90600190613fe3565b815481106125ae576125ae613fcd565b90600052602060002090600c0201905060005b8681101561267c5733828989848181106125dd576125dd613fcd565b90506020020135815481106125f4576125f4613fcd565b60009182526020909120600490910201546001600160a01b03161461262b5760405162461bcd60e51b815260040161083190614345565b858289898481811061263f5761263f613fcd565b905060200201358154811061265657612656613fcd565b600091825260209091206001600490920201015580612674816141ba565b9150506125c1565b50868690508160050160008282546126949190613fb5565b92505081905550877f631164ab329e3544c9075658fc5cd19297e0b191060d307414cf10ebc99d4a658888886040516126cf9392919061437c565b60405180910390a25050505050505050565b600081815260096020526040812054600880546060939290811061270757612707613fcd565b6000918252602082206005909102018054909250829061272990600190613fe3565b8154811061273957612739613fcd565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561279757602002820191906000526020600020905b815481526020019060010190808311612783575b505050505092505050919050565b60008060008060008060006008600960008c815260200190815260200160002054815481106127d6576127d6613fcd565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061280a5761280a613fcd565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526009602052604081205460088054839290811061288157612881613fcd565b600091825260208220600590910201805490925082906128a390600190613fe3565b815481106128b3576128b3613fcd565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146128fe5760405162461bcd60e51b815260040161083190614303565b6000836001600160a01b0316838360405161291991906143c2565b60006040518083038185875af1925050503d8060008114612956576040519150601f19603f3d011682016040523d82523d6000602084013e61295b565b606091505b50509050806129a05760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610831565b50505050565b6000868152600960205260409020546008805488929081106129ca576129ca613fcd565b600091825260209091206002600590920201015460ff16156129fe5760405162461bcd60e51b815260040161083190614141565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b158015612a4357600080fd5b505afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b9190614011565b5090935060029250612a8b915050565b816004811115612a9d57612a9d613e9d565b14612af85760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610831565b85612b3a5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610831565b600088815260096020526040812054600880549091908110612b5e57612b5e613fcd565b906000526020600020906005020190508060010154861115612bb95760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610831565b80546000908290612bcc90600190613fe3565b81548110612bdc57612bdc613fcd565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6a9190614011565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612cc057600080fd5b505afa158015612cd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf891906143de565b5050505091505060005b8a811015612f745733848d8d84818110612d1e57612d1e613fcd565b9050602002013581548110612d3557612d35613fcd565b60009182526020909120600490910201546001600160a01b031614612d6c5760405162461bcd60e51b815260040161083190614345565b811580612de0575089888a604051602001612d8993929190614436565b60405160208183030381529060405280519060200120846000018d8d84818110612db557612db5613fcd565b9050602002013581548110612dcc57612dcc613fcd565b906000526020600020906004020160010154145b612e525760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610831565b838c8c83818110612e6557612e65613fcd565b9050602002013581548110612e7c57612e7c613fcd565b600091825260209091206003600490920201015460ff1615612ed55760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610831565b89848d8d84818110612ee957612ee9613fcd565b9050602002013581548110612f0057612f00613fcd565b60009182526020909120600260049092020101556001848d8d84818110612f2957612f29613fcd565b9050602002013581548110612f4057612f40613fcd565b60009182526020909120600490910201600301805460ff191691151591909117905580612f6c816141ba565b915050612d02565b508a8a9050836004016000828254612f8c9190613fb5565b90915550506000898152600284016020526040812080548c9290612fb1908490613fb5565b90915550506001830154891415612fe157600383015460ff1615612fdc5760038301805460ff191690555b61305b565b60018301546000908152600284016020526040808220548b8352912054141561302457600383015460ff16612fdc5760038301805460ff1916600117905561305b565b60018301546000908152600284016020526040808220548b8352912054111561305b576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a6040516130969190614463565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146130d65760405162461bcd60e51b815260040161083190614303565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c9061313d908790879061449f565b60405180910390a4505050565b60008060008060006008600960008a8152602001908152602001600020548154811061317857613178613fcd565b600091825260208083208a84526003600590930201918201905260408220548154919350839181106131ac576131ac613fcd565b90600052602060002090600c020160000187815481106131ce576131ce613fcd565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b0316331461323a5760405162461bcd60e51b8152600401610831906140fd565b60088054600181018255600091909152600581027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee481018690557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101906132c5907ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee701868661396f565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561331757600080fd5b505afa15801561332b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334f9190613f86565b6133599190613fe3565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600990925282208490556007805491926133ba836141ba565b9190505550877fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581088888886040516126cf939291906144bb565b60008381526009602052604081205460088054839290811061341757613417613fcd565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061344b5761344b613fcd565b90600052602060002090600c0201600001848154811061346d5761346d613fcd565b600091825260209091206004909102016003015460ff169695505050505050565b60008060065460ff1660028111156134a8576134a8613e9d565b14905090565b6000828152600960205260408120546008805483929081106134d2576134d2613fcd565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061350657613506613fcd565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561356057600080fd5b505afa158015613574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135989190614078565b50915091508260040154600014806135c75750801580156135c757506000828152600284016020526040902054155b156135d957600094505050505061360a565b80156135ee57505060040154915061360a9050565b50600090815260029091016020526040902054915061360a9050565b92915050565b6000546001600160a01b0316331461363a5760405162461bcd60e51b815260040161083190614303565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060405160005b601481101561367f5783811a81600c84010153600101613664565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b1580156136d057600080fd5b505afa1580156136e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137089190614011565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561376257600080fd5b505afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190613f86565b6137a49190613fe3565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b1580156137e057600080fd5b505afa1580156137f4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261381c91908101906144d5565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561387c57600080fd5b505afa158015613890573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b491906141ec565b600154604051630fad06e960e11b81526001600160601b03881660048201529294509092506000916001600160a01b0390911690631f5a0dd29060240160c06040518083038186803b15801561390957600080fd5b505afa15801561391d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394191906143de565b5050509250505083826139549190613fb5565b83101580156139635750808310155b98975050505050505050565b82805461397b90614210565b90600052602060002090601f01602090048101928261399d57600085556139e3565b82601f106139b65782800160ff198235161785556139e3565b828001600101855582156139e3579182015b828111156139e35782358255916020019190600101906139c8565b506139ef9291506139f3565b5090565b5b808211156139ef57600081556001016139f4565b600060208284031215613a1a57600080fd5b5035919050565b6001600160a01b0381168114613a3657600080fd5b50565b60008060008060808587031215613a4f57600080fd5b843593506020850135613a6181613a21565b93969395505050506040820135916060013590565b60008060408385031215613a8957600080fd5b50508035926020909101359150565b60008060408385031215613aab57600080fd5b8235613ab681613a21565b946020939093013593505050565b600080600060608486031215613ad957600080fd5b505081359360208301359350604090920135919050565b60005b83811015613b0b578181015183820152602001613af3565b838111156129a05750506000910152565b60008151808452613b34816020860160208601613af0565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613b696060830184613b1c565b95945050505050565b60008083601f840112613b8457600080fd5b5081356001600160401b03811115613b9b57600080fd5b6020830191508360208260051b8501011115613bb657600080fd5b9250929050565b60008060008060608587031215613bd357600080fd5b8435935060208501356001600160401b03811115613bf057600080fd5b613bfc87828801613b72565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613c4757835183529284019291840191600101613c2b565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c9157613c91613c53565b604052919050565b60006001600160401b03831115613cb257613cb2613c53565b613cc5601f8401601f1916602001613c69565b9050828152838383011115613cd957600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613d0557600080fd5b8335613d1081613a21565b92506020840135915060408401356001600160401b03811115613d3257600080fd5b8401601f81018613613d4357600080fd5b613d5286823560208401613c99565b9150509250925092565b60008060008060008060a08789031215613d7557600080fd5b8635955060208701356001600160401b0380821115613d9357600080fd5b613d9f8a838b01613b72565b909750955060408901359450606089013593506080890135915080821115613dc657600080fd5b508701601f81018913613dd857600080fd5b613de789823560208401613c99565b9150509295509295509295565b600060208284031215613e0657600080fd5b81356122fa81613a21565b60008083601f840112613e2357600080fd5b5081356001600160401b03811115613e3a57600080fd5b602083019150836020828501011115613bb657600080fd5b600080600060408486031215613e6757600080fd5b8335925060208401356001600160401b03811115613e8457600080fd5b613e9086828701613e11565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613ed557634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613ef357600080fd5b853594506020860135935060408601356001600160401b03811115613f1757600080fd5b613f2388828901613e11565b96999598509660600135949350505050565b600060208284031215613f4757600080fd5b8151600281106122fa57600080fd5b80518015158114613f6657600080fd5b919050565b600060208284031215613f7d57600080fd5b6122fa82613f56565b600060208284031215613f9857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613fc857613fc8613f9f565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613ff557613ff5613f9f565b500390565b80516001600160601b0381168114613f6657600080fd5b600080600080600060a0868803121561402957600080fd5b61403286613ffa565b9450602086015161404281613a21565b60408701519094506005811061405757600080fd5b925061406560608701613f56565b9150608086015190509295509295909350565b60008060006060848603121561408d57600080fd5b8351925061409d60208501613f56565b91506140ab60408501613f56565b90509250925092565b60008160001904831182151516156140ce576140ce613f9f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140f8576140f86140d3565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b60008060006060848603121561418d57600080fd5b8351925060208401519150604084015190509250925092565b6000826141b5576141b56140d3565b500690565b60006000198214156141ce576141ce613f9f565b5060010190565b6000816141e4576141e4613f9f565b506000190190565b600080604083850312156141ff57600080fd5b505080516020909101519092909150565b600181811c9082168061422457607f821691505b6020821081141561424557634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c91508083168061427957607f831692505b85831081141561429757634e487b7160e01b85526022600452602485fd5b60608801839052608088018180156142b657600181146142c7576142f2565b60ff198616825287820196506142f2565b60008b81526020902060005b868110156142ec578154848201529085019089016142d3565b83019750505b50949b9a5050505050505050505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6040808252810183905260006001600160fb1b0384111561439c57600080fd5b8360051b8086606085013760009083016060019081526020909201929092529392505050565b600082516143d4818460208701613af0565b9190910192915050565b60008060008060008060c087890312156143f757600080fd5b61440087613ffa565b955061440e60208801613f56565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161444e816020850160208801613af0565b60209201918201929092526040019392505050565b6020815260006122fa6020830184613b1c565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006144b3602083018486614476565b949350505050565b838152604060208201526000613b69604083018486614476565b60008060008060008060c087890312156144ee57600080fd5b865195506020808801519550604088015194506060880151935060808801516001600160401b038082111561452257600080fd5b818a0191508a601f83011261453657600080fd5b81518181111561454857614548613c53565b8060051b9150614559848301613c69565b818152918301840191848101908d84111561457357600080fd5b938501935b8385101561459d578451925061458d83613a21565b8282529385019390850190614578565b80975050505050505060a08701519050929550929550929556fea2646970667358221220319dcab6a4c63e88fca54f16d57a411a492292c8285b137b8ccdeed86acda42c64736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106101cf5760003560e01c8063796490f9116100f8578063ba66fde711610090578063ba66fde7146105cd578063be467604146105ed578063c86ed89214610603578063ccbac9f514610618578063d605787b1461062e578063da3beb8c1461064e578063e349ad3014610498578063e4c0aaf41461066e578063f2f4eb261461068e57600080fd5b8063796490f9146104985780637c04034e146104ae5780637dc38f14146104ce5780638e426460146104e4578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b80634b2f0ea01161016b5780634b2f0ea01461033c5780634dbbebbc1461034f5780634fe264fb1461036f578063564a565d1461038f5780635c92e2f6146103be57806365540b96146103de57806369f3f0411461040b5780636d4cd8ea14610458578063751accd01461047857600080fd5b806303432744146101d45780630b274f2e146101fd5780630baa64d1146102145780630c340a24146102445780631200aabc1461027c5780631c3db16d146102a95780632cad95c0146102e6578063362c3479146102fc5780633b3041471461031c575b600080fd5b3480156101e057600080fd5b506101ea60075481565b6040519081526020015b60405180910390f35b34801561020957600080fd5b506102126106ae565b005b34801561022057600080fd5b5061023461022f366004613a08565b610c32565b60405190151581526020016101f4565b34801561025057600080fd5b50600054610264906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b34801561028857600080fd5b506101ea610297366004613a08565b60096020526000908152604090205481565b3480156102b557600080fd5b506102c96102c4366004613a08565b610ca9565b6040805193845291151560208401521515908201526060016101f4565b3480156102f257600080fd5b506101ea60035481565b34801561030857600080fd5b506101ea610317366004613a39565b610e28565b34801561032857600080fd5b50610264610337366004613a08565b611218565b61021261034a366004613a76565b6117f9565b34801561035b57600080fd5b5061021261036a366004613a98565b6120d2565b34801561037b57600080fd5b506101ea61038a366004613ac4565b6121af565b34801561039b57600080fd5b506103af6103aa366004613a08565b612301565b6040516101f493929190613b48565b3480156103ca57600080fd5b506102126103d9366004613bbd565b6123c7565b3480156103ea57600080fd5b506103fe6103f9366004613a08565b6126e1565b6040516101f49190613c0f565b34801561041757600080fd5b5061042b610426366004613ac4565b6127a5565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f4565b34801561046457600080fd5b50610234610473366004613a08565b61285d565b34801561048457600080fd5b50610212610493366004613cf0565b6128d4565b3480156104a457600080fd5b506101ea61271081565b3480156104ba57600080fd5b506102126104c9366004613d5c565b6129a6565b3480156104da57600080fd5b506101ea60045481565b3480156104f057600080fd5b506102126104ff366004613df4565b6130ac565b34801561051057600080fd5b5061021261051f366004613e52565b6130f8565b34801561053057600080fd5b5061054461053f366004613ac4565b61314a565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f4565b34801561057c57600080fd5b5060065461058a9060ff1681565b6040516101f49190613eb3565b3480156105a357600080fd5b506101ea614e2081565b3480156105b957600080fd5b506102126105c8366004613edb565b613210565b3480156105d957600080fd5b506102346105e8366004613ac4565b6133f3565b3480156105f957600080fd5b506101ea61138881565b34801561060f57600080fd5b5061023461348e565b34801561062457600080fd5b506101ea60055481565b34801561063a57600080fd5b50600254610264906001600160a01b031681565b34801561065a57600080fd5b506101ea610669366004613a76565b6134ae565b34801561067a57600080fd5b50610212610689366004613df4565b613610565b34801561069a57600080fd5b50600154610264906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613f35565b600181111561073c5761073c613e9d565b14806107c95750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190613f6b565b1561085457600060065460ff1660028111156107e7576107e7613e9d565b141561083a5760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600680546000919060ff19166001835b0217905550610bf1565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108db9190613f35565b60018111156108ec576108ec613e9d565b1415610bf157600060065460ff16600281111561090b5761090b613e9d565b1415610a6c576000600754116109635760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f7273000000006044820152606401610831565b600454600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b457600080fd5b505afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190613f86565b6109f69190613fb5565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b5050600680546001935090915060ff1916828061084a565b600160065460ff166002811115610a8557610a85613e9d565b1415610b77576002546003546040516304f3e41560e21b81526001600160a01b03909216916313cf905491610ac09160040190815260200190565b602060405180830381600087803b158015610ada57600080fd5b505af1158015610aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b129190613f86565b6005819055610b635760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610831565b600680546002919060ff191660018361084a565b600260065460ff166002811115610b9057610b90613e9d565b1415610bf15760075415610be65760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e672070686173650000006044820152606401610831565b6006805460ff191690555b6006546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c289160ff90911690613eb3565b60405180910390a1565b600081815260096020526040812054600880548392908110610c5657610c56613fcd565b60009182526020822060059091020180549092508290610c7890600190613fe3565b81548110610c8857610c88613fcd565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806008600960008781526020019081526020016000205481548110610cd557610cd5613fcd565b60009182526020822060059091020180549092508290610cf790600190613fe3565b81548110610d0757610d07613fcd565b60009182526020909120600c90910201600381015460ff169450905083610d32578060010154610d35565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190614011565b5090935060049250610dc7915050565b816004811115610dd957610dd9613e9d565b1415610e1e576000610dea886126e1565b9050805160011415610e1c5780600081518110610e0957610e09613fcd565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610e7157600080fd5b505afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190614011565b50935050505080610efc5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e00000000006044820152606401610831565b600086815260096020526040812054600880549091908110610f2057610f20613fcd565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610f5457610f54613fcd565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160606040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe29190614078565b5050600087815260078401602052604090205490915060ff1661102c576001600160a01b038816600090815260088301602090815260408083208984529091529020549450611172565b808614156110a257600086815260068301602052604090205461105057600061109b565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461109191906140b4565b61109b91906140e9565b9450611172565b600081815260078301602052604090205460ff166111725781600601600083600a016001815481106110d6576110d6613fcd565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061110c5761110c613fcd565b90600052602060002001548152602001908152602001600020546111309190613fb5565b60098301546001600160a01b038a16600090815260088501602090815260408083208b845290915290205461116591906140b4565b61116f91906140e9565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561120c576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146112455760405162461bcd60e51b8152600401610831906140fd565b60008281526009602052604090205460088054849290811061126957611269613fcd565b600091825260209091206002600590920201015460ff161561129d5760405162461bcd60e51b815260040161083190614141565b600260065460ff1660028111156112b6576112b6613e9d565b146113035760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e672070686173650000000000006044820152606401610831565b60008381526009602052604081205460088054909190811061132757611327613fcd565b6000918252602082206005909102018054909250829061134990600190613fe3565b8154811061135957611359613fcd565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190614011565b505060015460405163bfabfe8f60e01b81526001600160601b038516600482018190526000602483018190529596509493508392506001600160a01b039091169063bfabfe8f9060440160606040518083038186803b15801561144957600080fd5b505afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114819190614178565b50600554875460408051602081019390935282018d905260608201529193509150600090819060800160408051808303601f19018152908290528051602090910120600154630a48b58160e21b835260048301889052600060248401529092506001600160a01b031690632922d6049060440160206040518083038186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115449190613f86565b61154e90826141a6565b90505b8261155c83866140b4565b611567906001613fb5565b10156116545760015b84811161164e5760008161158485886140b4565b61158e9190613fb5565b600154604051630a48b58160e21b8152600481018a9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613f86565b90508084106116315761162a8185613fe3565b9350611639565b50925061164e565b50508080611646906141ba565b915050611570565b50611551565b60015460405163bfabfe8f60e01b815260048101879052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156116a057600080fd5b505afa1580156116b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d89190614178565b925050506116e58161365c565b9a506116f18c8c613687565b156117e5578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b0154886000018054905014156117e057600780549060006117da836141d5565b91905055505b6117ea565b60009a505b50505050505050505050919050565b60008281526009602052604090205460088054849290811061181d5761181d613fcd565b600091825260209091206002600590920201015460ff16156118515760405162461bcd60e51b815260040161083190614141565b60008381526009602052604081205460088054909190811061187557611875613fcd565b9060005260206000209060050201905080600101548311156118d95760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610831565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561192157600080fd5b505afa158015611935573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195991906141ec565b9150915081421015801561196c57508042105b6119b15760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610831565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d9060240160606040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a259190614078565b5050905086811415611a3b576127109150611abc565b612710611388611a4b8686613fe3565b611a5591906140b4565b611a5f91906140e9565b611a698542613fe3565b10611ab65760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610831565b614e2091505b84546000908690611acf90600190613fe3565b81548110611adf57611adf613fcd565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611b3957600080fd5b505afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b719190613f86565b611b7b9190613fe3565b60008a815260078401602052604090205490915060ff1615611bdf5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610831565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611c2457600080fd5b505afa158015611c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5c9190613f86565b90506000612710611c6d87846140b4565b611c7791906140e9565b611c819083613fb5565b60008c815260068601602052604081205491925090821115611d325760008c81526006860160205260409020543490611cba9084613fe3565b11611cdf5760008c8152600686016020526040902054611cda9083613fe3565b611ce1565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611d29929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f845290915281208054839290611d5e908490613fb5565b909155505060008c815260068601602052604081208054839290611d83908490613fb5565b909155505060008c81526006860160205260409020548211611e555760008c815260068601602052604081205460098701805491929091611dc5908490613fb5565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a8501546001101561209557828560090154611e729190613fe3565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611ebb57600080fd5b505afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef39190613f6b565b15611f0c5760028a01805460ff19166001179055612015565b895460038b016000611f1f876001613fb5565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b8152600401611f9a91815260200190565b60206040518083038186803b158015611fb257600080fd5b505afa158015611fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fea9190613f86565b600b82015560038101805460ff191660011790556007805490600061200e836141ba565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b81526004016120629392919061424b565b6000604051808303818588803b15801561207b57600080fd5b505af115801561208f573d6000803e3d6000fd5b50505050505b803411156120c357336108fc6120ab8334613fe3565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000546001600160a01b031633146120fc5760405162461bcd60e51b815260040161083190614303565b600280546001600160a01b0319166001600160a01b0384161790556004819055600160065460ff16600281111561213557612135613e9d565b14156121ab576004546121489043613fb5565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b15801561219257600080fd5b505af11580156121a6573d6000803e3d6000fd5b505050505b5050565b6000838152600960205260408120546008805483929081106121d3576121d3613fcd565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061220757612207613fcd565b90600052602060002090600c0201600001848154811061222957612229613fcd565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561228257600080fd5b505afa158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba9190614078565b506003850154919350915060ff1680156122de575081836002015414806122de5750805b156122f1576127109450505050506122fa565b60009450505050505b9392505050565b6008818154811061231157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161234490614210565b80601f016020809104026020016040519081016040528092919081815260200182805461237090614210565b80156123bd5780601f10612392576101008083540402835291602001916123bd565b820191906000526020600020905b8154815290600101906020018083116123a057829003601f168201915b5050505050905083565b6000848152600960205260409020546008805486929081106123eb576123eb613fcd565b600091825260209091206002600590920201015460ff161561241f5760405162461bcd60e51b815260040161083190614141565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561246457600080fd5b505afa158015612478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249c9190614011565b50909350600192506124ac915050565b8160048111156124be576124be613e9d565b1461251b5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610831565b826125585760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610831565b60008681526009602052604081205460088054909190811061257c5761257c613fcd565b6000918252602082206005909102018054909250829061259e90600190613fe3565b815481106125ae576125ae613fcd565b90600052602060002090600c0201905060005b8681101561267c5733828989848181106125dd576125dd613fcd565b90506020020135815481106125f4576125f4613fcd565b60009182526020909120600490910201546001600160a01b03161461262b5760405162461bcd60e51b815260040161083190614345565b858289898481811061263f5761263f613fcd565b905060200201358154811061265657612656613fcd565b600091825260209091206001600490920201015580612674816141ba565b9150506125c1565b50868690508160050160008282546126949190613fb5565b92505081905550877f631164ab329e3544c9075658fc5cd19297e0b191060d307414cf10ebc99d4a658888886040516126cf9392919061437c565b60405180910390a25050505050505050565b600081815260096020526040812054600880546060939290811061270757612707613fcd565b6000918252602082206005909102018054909250829061272990600190613fe3565b8154811061273957612739613fcd565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561279757602002820191906000526020600020905b815481526020019060010190808311612783575b505050505092505050919050565b60008060008060008060006008600960008c815260200190815260200160002054815481106127d6576127d6613fcd565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061280a5761280a613fcd565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526009602052604081205460088054839290811061288157612881613fcd565b600091825260208220600590910201805490925082906128a390600190613fe3565b815481106128b3576128b3613fcd565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146128fe5760405162461bcd60e51b815260040161083190614303565b6000836001600160a01b0316838360405161291991906143c2565b60006040518083038185875af1925050503d8060008114612956576040519150601f19603f3d011682016040523d82523d6000602084013e61295b565b606091505b50509050806129a05760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610831565b50505050565b6000868152600960205260409020546008805488929081106129ca576129ca613fcd565b600091825260209091206002600590920201015460ff16156129fe5760405162461bcd60e51b815260040161083190614141565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b158015612a4357600080fd5b505afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b9190614011565b5090935060029250612a8b915050565b816004811115612a9d57612a9d613e9d565b14612af85760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610831565b85612b3a5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610831565b600088815260096020526040812054600880549091908110612b5e57612b5e613fcd565b906000526020600020906005020190508060010154861115612bb95760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610831565b80546000908290612bcc90600190613fe3565b81548110612bdc57612bdc613fcd565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6a9190614011565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612cc057600080fd5b505afa158015612cd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf891906143de565b5050505091505060005b8a811015612f745733848d8d84818110612d1e57612d1e613fcd565b9050602002013581548110612d3557612d35613fcd565b60009182526020909120600490910201546001600160a01b031614612d6c5760405162461bcd60e51b815260040161083190614345565b811580612de0575089888a604051602001612d8993929190614436565b60405160208183030381529060405280519060200120846000018d8d84818110612db557612db5613fcd565b9050602002013581548110612dcc57612dcc613fcd565b906000526020600020906004020160010154145b612e525760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610831565b838c8c83818110612e6557612e65613fcd565b9050602002013581548110612e7c57612e7c613fcd565b600091825260209091206003600490920201015460ff1615612ed55760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610831565b89848d8d84818110612ee957612ee9613fcd565b9050602002013581548110612f0057612f00613fcd565b60009182526020909120600260049092020101556001848d8d84818110612f2957612f29613fcd565b9050602002013581548110612f4057612f40613fcd565b60009182526020909120600490910201600301805460ff191691151591909117905580612f6c816141ba565b915050612d02565b508a8a9050836004016000828254612f8c9190613fb5565b90915550506000898152600284016020526040812080548c9290612fb1908490613fb5565b90915550506001830154891415612fe157600383015460ff1615612fdc5760038301805460ff191690555b61305b565b60018301546000908152600284016020526040808220548b8352912054141561302457600383015460ff16612fdc5760038301805460ff1916600117905561305b565b60018301546000908152600284016020526040808220548b8352912054111561305b576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a6040516130969190614463565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146130d65760405162461bcd60e51b815260040161083190614303565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c9061313d908790879061449f565b60405180910390a4505050565b60008060008060006008600960008a8152602001908152602001600020548154811061317857613178613fcd565b600091825260208083208a84526003600590930201918201905260408220548154919350839181106131ac576131ac613fcd565b90600052602060002090600c020160000187815481106131ce576131ce613fcd565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b0316331461323a5760405162461bcd60e51b8152600401610831906140fd565b60088054600181018255600091909152600581027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee481018690557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101906132c5907ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee701868661396f565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561331757600080fd5b505afa15801561332b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334f9190613f86565b6133599190613fe3565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600990925282208490556007805491926133ba836141ba565b9190505550877fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581088888886040516126cf939291906144bb565b60008381526009602052604081205460088054839290811061341757613417613fcd565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061344b5761344b613fcd565b90600052602060002090600c0201600001848154811061346d5761346d613fcd565b600091825260209091206004909102016003015460ff169695505050505050565b60008060065460ff1660028111156134a8576134a8613e9d565b14905090565b6000828152600960205260408120546008805483929081106134d2576134d2613fcd565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061350657613506613fcd565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561356057600080fd5b505afa158015613574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135989190614078565b50915091508260040154600014806135c75750801580156135c757506000828152600284016020526040902054155b156135d957600094505050505061360a565b80156135ee57505060040154915061360a9050565b50600090815260029091016020526040902054915061360a9050565b92915050565b6000546001600160a01b0316331461363a5760405162461bcd60e51b815260040161083190614303565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060405160005b601481101561367f5783811a81600c84010153600101613664565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b1580156136d057600080fd5b505afa1580156136e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137089190614011565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561376257600080fd5b505afa158015613776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379a9190613f86565b6137a49190613fe3565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b1580156137e057600080fd5b505afa1580156137f4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261381c91908101906144d5565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561387c57600080fd5b505afa158015613890573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b491906141ec565b600154604051630fad06e960e11b81526001600160601b03881660048201529294509092506000916001600160a01b0390911690631f5a0dd29060240160c06040518083038186803b15801561390957600080fd5b505afa15801561391d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394191906143de565b5050509250505083826139549190613fb5565b83101580156139635750808310155b98975050505050505050565b82805461397b90614210565b90600052602060002090601f01602090048101928261399d57600085556139e3565b82601f106139b65782800160ff198235161785556139e3565b828001600101855582156139e3579182015b828111156139e35782358255916020019190600101906139c8565b506139ef9291506139f3565b5090565b5b808211156139ef57600081556001016139f4565b600060208284031215613a1a57600080fd5b5035919050565b6001600160a01b0381168114613a3657600080fd5b50565b60008060008060808587031215613a4f57600080fd5b843593506020850135613a6181613a21565b93969395505050506040820135916060013590565b60008060408385031215613a8957600080fd5b50508035926020909101359150565b60008060408385031215613aab57600080fd5b8235613ab681613a21565b946020939093013593505050565b600080600060608486031215613ad957600080fd5b505081359360208301359350604090920135919050565b60005b83811015613b0b578181015183820152602001613af3565b838111156129a05750506000910152565b60008151808452613b34816020860160208601613af0565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613b696060830184613b1c565b95945050505050565b60008083601f840112613b8457600080fd5b5081356001600160401b03811115613b9b57600080fd5b6020830191508360208260051b8501011115613bb657600080fd5b9250929050565b60008060008060608587031215613bd357600080fd5b8435935060208501356001600160401b03811115613bf057600080fd5b613bfc87828801613b72565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613c4757835183529284019291840191600101613c2b565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c9157613c91613c53565b604052919050565b60006001600160401b03831115613cb257613cb2613c53565b613cc5601f8401601f1916602001613c69565b9050828152838383011115613cd957600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613d0557600080fd5b8335613d1081613a21565b92506020840135915060408401356001600160401b03811115613d3257600080fd5b8401601f81018613613d4357600080fd5b613d5286823560208401613c99565b9150509250925092565b60008060008060008060a08789031215613d7557600080fd5b8635955060208701356001600160401b0380821115613d9357600080fd5b613d9f8a838b01613b72565b909750955060408901359450606089013593506080890135915080821115613dc657600080fd5b508701601f81018913613dd857600080fd5b613de789823560208401613c99565b9150509295509295509295565b600060208284031215613e0657600080fd5b81356122fa81613a21565b60008083601f840112613e2357600080fd5b5081356001600160401b03811115613e3a57600080fd5b602083019150836020828501011115613bb657600080fd5b600080600060408486031215613e6757600080fd5b8335925060208401356001600160401b03811115613e8457600080fd5b613e9086828701613e11565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613ed557634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613ef357600080fd5b853594506020860135935060408601356001600160401b03811115613f1757600080fd5b613f2388828901613e11565b96999598509660600135949350505050565b600060208284031215613f4757600080fd5b8151600281106122fa57600080fd5b80518015158114613f6657600080fd5b919050565b600060208284031215613f7d57600080fd5b6122fa82613f56565b600060208284031215613f9857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613fc857613fc8613f9f565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613ff557613ff5613f9f565b500390565b80516001600160601b0381168114613f6657600080fd5b600080600080600060a0868803121561402957600080fd5b61403286613ffa565b9450602086015161404281613a21565b60408701519094506005811061405757600080fd5b925061406560608701613f56565b9150608086015190509295509295909350565b60008060006060848603121561408d57600080fd5b8351925061409d60208501613f56565b91506140ab60408501613f56565b90509250925092565b60008160001904831182151516156140ce576140ce613f9f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140f8576140f86140d3565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b60008060006060848603121561418d57600080fd5b8351925060208401519150604084015190509250925092565b6000826141b5576141b56140d3565b500690565b60006000198214156141ce576141ce613f9f565b5060010190565b6000816141e4576141e4613f9f565b506000190190565b600080604083850312156141ff57600080fd5b505080516020909101519092909150565b600181811c9082168061422457607f821691505b6020821081141561424557634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c91508083168061427957607f831692505b85831081141561429757634e487b7160e01b85526022600452602485fd5b60608801839052608088018180156142b657600181146142c7576142f2565b60ff198616825287820196506142f2565b60008b81526020902060005b868110156142ec578154848201529085019089016142d3565b83019750505b50949b9a5050505050505050505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6040808252810183905260006001600160fb1b0384111561439c57600080fd5b8360051b8086606085013760009083016060019081526020909201929092529392505050565b600082516143d4818460208701613af0565b9190910192915050565b60008060008060008060c087890312156143f757600080fd5b61440087613ffa565b955061440e60208801613f56565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161444e816020850160208801613af0565b60209201918201929092526040019392505050565b6020815260006122fa6020830184613b1c565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006144b3602083018486614476565b949350505050565b838152604060208201526000613b69604083018486614476565b60008060008060008060c087890312156144ee57600080fd5b865195506020808801519550604088015194506060880151935060808801516001600160401b038082111561452257600080fd5b818a0191508a601f83011261453657600080fd5b81518181111561454857614548613c53565b8060051b9150614559848301613c69565b818152918301840191848101908d84111561457357600080fd5b938501935b8385101561459d578451925061458d83613a21565b8282529385019390850190614578565b80975050505050505060a08701519050929550929550929556fea2646970667358221220319dcab6a4c63e88fca54f16d57a411a492292c8285b137b8ccdeed86acda42c64736f6c63430008090033", + "numDeployments": 5, + "solcInputHash": "385558cd8f2e0323787dead6b7cecab9", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract KlerosCore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"CommitCast\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Contribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_party\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"Evidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"Justification\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum DisputeKitClassic.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhaseDisputeKit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_contributor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LOSER_APPEAL_PERIOD_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LOSER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ONE_BASIS_POINT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WINNER_STAKE_MULTIPLIER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areCommitsAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"areVotesAllCast\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32\",\"name\":\"_commit\",\"type\":\"bytes32\"}],\"name\":\"castCommit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_voteIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_salt\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_justification\",\"type\":\"string\"}],\"name\":\"castVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"changeCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract RNG\",\"name\":\"_rng\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rngLookahead\",\"type\":\"uint256\"}],\"name\":\"changeRandomNumberGenerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract KlerosCore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\":[],\"name\":\"disputesWithoutJurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"drawnAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"fundAppeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"}],\"name\":\"getCoherentCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getDegreeOfCoherence\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"}],\"name\":\"getFundedChoices\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"fundedChoices\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"totalVoted\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalCommited\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nbVoters\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"choiceCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getVoteInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"commit\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"choice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"voted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isResolving\",\"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\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum DisputeKitClassic.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngLookahead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rngRequestedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"submitEvidence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_beneficiary\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"withdrawFeesAndRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"areCommitsAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their commits for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their commits for the last round.\"}},\"areVotesAllCast(uint256)\":{\"details\":\"Returns true if all of the jurors have cast their votes for the last round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\"},\"returns\":{\"_0\":\"Whether all of the jurors have cast their votes for the last round.\"}},\"castCommit(uint256,uint256[],bytes32)\":{\"details\":\"Sets the caller's commit for the specified votes. It can be called multiple times during the commit period, each call overrides the commits of the previous one. `O(n)` where `n` is the number of votes.\",\"params\":{\"_commit\":\"The commit. Note that justification string is a part of the commit.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"castVote(uint256,uint256[],uint256,uint256,string)\":{\"details\":\"Sets the caller's choices for the specified votes. `O(n)` where `n` is the number of votes.\",\"params\":{\"_choice\":\"The choice.\",\"_coreDisputeID\":\"The ID of the dispute in Kleros Core.\",\"_justification\":\"Justification of the choice.\",\"_salt\":\"The salt for the commit if the votes were hidden.\",\"_voteIDs\":\"The IDs of the votes.\"}},\"changeCore(address)\":{\"details\":\"Changes the `core` storage variable.\",\"params\":{\"_core\":\"The new value for the `core` storage variable.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeRandomNumberGenerator(address,uint256)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\",\"_rngLookahead\":\"The new value for the `rngLookahead` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\",\"_rngLookahead\":\"Lookahead value for rng.\"}},\"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)\":{\"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.\"},\"returns\":{\"drawnAddress\":\"The drawn address.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"fundAppeal(uint256,uint256)\":{\"details\":\"Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.\",\"params\":{\"_choice\":\"A choice that receives funding.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core.\"}},\"getCoherentCount(uint256,uint256)\":{\"details\":\"Gets the number of jurors who are eligible to a reward in this round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"_0\":\"The number of coherent jurors.\"}},\"getDegreeOfCoherence(uint256,uint256,uint256)\":{\"details\":\"Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\",\"_coreRoundID\":\"The ID of the round in Kleros Core, not in the Dispute Kit.\",\"_voteID\":\"The ID of the vote.\"},\"returns\":{\"_0\":\"The degree of coherence in basis points.\"}},\"isResolving()\":{\"details\":\"Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\",\"returns\":{\"_0\":\"Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\"}},\"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.\"}},\"passPhase()\":{\"details\":\"Passes the phase.\"},\"submitEvidence(uint256,string)\":{\"details\":\"Submits evidence.\",\"params\":{\"_evidence\":\"IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\",\"_evidenceGroupID\":\"Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID.\"}},\"withdrawFeesAndRewards(uint256,address,uint256,uint256)\":{\"details\":\"Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\",\"params\":{\"_beneficiary\":\"The address whose rewards to withdraw.\",\"_choice\":\"The ruling option that the caller wants to withdraw from.\",\"_coreDisputeID\":\"Index of the dispute in Kleros Core contract.\",\"_coreRoundID\":\"The round in the Kleros Core contract the caller wants to withdraw from.\"},\"returns\":{\"amount\":\"The withdrawn amount.\"}}},\"stateVariables\":{\"disputesWithoutJurors\":{\"details\":\"Returns the number of disputes without jurors in the dispute kit.\",\"return\":\"The number of disputes without jurors in the dispute kit.\",\"returns\":{\"_0\":\"The number of disputes without jurors in the dispute kit.\"}}},\"title\":\"DisputeKitClassic Dispute kit implementation of the Kleros v1 features including: - a drawing system: proportional to staked PNK, - a vote aggreation system: plurality, - an incentive system: equal split between coherent votes, - an appeal system: fund 2 choices only, vote on any choice.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":\"DisputeKitClassic\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/arbitration/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\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.\\n */\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /**\\n * @dev Emitted when casting a vote to provide the justification of juror's choice.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Address of the juror.\\n * @param _choice The choice juror voted for.\\n * @param _justification Justification of the choice.\\n */\\n event Justification(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\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 */\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() 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 * @return drawnAddress The drawn address.\\n */\\n function draw(uint256 _coreDisputeID) 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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\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 */\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 /** @dev Returns the number of disputes without jurors in the dispute kit.\\n * @return The number of disputes without jurors in the dispute kit.\\n */\\n function disputesWithoutJurors() external view returns (uint256);\\n\\n /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\\n * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\\n */\\n function isResolving() external view returns (bool);\\n}\\n\",\"keccak256\":\"0xecebcf3e67b261c5e521f6bd9fd184151833f521008f38e4935f907ca1f17d0f\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrator.sol\\\";\\nimport \\\"./IDisputeKit.sol\\\";\\nimport {SortitionSumTreeFactoryV2} from \\\"../libraries/SortitionSumTreeFactoryV2.sol\\\";\\n\\n/**\\n * @title KlerosCore\\n * Core arbitrator contract for Kleros v2.\\n * Note that this contract trusts the token and the dispute kit contracts.\\n */\\ncontract KlerosCore is IArbitrator {\\n using SortitionSumTreeFactoryV2 for SortitionSumTreeFactoryV2.SortitionSumTrees; // Use library functions for sortition sum trees.\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n staking, // Stake can be updated during this phase.\\n freezing // Phase during which the dispute kits can undergo the drawing process. Staking is not allowed during this phase.\\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 tokens needed to stake in the court.\\n uint256 alpha; // Basis point of tokens that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrable 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 tokensAtStakePerJuror; // The amount of tokens 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 penalties; // The amount of tokens collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n mapping(uint96 => uint256) stakedTokens; // The number of tokens the juror has staked in the court in the form `stakedTokens[courtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the court in the form `lockedTokens[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n bool needsFreezing; // The dispute kit needs freezing.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n uint256 penalty; // Penalty value, in case the stake was set during execution.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Freezing if there are open disputes.\\n uint256 public maxFreezingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public freezeBlock; // Number of the block when Core was frozen.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n uint256[] public disputesKitIDsThatNeedFreezing; // The disputeKitIDs that need switching to Freezing phase.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n SortitionSumTreeFactoryV2.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking.\\n\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event NewPhase(Phase _phase);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount, uint256 _newTotalStake);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256 _sortitionSumTreeK,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(uint96 indexed _courtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n int256 _tokenAmount,\\n int256 _ethAmount\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _pinakion The address of the token contract.\\n * @param _jurorProsecutionModule The address of the juror prosecution module.\\n * @param _disputeKit The address of the default dispute kit.\\n * @param _phaseTimeouts minStakingTime and maxFreezingTime respectively\\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 _sortitionSumTreeK The number of children per node of the general court's sortition sum tree.\\n */\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n uint256[2] memory _phaseTimeouts,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionSumTrees.createTree(bytes32(uint256(FORKING_COURT)), _sortitionSumTreeK);\\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 sortitionSumTrees.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionSumTreeK);\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n new uint256[](0)\\n );\\n enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\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 */\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Changes the `pinakion` storage variable.\\n * @param _pinakion The new value for the `pinakion` storage variable.\\n */\\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 */\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /** @dev Changes the `minStakingTime` storage variable.\\n * @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n */\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /** @dev Changes the `maxFreezingTime` storage variable.\\n * @param _maxFreezingTime The new value for the `maxFreezingTime` storage variable.\\n */\\n function changeMaxFreezingTime(uint256 _maxFreezingTime) external onlyByGovernor {\\n maxFreezingTime = _maxFreezingTime;\\n }\\n\\n /** @dev Add a new supported dispute kit module to the court.\\n * @param _disputeKitAddress The address of the dispute kit contract.\\n * @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n * Note that the root DK must be supported by the general court.\\n */\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n require(_parent < disputeKitID, \\\"!Parent\\\");\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n require(depthLevel < SEARCH_ITERATIONS, \\\"Depth level max\\\");\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n needsFreezing: false,\\n depthLevel: depthLevel\\n })\\n );\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /** @dev Creates a court under a specified parent court.\\n * @param _parent The `parent` property value of the court.\\n * @param _hiddenVotes The `hiddenVotes` property value of the court.\\n * @param _minStake The `minStake` property value of the court.\\n * @param _alpha The `alpha` property value of the court.\\n * @param _feeForJuror The `feeForJuror` property value of the court.\\n * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n * @param _sortitionSumTreeK The number of children per node of the court's sortition sum tree.\\n * @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n */\\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 uint256 _sortitionSumTreeK,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n require(courts[_parent].minStake <= _minStake, \\\"MinStake lower than parent court\\\");\\n require(_supportedDisputeKits.length > 0, \\\"!Supported DK\\\");\\n require(_parent != FORKING_COURT, \\\"Invalid: Forking court as parent\\\");\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n require(\\n _supportedDisputeKits[i] > 0 && _supportedDisputeKits[i] < disputeKitNodes.length,\\n \\\"Wrong DK index\\\"\\n );\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionSumTrees.createTree(bytes32(courtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n _supportedDisputeKits\\n );\\n }\\n\\n /** @dev Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\\n * @param _courtID The ID of the court.\\n * @param _minStake The new value for the `minStake` property value.\\n */\\n function changeCourtMinStake(uint96 _courtID, uint256 _minStake) external onlyByGovernor {\\n require(\\n _courtID == GENERAL_COURT || courts[courts[_courtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n require(courts[courts[_courtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_courtID].minStake = _minStake;\\n emit CourtModified(_courtID, \\\"minStake\\\");\\n }\\n\\n /** @dev Changes the `alpha` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _alpha The new value for the `alpha` property value.\\n */\\n function changeCourtAlpha(uint96 _courtID, uint256 _alpha) external onlyByGovernor {\\n courts[_courtID].alpha = _alpha;\\n emit CourtModified(_courtID, \\\"alpha\\\");\\n }\\n\\n /** @dev Changes the `feeForJuror` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n courts[_courtID].feeForJuror = _feeForJuror;\\n emit CourtModified(_courtID, \\\"feeForJuror\\\");\\n }\\n\\n /** @dev Changes the `jurorsForCourtJump` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value.\\n */\\n function changeCourtJurorsForJump(uint96 _courtID, uint256 _jurorsForCourtJump) external onlyByGovernor {\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n emit CourtModified(_courtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeCourtHiddenVotes(uint96 _courtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n emit CourtModified(_courtID, \\\"hiddenVotes\\\");\\n }\\n\\n /** @dev Changes the `timesPerPeriod` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _timesPerPeriod The new value for the `timesPerPeriod` property value.\\n */\\n function changeCourtTimesPerPeriod(uint96 _courtID, uint256[4] memory _timesPerPeriod) external onlyByGovernor {\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(_courtID, \\\"timesPerPeriod\\\");\\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 */\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n require(_disputeKitIDs[i] > 0 && _disputeKitIDs[i] < disputeKitNodes.length, \\\"Wrong DK index\\\");\\n enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\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 _stake The new stake.\\n */\\n function setStake(uint96 _courtID, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _courtID, _stake, 0), \\\"Staking failed\\\");\\n }\\n\\n /** @dev Executes the next delayed stakes.\\n * @param _iterations The number of delayed stakes to execute.\\n */\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"!Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.courtID, delayedStake.stake, delayedStake.penalty);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n /** @dev Creates a dispute. Must be called by the arbitrable contract.\\n * @param _numberOfChoices Number of choices for the jurors to choose from.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes),\\n * the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n * @return disputeID The ID of the created dispute.\\n */\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 courtID, , uint256 disputeKitID) = extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[courtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by court\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = msg.value / court.feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = msg.value;\\n\\n if (!disputeKitNodes[disputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[disputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(disputeKitID);\\n }\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n /** @dev Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\\n */\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(block.timestamp - lastPhaseChange >= minStakingTime, \\\"MinStakingTime not passed\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"No DK needs freezing\\\");\\n phase = Phase.freezing;\\n freezeBlock = block.number;\\n } else {\\n // phase == Phase.freezing\\n bool timeout = this.freezingPhaseTimeout();\\n for (int256 i = int256(disputesKitIDsThatNeedFreezing.length) - 1; i >= 0; --i) {\\n uint256 disputeKitID = disputesKitIDsThatNeedFreezing[uint256(i)];\\n IDisputeKit disputeKit = disputeKitNodes[disputesKitIDsThatNeedFreezing[uint256(i)]].disputeKit;\\n if (timeout && !disputeKit.isResolving()) {\\n // Force the dispute kit to be ready for Staking phase.\\n disputeKit.passPhase(); // Should not be called if already in Resolving phase, because it reverts.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n if (disputeKit.disputesWithoutJurors() == 0) {\\n // The dispute kit had time to finish drawing jurors for all its disputes.\\n disputeKitNodes[disputeKitID].needsFreezing = false;\\n if (i < int256(disputesKitIDsThatNeedFreezing.length) - 1) {\\n // This is not the last element so copy the last element to the current one, then pop.\\n disputesKitIDsThatNeedFreezing[uint256(i)] = disputesKitIDsThatNeedFreezing[\\n disputesKitIDsThatNeedFreezing.length - 1\\n ];\\n }\\n disputesKitIDsThatNeedFreezing.pop();\\n }\\n }\\n }\\n phase = Phase.staking;\\n }\\n // Should not be reached if the phase is unchanged.\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /** @dev Passes the period of a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n */\\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 require(\\n currentRound > 0 ||\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Evidence not passed && !Appeal\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"Dispute still drawing\\\");\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID),\\n \\\"Commit period not passed\\\"\\n );\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID),\\n \\\"Vote period not passed\\\"\\n );\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Appeal period not passed\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"Dispute period is final\\\");\\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 */\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n require(phase == Phase.freezing, \\\"Wrong phase\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n require(dispute.period == Period.evidence, \\\"!Evidence period\\\");\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n uint256 startIndex = round.drawnJurors.length;\\n uint256 endIndex = startIndex + _iterations <= round.nbVotes ? startIndex + _iterations : round.nbVotes;\\n\\n for (uint256 i = startIndex; i < endIndex; i++) {\\n address drawnAddress = disputeKit.draw(_disputeID);\\n if (drawnAddress != address(0)) {\\n // In case no one has staked at the court yet.\\n jurors[drawnAddress].lockedTokens[dispute.courtID] += round.tokensAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n }\\n }\\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 */\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"ETH too low for appeal cost\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute not appealable\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), \\\"Dispute Kit only\\\");\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n if (!disputeKitNodes[newDisputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[newDisputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(newDisputeKitID);\\n }\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /** @dev Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\\n * @param _disputeID The ID of the dispute.\\n * @param _round The appeal round.\\n * @param _iterations The number of iterations to run.\\n */\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 end = round.repartitions + _iterations;\\n uint256 penaltiesInRoundCache = round.penalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n address account; // Address of the juror.\\n uint256 degreeOfCoherence; // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\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 penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n\\n for (uint256 i = round.repartitions; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n // Penalty.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i);\\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 // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.tokensAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n penaltiesInRoundCache += penalty;\\n\\n account = round.drawnJurors[i];\\n jurors[account].lockedTokens[dispute.courtID] -= penalty; // Release this part of locked tokens.\\n\\n // Can only update the stake if it is able to cover the minStake and penalty, otherwise unstake from the court.\\n if (jurors[account].stakedTokens[dispute.courtID] >= courts[dispute.courtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.courtID] - penalty;\\n setStakeForAccount(account, dispute.courtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.courtID] != 0) {\\n setStakeForAccount(account, dispute.courtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n uint96[] memory courtIDs = getJurorCourtIDs(account);\\n for (uint256 j = 0; j < courtIDs.length; j++) {\\n setStakeForAccount(account, courtIDs[j], 0, 0);\\n }\\n }\\n emit TokenAndETHShift(account, _disputeID, -int256(penalty), 0);\\n\\n if (i == numberOfVotesInRound - 1) {\\n if (coherentCount == 0) {\\n // No one was coherent. Send the rewards to governor.\\n payable(governor).send(round.totalFeesForJurors);\\n safeTransfer(governor, penaltiesInRoundCache);\\n }\\n }\\n } else {\\n // Reward.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);\\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 account = round.drawnJurors[i % numberOfVotesInRound];\\n\\n // Release the rest of the tokens of the juror for this round.\\n jurors[account].lockedTokens[dispute.courtID] -=\\n (round.tokensAtStakePerJuror * degreeOfCoherence) /\\n ALPHA_DIVISOR;\\n\\n // Give back the locked tokens in case the juror fully unstaked earlier.\\n if (jurors[account].stakedTokens[dispute.courtID] == 0) {\\n uint256 tokenLocked = (round.tokensAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenLocked);\\n }\\n\\n uint256 tokenReward = ((penaltiesInRoundCache / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n uint256 ethReward = ((round.totalFeesForJurors / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenReward);\\n payable(account).send(ethReward);\\n emit TokenAndETHShift(account, _disputeID, int256(tokenReward), int256(ethReward));\\n }\\n }\\n\\n if (round.penalties != penaltiesInRoundCache) {\\n round.penalties = penaltiesInRoundCache;\\n }\\n round.repartitions = end;\\n }\\n\\n /** @dev Executes a specified dispute's ruling. UNTRUSTED.\\n * @param _disputeID The ID of the dispute.\\n */\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n require(!dispute.ruled, \\\"Ruling already executed\\\");\\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 Gets the cost of arbitration in a specified court.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes)\\n * and the minimum number of jurors required (next 32 bytes).\\n * @return cost The arbitration cost.\\n */\\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 Gets the cost of appealing a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n * @return cost The appeal cost.\\n */\\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 */\\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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(\\n uint256 _disputeID,\\n uint256 _round\\n )\\n external\\n view\\n returns (\\n uint256 tokensAtStakePerJuror,\\n uint256 totalFeesForJurors,\\n uint256 repartitions,\\n uint256 penalties,\\n address[] memory drawnJurors,\\n uint256 disputeKitID\\n )\\n {\\n Round storage round = disputes[_disputeID].rounds[_round];\\n return (\\n round.tokensAtStakePerJuror,\\n round.totalFeesForJurors,\\n round.repartitions,\\n round.penalties,\\n round.drawnJurors,\\n round.disputeKitID\\n );\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _courtID) external view returns (uint256 staked, uint256 locked) {\\n staked = jurors[_juror].stakedTokens[_courtID];\\n locked = jurors[_juror].lockedTokens[_courtID];\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /** @dev Gets non-primitive properties of a specified dispute kit node.\\n * @param _disputeKitID The ID of the dispute kit.\\n * @return children Indexes of children of this DK.\\n */\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /** @dev Gets the timesPerPeriod array for a given court.\\n * @param _courtID The ID of the court to get the times from.\\n * @return timesPerPeriod The timesPerPeriod array for the given court.\\n */\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) external view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTree(\\n bytes32 _key,\\n uint256 _nodeIndex\\n ) public view returns (uint256 K, uint256 length, bytes32 ID) {\\n SortitionSumTreeFactoryV2.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n length = tree.nodes.length;\\n ID = tree.nodeIndexesToIDs[_nodeIndex];\\n }\\n\\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 function freezingPhaseTimeout() external view returns (bool) {\\n return phase == Phase.freezing && block.timestamp - lastPhaseChange >= maxFreezingTime;\\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 */\\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 getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /** @dev Sets the specified juror's stake in a court.\\n * `O(n + p * log_k(j))` where\\n * `n` is the number of courts the juror has staked in,\\n * `p` is the depth of the court tree,\\n * `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n * and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n * @param _account The address of the juror.\\n * @param _courtID The ID of the court.\\n * @param _stake The new stake.\\n * @param _penalty Penalized amount won't be transferred back to juror when the stake is lowered.\\n * @return succeeded True if the call succeeded, false otherwise.\\n */\\n function setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndCourtIDToStakePathID(_account, _courtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_courtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_courtID].minStake || _stake < juror.lockedTokens[_courtID]) return false;\\n if (currentStake == 0 && juror.courtIDs.length >= MAX_STAKE_PATHS) return false;\\n }\\n\\n // Delayed action logic.\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake,\\n penalty: _penalty\\n });\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_stake >= currentStake) {\\n transferredAmount = _stake - currentStake;\\n if (transferredAmount > 0) {\\n if (safeTransferFrom(_account, address(this), transferredAmount)) {\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n return false;\\n }\\n }\\n } else if (_stake == 0) {\\n // Keep locked tokens in the contract and release them after dispute is executed.\\n transferredAmount = currentStake - juror.lockedTokens[_courtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\n for (uint256 i = 0; i < juror.courtIDs.length; i++) {\\n if (juror.courtIDs[i] == _courtID) {\\n juror.courtIDs[i] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n } else {\\n return false;\\n }\\n }\\n } else {\\n transferredAmount = currentStake - _stake - _penalty;\\n if (transferredAmount > 0) {\\n if (!safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n }\\n\\n // Update juror's records.\\n uint256 newTotalStake = juror.stakedTokens[_courtID] - currentStake + _stake;\\n juror.stakedTokens[_courtID] = newTotalStake;\\n\\n // Update court parents.\\n bool finished = false;\\n uint256 currentCourtID = _courtID;\\n while (!finished) {\\n sortitionSumTrees.set(bytes32(currentCourtID), _stake, stakePathID);\\n if (currentCourtID == GENERAL_COURT) finished = true;\\n else currentCourtID = courts[currentCourtID].parent;\\n }\\n\\n emit StakeSet(_account, _courtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n * Note that if extradata contains an incorrect value then this value will be switched to default.\\n * @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return courtID The court ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\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 = MIN_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a court ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _courtID The court ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n\\n /** @dev Calls transfer() without reverting.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransfer(address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transfer.selector, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /** @dev Calls transferFrom() without reverting.\\n * @param _from Sender address.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0xdc9174289416383ba9118ddb377daaf4696a8431ef18e64ac1327f848edeba64\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/BaseDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"../IDisputeKit.sol\\\";\\nimport \\\"../KlerosCore.sol\\\";\\n\\n/**\\n * @title BaseDisputeKit\\n * Provides common basic behaviours to the Dispute Kit implementations.\\n */\\nabstract contract BaseDisputeKit is IDisputeKit {\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor; // The governor of the contract.\\n KlerosCore public core; // The Kleros Core arbitrator\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n modifier onlyByCore() {\\n require(address(core) == msg.sender, \\\"Access not allowed: KlerosCore only.\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _core The KlerosCore arbitrator.\\n */\\n constructor(address _governor, KlerosCore _core) {\\n governor = _governor;\\n core = _core;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\n function executeGovernorProposal(\\n address _destination,\\n uint256 _amount,\\n bytes memory _data\\n ) external onlyByGovernor {\\n (bool success, ) = _destination.call{value: _amount}(_data);\\n require(success, \\\"Unsuccessful call\\\");\\n }\\n\\n /** @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Chosen address.\\n * @return Whether the address can be drawn or not.\\n */\\n function postDrawCheck(uint256 _coreDisputeID, address _juror) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1b7fe7456537ffe8a7f84b45e9d5081703895233827ba4a9aa0c545a4ae4f8\",\"license\":\"MIT\"},\"src/arbitration/dispute-kits/DisputeKitClassic.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./BaseDisputeKit.sol\\\";\\nimport \\\"../../rng/RNG.sol\\\";\\nimport \\\"../../evidence/IEvidence.sol\\\";\\n\\n/**\\n * @title DisputeKitClassic\\n * Dispute kit implementation of the Kleros v1 features including:\\n * - a drawing system: proportional to staked PNK,\\n * - a vote aggreation system: plurality,\\n * - an incentive system: equal split between coherent votes,\\n * - an appeal system: fund 2 choices only, vote on any choice.\\n */\\ncontract DisputeKitClassic is BaseDisputeKit, IEvidence {\\n // ************************************* //\\n // * Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n resolving, // No disputes that need drawing.\\n generating, // Waiting for a random number. Pass as soon as it is ready.\\n drawing // Jurors can be drawn.\\n }\\n\\n struct Dispute {\\n Round[] rounds; // Rounds of the dispute. 0 is the default round, and [1, ..n] are the appeal rounds.\\n uint256 numberOfChoices; // The number of choices jurors have when voting. This does not include choice `0` which is reserved for \\\"refuse to arbitrate\\\".\\n bool jumped; // True if dispute jumped to a parent dispute kit and won't be handled by this DK anymore.\\n mapping(uint256 => uint256) coreRoundIDToLocal; // Maps id of the round in the core contract to the index of the round of related local dispute.\\n bytes extraData; // Extradata for the dispute.\\n }\\n\\n struct Round {\\n Vote[] votes; // Former votes[_appeal][].\\n uint256 winningChoice; // The choice with the most votes. Note that in the case of a tie, it is the choice that reached the tied number of votes first.\\n mapping(uint256 => uint256) counts; // The sum of votes for each choice in the form `counts[choice]`.\\n bool tied; // True if there is a tie, false otherwise.\\n uint256 totalVoted; // Former uint[_appeal] votesInEachRound.\\n uint256 totalCommitted; // Former commitsInRound.\\n mapping(uint256 => uint256) paidFees; // Tracks the fees paid for each choice in this round.\\n mapping(uint256 => bool) hasPaid; // True if this choice was fully funded, false otherwise.\\n mapping(address => mapping(uint256 => uint256)) contributions; // Maps contributors to their contributions for each choice.\\n uint256 feeRewards; // Sum of reimbursable appeal fees available to the parties that made contributions to the ruling that ultimately wins a dispute.\\n uint256[] fundedChoices; // Stores the choices that are fully funded.\\n uint256 nbVotes; // Maximal number of votes this dispute can get.\\n }\\n\\n struct Vote {\\n address account; // The address of the juror.\\n bytes32 commit; // The commit of the juror. For courts with hidden votes.\\n uint256 choice; // The choice of the juror.\\n bool voted; // True if the vote has been cast.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant WINNER_STAKE_MULTIPLIER = 10000; // Multiplier of the appeal cost that the winner has to pay as fee stake for a round in basis points. Default is 1x of appeal fee.\\n uint256 public constant LOSER_STAKE_MULTIPLIER = 20000; // Multiplier of the appeal cost that the loser has to pay as fee stake for a round in basis points. Default is 2x of appeal fee.\\n uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period.\\n uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling.\\n\\n RNG public rng; // The random number generator\\n uint256 public rngRequestedBlock; // The block number requested to the random number.\\n uint256 public rngLookahead; // Minimum block distance between requesting and obtaining a random number.\\n uint256 public randomNumber; // The current random number.\\n Phase public phase; // Current phase of this dispute kit.\\n uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors.\\n Dispute[] public disputes; // Array of the locally created disputes.\\n mapping(uint256 => uint256) public coreDisputeIDToLocal; // Maps the dispute ID in Kleros Core to the local dispute ID.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event DisputeCreation(uint256 indexed _coreDisputeID, uint256 _numberOfChoices, bytes _extraData);\\n\\n event CommitCast(uint256 indexed _coreDisputeID, uint256[] _voteIDs, bytes32 _commit);\\n\\n event Contribution(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n event Withdrawal(\\n uint256 indexed _coreDisputeID,\\n uint256 indexed _coreRoundID,\\n uint256 _choice,\\n address indexed _contributor,\\n uint256 _amount\\n );\\n\\n event ChoiceFunded(uint256 indexed _coreDisputeID, uint256 indexed _coreRoundID, uint256 indexed _choice);\\n event NewPhaseDisputeKit(Phase _phase);\\n\\n // ************************************* //\\n // * Modifiers * //\\n // ************************************* //\\n\\n modifier notJumped(uint256 _coreDisputeID) {\\n require(!disputes[coreDisputeIDToLocal[_coreDisputeID]].jumped, \\\"Dispute jumped to a parent DK!\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _core The KlerosCore arbitrator.\\n * @param _rng The random number generator.\\n * @param _rngLookahead Lookahead value for rng.\\n */\\n constructor(address _governor, KlerosCore _core, RNG _rng, uint256 _rngLookahead) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Changes the `governor` storage variable.\\n * @param _governor The new value for the `governor` storage variable.\\n */\\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 */\\n function changeCore(address _core) external onlyByGovernor {\\n core = KlerosCore(_core);\\n }\\n\\n /** @dev Changes the `_rng` storage variable.\\n * @param _rng The new value for the `RNGenerator` storage variable.\\n * @param _rngLookahead The new value for the `rngLookahead` storage variable.\\n */\\n function changeRandomNumberGenerator(RNG _rng, uint256 _rngLookahead) external onlyByGovernor {\\n rng = _rng;\\n rngLookahead = _rngLookahead;\\n if (phase == Phase.generating) {\\n rngRequestedBlock = block.number + rngLookahead;\\n rng.requestRandomness(rngRequestedBlock);\\n }\\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 */\\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 disputesWithoutJurors++;\\n emit DisputeCreation(_coreDisputeID, _numberOfChoices, _extraData);\\n }\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() external override {\\n if (core.phase() == KlerosCore.Phase.staking || core.freezingPhaseTimeout()) {\\n require(phase != Phase.resolving, \\\"Already in Resolving phase\\\");\\n phase = Phase.resolving; // Safety net.\\n } else if (core.phase() == KlerosCore.Phase.freezing) {\\n if (phase == Phase.resolving) {\\n require(disputesWithoutJurors > 0, \\\"All the disputes have jurors\\\");\\n rngRequestedBlock = core.freezeBlock() + rngLookahead;\\n rng.requestRandomness(rngRequestedBlock);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n randomNumber = rng.receiveRandomness(rngRequestedBlock);\\n require(randomNumber != 0, \\\"Random number is not ready yet\\\");\\n phase = Phase.drawing;\\n } else if (phase == Phase.drawing) {\\n require(disputesWithoutJurors == 0, \\\"Not ready for Resolving phase\\\");\\n phase = Phase.resolving;\\n }\\n }\\n // Should not be reached if the phase is unchanged.\\n emit NewPhaseDisputeKit(phase);\\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 * @return drawnAddress The drawn address.\\n */\\n function draw(\\n uint256 _coreDisputeID\\n ) external override onlyByCore notJumped(_coreDisputeID) returns (address drawnAddress) {\\n require(phase == Phase.drawing, \\\"Should be in drawing phase\\\");\\n\\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 bytes32 key = bytes32(uint256(courtID)); // Get the ID of the tree.\\n\\n (uint256 K, uint256 nodesLength, ) = core.getSortitionSumTree(key, 0);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = uint256(\\n keccak256(abi.encodePacked(randomNumber, _coreDisputeID, round.votes.length))\\n );\\n currentDrawnNumber %= core.getSortitionSumTreeNode(key, 0);\\n\\n // TODO: Handle the situation when no one has staked yet.\\n\\n // While it still has children\\n while ((K * treeIndex) + 1 < nodesLength) {\\n for (uint256 i = 1; i <= K; i++) {\\n // Loop over children.\\n uint256 nodeIndex = (K * treeIndex) + i;\\n uint256 nodeValue = core.getSortitionSumTreeNode(key, nodeIndex);\\n\\n if (currentDrawnNumber >= nodeValue) {\\n // Go to the next child.\\n currentDrawnNumber -= nodeValue;\\n } else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n }\\n\\n (, , bytes32 ID) = core.getSortitionSumTree(key, treeIndex);\\n drawnAddress = stakePathIDToAccount(ID);\\n\\n if (postDrawCheck(_coreDisputeID, drawnAddress)) {\\n round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false}));\\n if (round.votes.length == round.nbVotes) {\\n disputesWithoutJurors--;\\n }\\n } else {\\n drawnAddress = address(0);\\n }\\n }\\n\\n /** @dev Sets the caller's commit for the specified votes. It can be called multiple times during the\\n * commit period, each call overrides the commits of the previous one.\\n * `O(n)` where\\n * `n` is the number of votes.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @param _voteIDs The IDs of the votes.\\n * @param _commit The commit. Note that justification string is a part of the commit.\\n */\\n function castCommit(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n bytes32 _commit\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.commit, \\\"The dispute should be in Commit period.\\\");\\n require(_commit != bytes32(0), \\\"Empty commit.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n round.votes[_voteIDs[i]].commit = _commit;\\n }\\n round.totalCommitted += _voteIDs.length;\\n emit CommitCast(_coreDisputeID, _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 */\\n function castVote(\\n uint256 _coreDisputeID,\\n uint256[] calldata _voteIDs,\\n uint256 _choice,\\n uint256 _salt,\\n string memory _justification\\n ) external notJumped(_coreDisputeID) {\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n require(period == KlerosCore.Period.vote, \\\"The dispute should be in Vote period.\\\");\\n require(_voteIDs.length > 0, \\\"No voteID provided\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n require(_choice <= dispute.numberOfChoices, \\\"Choice out of bounds\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , ) = core.courts(courtID);\\n\\n // Save the votes.\\n for (uint256 i = 0; i < _voteIDs.length; i++) {\\n require(round.votes[_voteIDs[i]].account == msg.sender, \\\"The caller has to own the vote.\\\");\\n require(\\n !hiddenVotes ||\\n round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),\\n \\\"The commit must match the choice in courts with hidden votes.\\\"\\n );\\n require(!round.votes[_voteIDs[i]].voted, \\\"Vote already cast.\\\");\\n round.votes[_voteIDs[i]].choice = _choice;\\n round.votes[_voteIDs[i]].voted = true;\\n }\\n\\n round.totalVoted += _voteIDs.length;\\n\\n round.counts[_choice] += _voteIDs.length;\\n if (_choice == round.winningChoice) {\\n if (round.tied) round.tied = false;\\n } else {\\n // Voted for another choice.\\n if (round.counts[_choice] == round.counts[round.winningChoice]) {\\n // Tie.\\n if (!round.tied) round.tied = true;\\n } else if (round.counts[_choice] > round.counts[round.winningChoice]) {\\n // New winner.\\n round.winningChoice = _choice;\\n round.tied = false;\\n }\\n }\\n emit Justification(_coreDisputeID, msg.sender, _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 */\\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 disputesWithoutJurors++;\\n }\\n core.appeal{value: appealCost}(_coreDisputeID, dispute.numberOfChoices, dispute.extraData);\\n }\\n\\n if (msg.value > contribution) payable(msg.sender).send(msg.value - contribution);\\n }\\n\\n /** @dev Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.\\n * @param _coreDisputeID Index of the dispute in Kleros Core contract.\\n * @param _beneficiary The address whose rewards to withdraw.\\n * @param _coreRoundID The round in the Kleros Core contract the caller wants to withdraw from.\\n * @param _choice The ruling option that the caller wants to withdraw from.\\n * @return amount The withdrawn amount.\\n */\\n function withdrawFeesAndRewards(\\n uint256 _coreDisputeID,\\n address payable _beneficiary,\\n uint256 _coreRoundID,\\n uint256 _choice\\n ) external returns (uint256 amount) {\\n (, , , bool isRuled, ) = core.disputes(_coreDisputeID);\\n require(isRuled, \\\"Dispute should be resolved.\\\");\\n\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]];\\n (uint256 finalRuling, , ) = core.currentRuling(_coreDisputeID);\\n\\n if (!round.hasPaid[_choice]) {\\n // Allow to reimburse if funding was unsuccessful for this ruling option.\\n amount = round.contributions[_beneficiary][_choice];\\n } else {\\n // Funding was successful for this ruling option.\\n if (_choice == finalRuling) {\\n // This ruling option is the ultimate winner.\\n amount = round.paidFees[_choice] > 0\\n ? (round.contributions[_beneficiary][_choice] * round.feeRewards) / round.paidFees[_choice]\\n : 0;\\n } else if (!round.hasPaid[finalRuling]) {\\n // The ultimate winner was not funded in this round. In this case funded ruling option(s) are reimbursed.\\n amount =\\n (round.contributions[_beneficiary][_choice] * round.feeRewards) /\\n (round.paidFees[round.fundedChoices[0]] + round.paidFees[round.fundedChoices[1]]);\\n }\\n }\\n round.contributions[_beneficiary][_choice] = 0;\\n\\n if (amount != 0) {\\n _beneficiary.send(amount); // Deliberate use of send to prevent reverting fallback. It's the user's responsibility to accept ETH.\\n emit Withdrawal(_coreDisputeID, _coreRoundID, _choice, _beneficiary, amount);\\n }\\n }\\n\\n /** @dev Submits evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID.\\n * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'.\\n */\\n function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external {\\n emit Evidence(_evidenceGroupID, msg.sender, _evidence);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return lastRound.fundedChoices;\\n }\\n\\n /** @dev Gets the current ruling of a specified dispute.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @return ruling The current ruling.\\n * @return tied Whether it's a tie or not.\\n * @return overridden Whether the ruling was overridden by appeal funding or not.\\n */\\n function currentRuling(\\n uint256 _coreDisputeID\\n ) external view override returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n tied = round.tied;\\n ruling = tied ? 0 : round.winningChoice;\\n (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);\\n // Override the final ruling if only one side funded the appeals.\\n if (period == KlerosCore.Period.execution) {\\n uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);\\n if (fundedChoices.length == 1) {\\n ruling = fundedChoices[0];\\n tied = false;\\n overridden = true;\\n }\\n }\\n }\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view override returns (uint256) {\\n // In this contract this degree can be either 0 or 1, but in other dispute kits this value can be something in between.\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Vote storage vote = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]].votes[_voteID];\\n (uint256 winningChoice, bool tied, ) = core.currentRuling(_coreDisputeID);\\n\\n if (vote.voted && (vote.choice == winningChoice || tied)) {\\n return ONE_BASIS_POINT;\\n } else {\\n return 0;\\n }\\n }\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\n function areCommitsAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalCommitted == round.votes.length;\\n }\\n\\n /** @dev Returns true if all of the jurors have cast their votes for the last round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core.\\n * @return Whether all of the jurors have cast their votes for the last round.\\n */\\n function areVotesAllCast(uint256 _coreDisputeID) external view override returns (bool) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n return round.totalVoted == round.votes.length;\\n }\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 function isResolving() external view override returns (bool) {\\n return phase == Phase.resolving;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n /** @dev Checks that the chosen address satisfies certain conditions for being drawn.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Chosen address.\\n * @return Whether the address can be drawn or not.\\n */\\n function postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) {\\n (uint96 courtID, , , , ) = core.disputes(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, courtID);\\n (, , uint256 minStake, , , ) = core.courts(courtID);\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror && stakedTokens >= minStake;\\n }\\n\\n /** @dev Retrieves a juror's address from the stake path ID.\\n * @param _stakePathID The stake path ID to unpack.\\n * @return account The account.\\n */\\n function stakePathIDToAccount(bytes32 _stakePathID) internal pure returns (address account) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(add(ptr, 0x0c), i), byte(i, _stakePathID))\\n }\\n account := mload(ptr)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb627e4dfcb2913c783c070da30a233443cbc1fa347d6b583e403b4d5dfc4dd89\",\"license\":\"MIT\"},\"src/evidence/IEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IEvidence\\n */\\ninterface IEvidence {\\n /**\\n * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\\n * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.\\n * @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\\n * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\\n */\\n event Evidence(uint256 indexed _evidenceGroupID, address indexed _party, string _evidence);\\n}\\n\",\"keccak256\":\"0xed5e03ae6fbe5c31f1524a12a30e5061d495b1e3d64e301c384c5eeb9ec7dd18\",\"license\":\"MIT\"},\"src/libraries/SortitionSumTreeFactoryV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactoryV2\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactoryV2 {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(SortitionSumTrees storage self, bytes32 _key, uint256 _K) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(SortitionSumTrees storage self, bytes32 _key, uint256 _value, bytes32 _ID) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n ) external view returns (uint256 startIndex, uint256[] memory values, bool hasMore) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x68d9aee384a067204cd8b1b68641fb50e28e38b6d8137877d7052011108f9c6b\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface RNG {\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRandomness(uint256 _block) external;\\n\\n /**\\n * @dev Receive the random number.\\n * @param _block Block the random number is linked to.\\n * @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x0075973344648673365c5a895e4315101e6ce896208a71eb7767f5a61bbf0fe1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620046e1380380620046e1833981016040819052620000349162000093565b600080546001600160a01b03199081166001600160a01b0396871617909155600180548216948616949094179093556002805490931691909316179055600455620000ed565b6001600160a01b03811681146200009057600080fd5b50565b60008060008060808587031215620000aa57600080fd5b8451620000b7816200007a565b6020860151909450620000ca816200007a565b6040860151909350620000dd816200007a565b6060959095015193969295505050565b6145e480620000fd6000396000f3fe6080604052600436106101cf5760003560e01c8063796490f9116100f8578063ba66fde711610090578063ba66fde7146105cd578063be467604146105ed578063c86ed89214610603578063ccbac9f514610618578063d605787b1461062e578063da3beb8c1461064e578063e349ad3014610498578063e4c0aaf41461066e578063f2f4eb261461068e57600080fd5b8063796490f9146104985780637c04034e146104ae5780637dc38f14146104ce5780638e426460146104e4578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b80634b2f0ea01161016b5780634b2f0ea01461033c5780634dbbebbc1461034f5780634fe264fb1461036f578063564a565d1461038f5780635c92e2f6146103be57806365540b96146103de57806369f3f0411461040b5780636d4cd8ea14610458578063751accd01461047857600080fd5b806303432744146101d45780630b274f2e146101fd5780630baa64d1146102145780630c340a24146102445780631200aabc1461027c5780631c3db16d146102a95780632cad95c0146102e6578063362c3479146102fc5780633b3041471461031c575b600080fd5b3480156101e057600080fd5b506101ea60075481565b6040519081526020015b60405180910390f35b34801561020957600080fd5b506102126106ae565b005b34801561022057600080fd5b5061023461022f3660046139ff565b610c32565b60405190151581526020016101f4565b34801561025057600080fd5b50600054610264906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b34801561028857600080fd5b506101ea6102973660046139ff565b60096020526000908152604090205481565b3480156102b557600080fd5b506102c96102c43660046139ff565b610ca9565b6040805193845291151560208401521515908201526060016101f4565b3480156102f257600080fd5b506101ea60035481565b34801561030857600080fd5b506101ea610317366004613a30565b610e28565b34801561032857600080fd5b506102646103373660046139ff565b611218565b61021261034a366004613a6d565b6117f9565b34801561035b57600080fd5b5061021261036a366004613a8f565b6120d2565b34801561037b57600080fd5b506101ea61038a366004613abb565b6121af565b34801561039b57600080fd5b506103af6103aa3660046139ff565b612301565b6040516101f493929190613b3f565b3480156103ca57600080fd5b506102126103d9366004613bb4565b6123c7565b3480156103ea57600080fd5b506103fe6103f93660046139ff565b6126e1565b6040516101f49190613c06565b34801561041757600080fd5b5061042b610426366004613abb565b6127a5565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f4565b34801561046457600080fd5b506102346104733660046139ff565b61285d565b34801561048457600080fd5b50610212610493366004613ce7565b6128d4565b3480156104a457600080fd5b506101ea61271081565b3480156104ba57600080fd5b506102126104c9366004613d53565b6129a6565b3480156104da57600080fd5b506101ea60045481565b3480156104f057600080fd5b506102126104ff366004613deb565b6130ac565b34801561051057600080fd5b5061021261051f366004613e49565b6130f8565b34801561053057600080fd5b5061054461053f366004613abb565b613141565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f4565b34801561057c57600080fd5b5060065461058a9060ff1681565b6040516101f49190613eaa565b3480156105a357600080fd5b506101ea614e2081565b3480156105b957600080fd5b506102126105c8366004613ed2565b613207565b3480156105d957600080fd5b506102346105e8366004613abb565b6133ea565b3480156105f957600080fd5b506101ea61138881565b34801561060f57600080fd5b50610234613485565b34801561062457600080fd5b506101ea60055481565b34801561063a57600080fd5b50600254610264906001600160a01b031681565b34801561065a57600080fd5b506101ea610669366004613a6d565b6134a5565b34801561067a57600080fd5b50610212610689366004613deb565b613607565b34801561069a57600080fd5b50600154610264906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613f2c565b600181111561073c5761073c613e94565b14806107c95750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190613f62565b1561085457600060065460ff1660028111156107e7576107e7613e94565b141561083a5760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600680546000919060ff19166001835b0217905550610bf1565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108db9190613f2c565b60018111156108ec576108ec613e94565b1415610bf157600060065460ff16600281111561090b5761090b613e94565b1415610a6c576000600754116109635760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f7273000000006044820152606401610831565b600454600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b457600080fd5b505afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190613f7d565b6109f69190613fac565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b5050600680546001935090915060ff1916828061084a565b600160065460ff166002811115610a8557610a85613e94565b1415610b77576002546003546040516304f3e41560e21b81526001600160a01b03909216916313cf905491610ac09160040190815260200190565b602060405180830381600087803b158015610ada57600080fd5b505af1158015610aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b129190613f7d565b6005819055610b635760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610831565b600680546002919060ff191660018361084a565b600260065460ff166002811115610b9057610b90613e94565b1415610bf15760075415610be65760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e672070686173650000006044820152606401610831565b6006805460ff191690555b6006546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c289160ff90911690613eaa565b60405180910390a1565b600081815260096020526040812054600880548392908110610c5657610c56613fc4565b60009182526020822060059091020180549092508290610c7890600190613fda565b81548110610c8857610c88613fc4565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806008600960008781526020019081526020016000205481548110610cd557610cd5613fc4565b60009182526020822060059091020180549092508290610cf790600190613fda565b81548110610d0757610d07613fc4565b60009182526020909120600c90910201600381015460ff169450905083610d32578060010154610d35565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190614008565b5090935060049250610dc7915050565b816004811115610dd957610dd9613e94565b1415610e1e576000610dea886126e1565b9050805160011415610e1c5780600081518110610e0957610e09613fc4565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610e7157600080fd5b505afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190614008565b50935050505080610efc5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e00000000006044820152606401610831565b600086815260096020526040812054600880549091908110610f2057610f20613fc4565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610f5457610f54613fc4565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160606040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe2919061406f565b5050600087815260078401602052604090205490915060ff1661102c576001600160a01b038816600090815260088301602090815260408083208984529091529020549450611172565b808614156110a257600086815260068301602052604090205461105057600061109b565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461109191906140ab565b61109b91906140e0565b9450611172565b600081815260078301602052604090205460ff166111725781600601600083600a016001815481106110d6576110d6613fc4565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061110c5761110c613fc4565b90600052602060002001548152602001908152602001600020546111309190613fac565b60098301546001600160a01b038a16600090815260088501602090815260408083208b845290915290205461116591906140ab565b61116f91906140e0565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561120c576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146112455760405162461bcd60e51b8152600401610831906140f4565b60008281526009602052604090205460088054849290811061126957611269613fc4565b600091825260209091206002600590920201015460ff161561129d5760405162461bcd60e51b815260040161083190614138565b600260065460ff1660028111156112b6576112b6613e94565b146113035760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e672070686173650000000000006044820152606401610831565b60008381526009602052604081205460088054909190811061132757611327613fc4565b6000918252602082206005909102018054909250829061134990600190613fda565b8154811061135957611359613fc4565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190614008565b505060015460405163bfabfe8f60e01b81526001600160601b038516600482018190526000602483018190529596509493508392506001600160a01b039091169063bfabfe8f9060440160606040518083038186803b15801561144957600080fd5b505afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611481919061416f565b50600554875460408051602081019390935282018d905260608201529193509150600090819060800160408051808303601f19018152908290528051602090910120600154630a48b58160e21b835260048301889052600060248401529092506001600160a01b031690632922d6049060440160206040518083038186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115449190613f7d565b61154e908261419d565b90505b8261155c83866140ab565b611567906001613fac565b10156116545760015b84811161164e5760008161158485886140ab565b61158e9190613fac565b600154604051630a48b58160e21b8152600481018a9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613f7d565b90508084106116315761162a8185613fda565b9350611639565b50925061164e565b50508080611646906141b1565b915050611570565b50611551565b60015460405163bfabfe8f60e01b815260048101879052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156116a057600080fd5b505afa1580156116b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d8919061416f565b925050506116e581613653565b9a506116f18c8c61367e565b156117e5578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b0154886000018054905014156117e057600780549060006117da836141cc565b91905055505b6117ea565b60009a505b50505050505050505050919050565b60008281526009602052604090205460088054849290811061181d5761181d613fc4565b600091825260209091206002600590920201015460ff16156118515760405162461bcd60e51b815260040161083190614138565b60008381526009602052604081205460088054909190811061187557611875613fc4565b9060005260206000209060050201905080600101548311156118d95760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610831565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561192157600080fd5b505afa158015611935573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195991906141e3565b9150915081421015801561196c57508042105b6119b15760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610831565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d9060240160606040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a25919061406f565b5050905086811415611a3b576127109150611abc565b612710611388611a4b8686613fda565b611a5591906140ab565b611a5f91906140e0565b611a698542613fda565b10611ab65760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610831565b614e2091505b84546000908690611acf90600190613fda565b81548110611adf57611adf613fc4565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611b3957600080fd5b505afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b719190613f7d565b611b7b9190613fda565b60008a815260078401602052604090205490915060ff1615611bdf5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610831565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611c2457600080fd5b505afa158015611c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5c9190613f7d565b90506000612710611c6d87846140ab565b611c7791906140e0565b611c819083613fac565b60008c815260068601602052604081205491925090821115611d325760008c81526006860160205260409020543490611cba9084613fda565b11611cdf5760008c8152600686016020526040902054611cda9083613fda565b611ce1565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611d29929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f845290915281208054839290611d5e908490613fac565b909155505060008c815260068601602052604081208054839290611d83908490613fac565b909155505060008c81526006860160205260409020548211611e555760008c815260068601602052604081205460098701805491929091611dc5908490613fac565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a8501546001101561209557828560090154611e729190613fda565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611ebb57600080fd5b505afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef39190613f62565b15611f0c5760028a01805460ff19166001179055612015565b895460038b016000611f1f876001613fac565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b8152600401611f9a91815260200190565b60206040518083038186803b158015611fb257600080fd5b505afa158015611fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fea9190613f7d565b600b82015560038101805460ff191660011790556007805490600061200e836141b1565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161206293929190614242565b6000604051808303818588803b15801561207b57600080fd5b505af115801561208f573d6000803e3d6000fd5b50505050505b803411156120c357336108fc6120ab8334613fda565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000546001600160a01b031633146120fc5760405162461bcd60e51b8152600401610831906142fa565b600280546001600160a01b0319166001600160a01b0384161790556004819055600160065460ff16600281111561213557612135613e94565b14156121ab576004546121489043613fac565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b15801561219257600080fd5b505af11580156121a6573d6000803e3d6000fd5b505050505b5050565b6000838152600960205260408120546008805483929081106121d3576121d3613fc4565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061220757612207613fc4565b90600052602060002090600c0201600001848154811061222957612229613fc4565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561228257600080fd5b505afa158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba919061406f565b506003850154919350915060ff1680156122de575081836002015414806122de5750805b156122f1576127109450505050506122fa565b60009450505050505b9392505050565b6008818154811061231157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161234490614207565b80601f016020809104026020016040519081016040528092919081815260200182805461237090614207565b80156123bd5780601f10612392576101008083540402835291602001916123bd565b820191906000526020600020905b8154815290600101906020018083116123a057829003601f168201915b5050505050905083565b6000848152600960205260409020546008805486929081106123eb576123eb613fc4565b600091825260209091206002600590920201015460ff161561241f5760405162461bcd60e51b815260040161083190614138565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561246457600080fd5b505afa158015612478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249c9190614008565b50909350600192506124ac915050565b8160048111156124be576124be613e94565b1461251b5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610831565b826125585760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610831565b60008681526009602052604081205460088054909190811061257c5761257c613fc4565b6000918252602082206005909102018054909250829061259e90600190613fda565b815481106125ae576125ae613fc4565b90600052602060002090600c0201905060005b8681101561267c5733828989848181106125dd576125dd613fc4565b90506020020135815481106125f4576125f4613fc4565b60009182526020909120600490910201546001600160a01b03161461262b5760405162461bcd60e51b81526004016108319061433c565b858289898481811061263f5761263f613fc4565b905060200201358154811061265657612656613fc4565b600091825260209091206001600490920201015580612674816141b1565b9150506125c1565b50868690508160050160008282546126949190613fac565b92505081905550877f631164ab329e3544c9075658fc5cd19297e0b191060d307414cf10ebc99d4a658888886040516126cf93929190614373565b60405180910390a25050505050505050565b600081815260096020526040812054600880546060939290811061270757612707613fc4565b6000918252602082206005909102018054909250829061272990600190613fda565b8154811061273957612739613fc4565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561279757602002820191906000526020600020905b815481526020019060010190808311612783575b505050505092505050919050565b60008060008060008060006008600960008c815260200190815260200160002054815481106127d6576127d6613fc4565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061280a5761280a613fc4565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526009602052604081205460088054839290811061288157612881613fc4565b600091825260208220600590910201805490925082906128a390600190613fda565b815481106128b3576128b3613fc4565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146128fe5760405162461bcd60e51b8152600401610831906142fa565b6000836001600160a01b0316838360405161291991906143b9565b60006040518083038185875af1925050503d8060008114612956576040519150601f19603f3d011682016040523d82523d6000602084013e61295b565b606091505b50509050806129a05760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610831565b50505050565b6000868152600960205260409020546008805488929081106129ca576129ca613fc4565b600091825260209091206002600590920201015460ff16156129fe5760405162461bcd60e51b815260040161083190614138565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b158015612a4357600080fd5b505afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b9190614008565b5090935060029250612a8b915050565b816004811115612a9d57612a9d613e94565b14612af85760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610831565b85612b3a5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610831565b600088815260096020526040812054600880549091908110612b5e57612b5e613fc4565b906000526020600020906005020190508060010154861115612bb95760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610831565b80546000908290612bcc90600190613fda565b81548110612bdc57612bdc613fc4565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6a9190614008565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612cc057600080fd5b505afa158015612cd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf891906143d5565b5050505091505060005b8a811015612f745733848d8d84818110612d1e57612d1e613fc4565b9050602002013581548110612d3557612d35613fc4565b60009182526020909120600490910201546001600160a01b031614612d6c5760405162461bcd60e51b81526004016108319061433c565b811580612de0575089888a604051602001612d899392919061442d565b60405160208183030381529060405280519060200120846000018d8d84818110612db557612db5613fc4565b9050602002013581548110612dcc57612dcc613fc4565b906000526020600020906004020160010154145b612e525760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610831565b838c8c83818110612e6557612e65613fc4565b9050602002013581548110612e7c57612e7c613fc4565b600091825260209091206003600490920201015460ff1615612ed55760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610831565b89848d8d84818110612ee957612ee9613fc4565b9050602002013581548110612f0057612f00613fc4565b60009182526020909120600260049092020101556001848d8d84818110612f2957612f29613fc4565b9050602002013581548110612f4057612f40613fc4565b60009182526020909120600490910201600301805460ff191691151591909117905580612f6c816141b1565b915050612d02565b508a8a9050836004016000828254612f8c9190613fac565b90915550506000898152600284016020526040812080548c9290612fb1908490613fac565b90915550506001830154891415612fe157600383015460ff1615612fdc5760038301805460ff191690555b61305b565b60018301546000908152600284016020526040808220548b8352912054141561302457600383015460ff16612fdc5760038301805460ff1916600117905561305b565b60018301546000908152600284016020526040808220548b8352912054111561305b576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051613096919061445a565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146130d65760405162461bcd60e51b8152600401610831906142fa565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce1069968484604051613134929190614496565b60405180910390a3505050565b60008060008060006008600960008a8152602001908152602001600020548154811061316f5761316f613fc4565b600091825260208083208a84526003600590930201918201905260408220548154919350839181106131a3576131a3613fc4565b90600052602060002090600c020160000187815481106131c5576131c5613fc4565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146132315760405162461bcd60e51b8152600401610831906140f4565b60088054600181018255600091909152600581027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee481018690557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101906132bc907ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee7018686613966565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561330e57600080fd5b505afa158015613322573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133469190613f7d565b6133509190613fda565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600990925282208490556007805491926133b1836141b1565b9190505550877fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581088888886040516126cf939291906144b2565b60008381526009602052604081205460088054839290811061340e5761340e613fc4565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061344257613442613fc4565b90600052602060002090600c0201600001848154811061346457613464613fc4565b600091825260209091206004909102016003015460ff169695505050505050565b60008060065460ff16600281111561349f5761349f613e94565b14905090565b6000828152600960205260408120546008805483929081106134c9576134c9613fc4565b600091825260208083208684526003600590930201918201905260408220548154919350839181106134fd576134fd613fc4565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561355757600080fd5b505afa15801561356b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358f919061406f565b50915091508260040154600014806135be5750801580156135be57506000828152600284016020526040902054155b156135d0576000945050505050613601565b80156135e55750506004015491506136019050565b5060009081526002909101602052604090205491506136019050565b92915050565b6000546001600160a01b031633146136315760405162461bcd60e51b8152600401610831906142fa565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060405160005b60148110156136765783811a81600c8401015360010161365b565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b1580156136c757600080fd5b505afa1580156136db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ff9190614008565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561375957600080fd5b505afa15801561376d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137919190613f7d565b61379b9190613fda565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b1580156137d757600080fd5b505afa1580156137eb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261381391908101906144cc565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561387357600080fd5b505afa158015613887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ab91906141e3565b600154604051630fad06e960e11b81526001600160601b03881660048201529294509092506000916001600160a01b0390911690631f5a0dd29060240160c06040518083038186803b15801561390057600080fd5b505afa158015613914573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061393891906143d5565b50505092505050838261394b9190613fac565b831015801561395a5750808310155b98975050505050505050565b82805461397290614207565b90600052602060002090601f01602090048101928261399457600085556139da565b82601f106139ad5782800160ff198235161785556139da565b828001600101855582156139da579182015b828111156139da5782358255916020019190600101906139bf565b506139e69291506139ea565b5090565b5b808211156139e657600081556001016139eb565b600060208284031215613a1157600080fd5b5035919050565b6001600160a01b0381168114613a2d57600080fd5b50565b60008060008060808587031215613a4657600080fd5b843593506020850135613a5881613a18565b93969395505050506040820135916060013590565b60008060408385031215613a8057600080fd5b50508035926020909101359150565b60008060408385031215613aa257600080fd5b8235613aad81613a18565b946020939093013593505050565b600080600060608486031215613ad057600080fd5b505081359360208301359350604090920135919050565b60005b83811015613b02578181015183820152602001613aea565b838111156129a05750506000910152565b60008151808452613b2b816020860160208601613ae7565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613b606060830184613b13565b95945050505050565b60008083601f840112613b7b57600080fd5b5081356001600160401b03811115613b9257600080fd5b6020830191508360208260051b8501011115613bad57600080fd5b9250929050565b60008060008060608587031215613bca57600080fd5b8435935060208501356001600160401b03811115613be757600080fd5b613bf387828801613b69565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613c3e57835183529284019291840191600101613c22565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c8857613c88613c4a565b604052919050565b60006001600160401b03831115613ca957613ca9613c4a565b613cbc601f8401601f1916602001613c60565b9050828152838383011115613cd057600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613cfc57600080fd5b8335613d0781613a18565b92506020840135915060408401356001600160401b03811115613d2957600080fd5b8401601f81018613613d3a57600080fd5b613d4986823560208401613c90565b9150509250925092565b60008060008060008060a08789031215613d6c57600080fd5b8635955060208701356001600160401b0380821115613d8a57600080fd5b613d968a838b01613b69565b909750955060408901359450606089013593506080890135915080821115613dbd57600080fd5b508701601f81018913613dcf57600080fd5b613dde89823560208401613c90565b9150509295509295509295565b600060208284031215613dfd57600080fd5b81356122fa81613a18565b60008083601f840112613e1a57600080fd5b5081356001600160401b03811115613e3157600080fd5b602083019150836020828501011115613bad57600080fd5b600080600060408486031215613e5e57600080fd5b8335925060208401356001600160401b03811115613e7b57600080fd5b613e8786828701613e08565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613ecc57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613eea57600080fd5b853594506020860135935060408601356001600160401b03811115613f0e57600080fd5b613f1a88828901613e08565b96999598509660600135949350505050565b600060208284031215613f3e57600080fd5b8151600281106122fa57600080fd5b80518015158114613f5d57600080fd5b919050565b600060208284031215613f7457600080fd5b6122fa82613f4d565b600060208284031215613f8f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613fbf57613fbf613f96565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613fec57613fec613f96565b500390565b80516001600160601b0381168114613f5d57600080fd5b600080600080600060a0868803121561402057600080fd5b61402986613ff1565b9450602086015161403981613a18565b60408701519094506005811061404e57600080fd5b925061405c60608701613f4d565b9150608086015190509295509295909350565b60008060006060848603121561408457600080fd5b8351925061409460208501613f4d565b91506140a260408501613f4d565b90509250925092565b60008160001904831182151516156140c5576140c5613f96565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140ef576140ef6140ca565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b60008060006060848603121561418457600080fd5b8351925060208401519150604084015190509250925092565b6000826141ac576141ac6140ca565b500690565b60006000198214156141c5576141c5613f96565b5060010190565b6000816141db576141db613f96565b506000190190565b600080604083850312156141f657600080fd5b505080516020909101519092909150565b600181811c9082168061421b57607f821691505b6020821081141561423c57634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c91508083168061427057607f831692505b85831081141561428e57634e487b7160e01b85526022600452602485fd5b60608801839052608088018180156142ad57600181146142be576142e9565b60ff198616825287820196506142e9565b60008b81526020902060005b868110156142e3578154848201529085019089016142ca565b83019750505b50949b9a5050505050505050505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6040808252810183905260006001600160fb1b0384111561439357600080fd5b8360051b8086606085013760009083016060019081526020909201929092529392505050565b600082516143cb818460208701613ae7565b9190910192915050565b60008060008060008060c087890312156143ee57600080fd5b6143f787613ff1565b955061440560208801613f4d565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b83815260008351614445816020850160208801613ae7565b60209201918201929092526040019392505050565b6020815260006122fa6020830184613b13565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006144aa60208301848661446d565b949350505050565b838152604060208201526000613b6060408301848661446d565b60008060008060008060c087890312156144e557600080fd5b865195506020808801519550604088015194506060880151935060808801516001600160401b038082111561451957600080fd5b818a0191508a601f83011261452d57600080fd5b81518181111561453f5761453f613c4a565b8060051b9150614550848301613c60565b818152918301840191848101908d84111561456a57600080fd5b938501935b83851015614594578451925061458483613a18565b828252938501939085019061456f565b80975050505050505060a08701519050929550929550929556fea26469706673582212202f9f8da9573dc1612ef3875ea8c880be59de0cda1b47f1971a5f783fe3ad4d6564736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106101cf5760003560e01c8063796490f9116100f8578063ba66fde711610090578063ba66fde7146105cd578063be467604146105ed578063c86ed89214610603578063ccbac9f514610618578063d605787b1461062e578063da3beb8c1461064e578063e349ad3014610498578063e4c0aaf41461066e578063f2f4eb261461068e57600080fd5b8063796490f9146104985780637c04034e146104ae5780637dc38f14146104ce5780638e426460146104e4578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b80634b2f0ea01161016b5780634b2f0ea01461033c5780634dbbebbc1461034f5780634fe264fb1461036f578063564a565d1461038f5780635c92e2f6146103be57806365540b96146103de57806369f3f0411461040b5780636d4cd8ea14610458578063751accd01461047857600080fd5b806303432744146101d45780630b274f2e146101fd5780630baa64d1146102145780630c340a24146102445780631200aabc1461027c5780631c3db16d146102a95780632cad95c0146102e6578063362c3479146102fc5780633b3041471461031c575b600080fd5b3480156101e057600080fd5b506101ea60075481565b6040519081526020015b60405180910390f35b34801561020957600080fd5b506102126106ae565b005b34801561022057600080fd5b5061023461022f3660046139ff565b610c32565b60405190151581526020016101f4565b34801561025057600080fd5b50600054610264906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b34801561028857600080fd5b506101ea6102973660046139ff565b60096020526000908152604090205481565b3480156102b557600080fd5b506102c96102c43660046139ff565b610ca9565b6040805193845291151560208401521515908201526060016101f4565b3480156102f257600080fd5b506101ea60035481565b34801561030857600080fd5b506101ea610317366004613a30565b610e28565b34801561032857600080fd5b506102646103373660046139ff565b611218565b61021261034a366004613a6d565b6117f9565b34801561035b57600080fd5b5061021261036a366004613a8f565b6120d2565b34801561037b57600080fd5b506101ea61038a366004613abb565b6121af565b34801561039b57600080fd5b506103af6103aa3660046139ff565b612301565b6040516101f493929190613b3f565b3480156103ca57600080fd5b506102126103d9366004613bb4565b6123c7565b3480156103ea57600080fd5b506103fe6103f93660046139ff565b6126e1565b6040516101f49190613c06565b34801561041757600080fd5b5061042b610426366004613abb565b6127a5565b604080519687529415156020870152938501929092526060840152608083015260a082015260c0016101f4565b34801561046457600080fd5b506102346104733660046139ff565b61285d565b34801561048457600080fd5b50610212610493366004613ce7565b6128d4565b3480156104a457600080fd5b506101ea61271081565b3480156104ba57600080fd5b506102126104c9366004613d53565b6129a6565b3480156104da57600080fd5b506101ea60045481565b3480156104f057600080fd5b506102126104ff366004613deb565b6130ac565b34801561051057600080fd5b5061021261051f366004613e49565b6130f8565b34801561053057600080fd5b5061054461053f366004613abb565b613141565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016101f4565b34801561057c57600080fd5b5060065461058a9060ff1681565b6040516101f49190613eaa565b3480156105a357600080fd5b506101ea614e2081565b3480156105b957600080fd5b506102126105c8366004613ed2565b613207565b3480156105d957600080fd5b506102346105e8366004613abb565b6133ea565b3480156105f957600080fd5b506101ea61138881565b34801561060f57600080fd5b50610234613485565b34801561062457600080fd5b506101ea60055481565b34801561063a57600080fd5b50600254610264906001600160a01b031681565b34801561065a57600080fd5b506101ea610669366004613a6d565b6134a5565b34801561067a57600080fd5b50610212610689366004613deb565b613607565b34801561069a57600080fd5b50600154610264906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b9190613f2c565b600181111561073c5761073c613e94565b14806107c95750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190613f62565b1561085457600060065460ff1660028111156107e7576107e7613e94565b141561083a5760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600680546000919060ff19166001835b0217905550610bf1565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a357600080fd5b505afa1580156108b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108db9190613f2c565b60018111156108ec576108ec613e94565b1415610bf157600060065460ff16600281111561090b5761090b613e94565b1415610a6c576000600754116109635760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f7273000000006044820152606401610831565b600454600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b457600080fd5b505afa1580156109c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ec9190613f7d565b6109f69190613fac565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b5050600680546001935090915060ff1916828061084a565b600160065460ff166002811115610a8557610a85613e94565b1415610b77576002546003546040516304f3e41560e21b81526001600160a01b03909216916313cf905491610ac09160040190815260200190565b602060405180830381600087803b158015610ada57600080fd5b505af1158015610aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b129190613f7d565b6005819055610b635760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f742072656164792079657400006044820152606401610831565b600680546002919060ff191660018361084a565b600260065460ff166002811115610b9057610b90613e94565b1415610bf15760075415610be65760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e672070686173650000006044820152606401610831565b6006805460ff191690555b6006546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c289160ff90911690613eaa565b60405180910390a1565b600081815260096020526040812054600880548392908110610c5657610c56613fc4565b60009182526020822060059091020180549092508290610c7890600190613fda565b81548110610c8857610c88613fc4565b60009182526020909120600c90910201805460059091015414949350505050565b6000806000806008600960008781526020019081526020016000205481548110610cd557610cd5613fc4565b60009182526020822060059091020180549092508290610cf790600190613fda565b81548110610d0757610d07613fc4565b60009182526020909120600c90910201600381015460ff169450905083610d32578060010154610d35565b60005b60015460405163564a565d60e01b8152600481018990529196506000916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190614008565b5090935060049250610dc7915050565b816004811115610dd957610dd9613e94565b1415610e1e576000610dea886126e1565b9050805160011415610e1c5780600081518110610e0957610e09613fc4565b6020026020010151965060009550600194505b505b5050509193909250565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610e7157600080fd5b505afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190614008565b50935050505080610efc5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e00000000006044820152606401610831565b600086815260096020526040812054600880549091908110610f2057610f20613fc4565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610f5457610f54613fc4565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160606040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe2919061406f565b5050600087815260078401602052604090205490915060ff1661102c576001600160a01b038816600090815260088301602090815260408083208984529091529020549450611172565b808614156110a257600086815260068301602052604090205461105057600061109b565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b865290935292205461109191906140ab565b61109b91906140e0565b9450611172565b600081815260078301602052604090205460ff166111725781600601600083600a016001815481106110d6576110d6613fc4565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061110c5761110c613fc4565b90600052602060002001548152602001908152602001600020546111309190613fac565b60098301546001600160a01b038a16600090815260088501602090815260408083208b845290915290205461116591906140ab565b61116f91906140e0565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561120c576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146112455760405162461bcd60e51b8152600401610831906140f4565b60008281526009602052604090205460088054849290811061126957611269613fc4565b600091825260209091206002600590920201015460ff161561129d5760405162461bcd60e51b815260040161083190614138565b600260065460ff1660028111156112b6576112b6613e94565b146113035760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e672070686173650000000000006044820152606401610831565b60008381526009602052604081205460088054909190811061132757611327613fc4565b6000918252602082206005909102018054909250829061134990600190613fda565b8154811061135957611359613fc4565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b1580156113af57600080fd5b505afa1580156113c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e79190614008565b505060015460405163bfabfe8f60e01b81526001600160601b038516600482018190526000602483018190529596509493508392506001600160a01b039091169063bfabfe8f9060440160606040518083038186803b15801561144957600080fd5b505afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611481919061416f565b50600554875460408051602081019390935282018d905260608201529193509150600090819060800160408051808303601f19018152908290528051602090910120600154630a48b58160e21b835260048301889052600060248401529092506001600160a01b031690632922d6049060440160206040518083038186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115449190613f7d565b61154e908261419d565b90505b8261155c83866140ab565b611567906001613fac565b10156116545760015b84811161164e5760008161158485886140ab565b61158e9190613fac565b600154604051630a48b58160e21b8152600481018a9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190613f7d565b90508084106116315761162a8185613fda565b9350611639565b50925061164e565b50508080611646906141b1565b915050611570565b50611551565b60015460405163bfabfe8f60e01b815260048101879052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156116a057600080fd5b505afa1580156116b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d8919061416f565b925050506116e581613653565b9a506116f18c8c61367e565b156117e5578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b0154886000018054905014156117e057600780549060006117da836141cc565b91905055505b6117ea565b60009a505b50505050505050505050919050565b60008281526009602052604090205460088054849290811061181d5761181d613fc4565b600091825260209091206002600590920201015460ff16156118515760405162461bcd60e51b815260040161083190614138565b60008381526009602052604081205460088054909190811061187557611875613fc4565b9060005260206000209060050201905080600101548311156118d95760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e6044820152606401610831565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561192157600080fd5b505afa158015611935573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195991906141e3565b9150915081421015801561196c57508042105b6119b15760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b6044820152606401610831565b604051631c3db16d60e01b81526004810187905260009081903090631c3db16d9060240160606040518083038186803b1580156119ed57600080fd5b505afa158015611a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a25919061406f565b5050905086811415611a3b576127109150611abc565b612710611388611a4b8686613fda565b611a5591906140ab565b611a5f91906140e0565b611a698542613fda565b10611ab65760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f736572006044820152606401610831565b614e2091505b84546000908690611acf90600190613fda565b81548110611adf57611adf613fc4565b60009182526020822060018054604051637e37c78b60e11b8152600481018f9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611b3957600080fd5b505afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b719190613f7d565b611b7b9190613fda565b60008a815260078401602052604090205490915060ff1615611bdf5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e00000000006044820152606401610831565b600154604051632cf6413f60e11b8152600481018c90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611c2457600080fd5b505afa158015611c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5c9190613f7d565b90506000612710611c6d87846140ab565b611c7791906140e0565b611c819083613fac565b60008c815260068601602052604081205491925090821115611d325760008c81526006860160205260409020543490611cba9084613fda565b11611cdf5760008c8152600686016020526040902054611cda9083613fda565b611ce1565b345b9050336001600160a01b0316848e7fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c08f85604051611d29929190918252602082015260400190565b60405180910390a45b33600090815260088601602090815260408083208f845290915281208054839290611d5e908490613fac565b909155505060008c815260068601602052604081208054839290611d83908490613fac565b909155505060008c81526006860160205260409020548211611e555760008c815260068601602052604081205460098701805491929091611dc5908490613fac565b9250508190555084600a018c908060018154018082558091505060019003906000526020600020016000909190919091505560018560070160008e815260200190815260200160002060006101000a81548160ff0219169083151502179055508b848e7fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00960405160405180910390a45b600a8501546001101561209557828560090154611e729190613fda565b60098601556001546040516319b8152960e01b8152600481018f90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611ebb57600080fd5b505afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef39190613f62565b15611f0c5760028a01805460ff19166001179055612015565b895460038b016000611f1f876001613fac565b81526020019081526020016000208190555060008a6000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538f6040518263ffffffff1660e01b8152600401611f9a91815260200190565b60206040518083038186803b158015611fb257600080fd5b505afa158015611fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fea9190613f7d565b600b82015560038101805460ff191660011790556007805490600061200e836141b1565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848f8d600101548e6004016040518563ffffffff1660e01b815260040161206293929190614242565b6000604051808303818588803b15801561207b57600080fd5b505af115801561208f573d6000803e3d6000fd5b50505050505b803411156120c357336108fc6120ab8334613fda565b6040518115909202916000818181858888f150505050505b50505050505050505050505050565b6000546001600160a01b031633146120fc5760405162461bcd60e51b8152600401610831906142fa565b600280546001600160a01b0319166001600160a01b0384161790556004819055600160065460ff16600281111561213557612135613e94565b14156121ab576004546121489043613fac565b6003819055600254604051637363ae1f60e01b815260048101929092526001600160a01b031690637363ae1f90602401600060405180830381600087803b15801561219257600080fd5b505af11580156121a6573d6000803e3d6000fd5b505050505b5050565b6000838152600960205260408120546008805483929081106121d3576121d3613fc4565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061220757612207613fc4565b90600052602060002090600c0201600001848154811061222957612229613fc4565b600091825260208220600154604051631c3db16d60e01b815260048082018c905293909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561228257600080fd5b505afa158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba919061406f565b506003850154919350915060ff1680156122de575081836002015414806122de5750805b156122f1576127109450505050506122fa565b60009450505050505b9392505050565b6008818154811061231157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161234490614207565b80601f016020809104026020016040519081016040528092919081815260200182805461237090614207565b80156123bd5780601f10612392576101008083540402835291602001916123bd565b820191906000526020600020905b8154815290600101906020018083116123a057829003601f168201915b5050505050905083565b6000848152600960205260409020546008805486929081106123eb576123eb613fc4565b600091825260209091206002600590920201015460ff161561241f5760405162461bcd60e51b815260040161083190614138565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561246457600080fd5b505afa158015612478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249c9190614008565b50909350600192506124ac915050565b8160048111156124be576124be613e94565b1461251b5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b6064820152608401610831565b826125585760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b6044820152606401610831565b60008681526009602052604081205460088054909190811061257c5761257c613fc4565b6000918252602082206005909102018054909250829061259e90600190613fda565b815481106125ae576125ae613fc4565b90600052602060002090600c0201905060005b8681101561267c5733828989848181106125dd576125dd613fc4565b90506020020135815481106125f4576125f4613fc4565b60009182526020909120600490910201546001600160a01b03161461262b5760405162461bcd60e51b81526004016108319061433c565b858289898481811061263f5761263f613fc4565b905060200201358154811061265657612656613fc4565b600091825260209091206001600490920201015580612674816141b1565b9150506125c1565b50868690508160050160008282546126949190613fac565b92505081905550877f631164ab329e3544c9075658fc5cd19297e0b191060d307414cf10ebc99d4a658888886040516126cf93929190614373565b60405180910390a25050505050505050565b600081815260096020526040812054600880546060939290811061270757612707613fc4565b6000918252602082206005909102018054909250829061272990600190613fda565b8154811061273957612739613fc4565b90600052602060002090600c0201905080600a0180548060200260200160405190810160405280929190818152602001828054801561279757602002820191906000526020600020905b815481526020019060010190808311612783575b505050505092505050919050565b60008060008060008060006008600960008c815260200190815260200160002054815481106127d6576127d6613fc4565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061280a5761280a613fc4565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526009602052604081205460088054839290811061288157612881613fc4565b600091825260208220600590910201805490925082906128a390600190613fda565b815481106128b3576128b3613fc4565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146128fe5760405162461bcd60e51b8152600401610831906142fa565b6000836001600160a01b0316838360405161291991906143b9565b60006040518083038185875af1925050503d8060008114612956576040519150601f19603f3d011682016040523d82523d6000602084013e61295b565b606091505b50509050806129a05760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610831565b50505050565b6000868152600960205260409020546008805488929081106129ca576129ca613fc4565b600091825260209091206002600590920201015460ff16156129fe5760405162461bcd60e51b815260040161083190614138565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b158015612a4357600080fd5b505afa158015612a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7b9190614008565b5090935060029250612a8b915050565b816004811115612a9d57612a9d613e94565b14612af85760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b6064820152608401610831565b85612b3a5760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b6044820152606401610831565b600088815260096020526040812054600880549091908110612b5e57612b5e613fc4565b906000526020600020906005020190508060010154861115612bb95760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b6044820152606401610831565b80546000908290612bcc90600190613fda565b81548110612bdc57612bdc613fc4565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6a9190614008565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612cc057600080fd5b505afa158015612cd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf891906143d5565b5050505091505060005b8a811015612f745733848d8d84818110612d1e57612d1e613fc4565b9050602002013581548110612d3557612d35613fc4565b60009182526020909120600490910201546001600160a01b031614612d6c5760405162461bcd60e51b81526004016108319061433c565b811580612de0575089888a604051602001612d899392919061442d565b60405160208183030381529060405280519060200120846000018d8d84818110612db557612db5613fc4565b9050602002013581548110612dcc57612dcc613fc4565b906000526020600020906004020160010154145b612e525760405162461bcd60e51b815260206004820152603d60248201527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20636f7572747320776974682068696464656e20766f7465732e0000006064820152608401610831565b838c8c83818110612e6557612e65613fc4565b9050602002013581548110612e7c57612e7c613fc4565b600091825260209091206003600490920201015460ff1615612ed55760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b6044820152606401610831565b89848d8d84818110612ee957612ee9613fc4565b9050602002013581548110612f0057612f00613fc4565b60009182526020909120600260049092020101556001848d8d84818110612f2957612f29613fc4565b9050602002013581548110612f4057612f40613fc4565b60009182526020909120600490910201600301805460ff191691151591909117905580612f6c816141b1565b915050612d02565b508a8a9050836004016000828254612f8c9190613fac565b90915550506000898152600284016020526040812080548c9290612fb1908490613fac565b90915550506001830154891415612fe157600383015460ff1615612fdc5760038301805460ff191690555b61305b565b60018301546000908152600284016020526040808220548b8352912054141561302457600383015460ff16612fdc5760038301805460ff1916600117905561305b565b60018301546000908152600284016020526040808220548b8352912054111561305b576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051613096919061445a565b60405180910390a4505050505050505050505050565b6000546001600160a01b031633146130d65760405162461bcd60e51b8152600401610831906142fa565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b0316837f39935cf45244bc296a03d6aef1cf17779033ee27090ce9c68d432367ce1069968484604051613134929190614496565b60405180910390a3505050565b60008060008060006008600960008a8152602001908152602001600020548154811061316f5761316f613fc4565b600091825260208083208a84526003600590930201918201905260408220548154919350839181106131a3576131a3613fc4565b90600052602060002090600c020160000187815481106131c5576131c5613fc4565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146132315760405162461bcd60e51b8152600401610831906140f4565b60088054600181018255600091909152600581027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee481018690557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101906132bc907ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee7018686613966565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561330e57600080fd5b505afa158015613322573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133469190613f7d565b6133509190613fda565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600990925282208490556007805491926133b1836141b1565b9190505550877fd3106f74c2d30a4b9230e756a3e78bde53865d40f6af4c479bb010ebaab581088888886040516126cf939291906144b2565b60008381526009602052604081205460088054839290811061340e5761340e613fc4565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061344257613442613fc4565b90600052602060002090600c0201600001848154811061346457613464613fc4565b600091825260209091206004909102016003015460ff169695505050505050565b60008060065460ff16600281111561349f5761349f613e94565b14905090565b6000828152600960205260408120546008805483929081106134c9576134c9613fc4565b600091825260208083208684526003600590930201918201905260408220548154919350839181106134fd576134fd613fc4565b600091825260208220600154604051631c3db16d60e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690631c3db16d9060240160606040518083038186803b15801561355757600080fd5b505afa15801561356b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358f919061406f565b50915091508260040154600014806135be5750801580156135be57506000828152600284016020526040902054155b156135d0576000945050505050613601565b80156135e55750506004015491506136019050565b5060009081526002909101602052604090205491506136019050565b92915050565b6000546001600160a01b031633146136315760405162461bcd60e51b8152600401610831906142fa565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060405160005b60148110156136765783811a81600c8401015360010161365b565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b1580156136c757600080fd5b505afa1580156136db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ff9190614008565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561375957600080fd5b505afa15801561376d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137919190613f7d565b61379b9190613fda565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b1580156137d757600080fd5b505afa1580156137eb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261381391908101906144cc565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561387357600080fd5b505afa158015613887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ab91906141e3565b600154604051630fad06e960e11b81526001600160601b03881660048201529294509092506000916001600160a01b0390911690631f5a0dd29060240160c06040518083038186803b15801561390057600080fd5b505afa158015613914573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061393891906143d5565b50505092505050838261394b9190613fac565b831015801561395a5750808310155b98975050505050505050565b82805461397290614207565b90600052602060002090601f01602090048101928261399457600085556139da565b82601f106139ad5782800160ff198235161785556139da565b828001600101855582156139da579182015b828111156139da5782358255916020019190600101906139bf565b506139e69291506139ea565b5090565b5b808211156139e657600081556001016139eb565b600060208284031215613a1157600080fd5b5035919050565b6001600160a01b0381168114613a2d57600080fd5b50565b60008060008060808587031215613a4657600080fd5b843593506020850135613a5881613a18565b93969395505050506040820135916060013590565b60008060408385031215613a8057600080fd5b50508035926020909101359150565b60008060408385031215613aa257600080fd5b8235613aad81613a18565b946020939093013593505050565b600080600060608486031215613ad057600080fd5b505081359360208301359350604090920135919050565b60005b83811015613b02578181015183820152602001613aea565b838111156129a05750506000910152565b60008151808452613b2b816020860160208601613ae7565b601f01601f19169290920160200192915050565b8381528215156020820152606060408201526000613b606060830184613b13565b95945050505050565b60008083601f840112613b7b57600080fd5b5081356001600160401b03811115613b9257600080fd5b6020830191508360208260051b8501011115613bad57600080fd5b9250929050565b60008060008060608587031215613bca57600080fd5b8435935060208501356001600160401b03811115613be757600080fd5b613bf387828801613b69565b9598909750949560400135949350505050565b6020808252825182820181905260009190848201906040850190845b81811015613c3e57835183529284019291840191600101613c22565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c8857613c88613c4a565b604052919050565b60006001600160401b03831115613ca957613ca9613c4a565b613cbc601f8401601f1916602001613c60565b9050828152838383011115613cd057600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613cfc57600080fd5b8335613d0781613a18565b92506020840135915060408401356001600160401b03811115613d2957600080fd5b8401601f81018613613d3a57600080fd5b613d4986823560208401613c90565b9150509250925092565b60008060008060008060a08789031215613d6c57600080fd5b8635955060208701356001600160401b0380821115613d8a57600080fd5b613d968a838b01613b69565b909750955060408901359450606089013593506080890135915080821115613dbd57600080fd5b508701601f81018913613dcf57600080fd5b613dde89823560208401613c90565b9150509295509295509295565b600060208284031215613dfd57600080fd5b81356122fa81613a18565b60008083601f840112613e1a57600080fd5b5081356001600160401b03811115613e3157600080fd5b602083019150836020828501011115613bad57600080fd5b600080600060408486031215613e5e57600080fd5b8335925060208401356001600160401b03811115613e7b57600080fd5b613e8786828701613e08565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613ecc57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613eea57600080fd5b853594506020860135935060408601356001600160401b03811115613f0e57600080fd5b613f1a88828901613e08565b96999598509660600135949350505050565b600060208284031215613f3e57600080fd5b8151600281106122fa57600080fd5b80518015158114613f5d57600080fd5b919050565b600060208284031215613f7457600080fd5b6122fa82613f4d565b600060208284031215613f8f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613fbf57613fbf613f96565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613fec57613fec613f96565b500390565b80516001600160601b0381168114613f5d57600080fd5b600080600080600060a0868803121561402057600080fd5b61402986613ff1565b9450602086015161403981613a18565b60408701519094506005811061404e57600080fd5b925061405c60608701613f4d565b9150608086015190509295509295909350565b60008060006060848603121561408457600080fd5b8351925061409460208501613f4d565b91506140a260408501613f4d565b90509250925092565b60008160001904831182151516156140c5576140c5613f96565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140ef576140ef6140ca565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b60008060006060848603121561418457600080fd5b8351925060208401519150604084015190509250925092565b6000826141ac576141ac6140ca565b500690565b60006000198214156141c5576141c5613f96565b5060010190565b6000816141db576141db613f96565b506000190190565b600080604083850312156141f657600080fd5b505080516020909101519092909150565b600181811c9082168061421b57607f821691505b6020821081141561423c57634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c91508083168061427057607f831692505b85831081141561428e57634e487b7160e01b85526022600452602485fd5b60608801839052608088018180156142ad57600181146142be576142e9565b60ff198616825287820196506142e9565b60008b81526020902060005b868110156142e3578154848201529085019089016142ca565b83019750505b50949b9a5050505050505050505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b6020808252601f908201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604082015260600190565b6040808252810183905260006001600160fb1b0384111561439357600080fd5b8360051b8086606085013760009083016060019081526020909201929092529392505050565b600082516143cb818460208701613ae7565b9190910192915050565b60008060008060008060c087890312156143ee57600080fd5b6143f787613ff1565b955061440560208801613f4d565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b83815260008351614445816020850160208801613ae7565b60209201918201929092526040019392505050565b6020815260006122fa6020830184613b13565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006144aa60208301848661446d565b949350505050565b838152604060208201526000613b6060408301848661446d565b60008060008060008060c087890312156144e557600080fd5b865195506020808801519550604088015194506060880151935060808801516001600160401b038082111561451957600080fd5b818a0191508a601f83011261452d57600080fd5b81518181111561453f5761453f613c4a565b8060051b9150614550848301613c60565b818152918301840191848101908d84111561456a57600080fd5b938501935b83851015614594578451925061458483613a18565b828252938501939085019061456f565b80975050505050505060a08701519050929550929550929556fea26469706673582212202f9f8da9573dc1612ef3875ea8c880be59de0cda1b47f1971a5f783fe3ad4d6564736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { @@ -1201,7 +1195,7 @@ "storageLayout": { "storage": [ { - "astId": 7879, + "astId": 4836, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "governor", "offset": 0, @@ -1209,23 +1203,23 @@ "type": "t_address" }, { - "astId": 7882, + "astId": 4839, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "core", "offset": 0, "slot": "1", - "type": "t_contract(KlerosCore)6033" + "type": "t_contract(KlerosCore)4807" }, { - "astId": 8056, + "astId": 5013, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rng", "offset": 0, "slot": "2", - "type": "t_contract(RNG)17208" + "type": "t_contract(RNG)20065" }, { - "astId": 8058, + "astId": 5015, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rngRequestedBlock", "offset": 0, @@ -1233,7 +1227,7 @@ "type": "t_uint256" }, { - "astId": 8060, + "astId": 5017, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rngLookahead", "offset": 0, @@ -1241,7 +1235,7 @@ "type": "t_uint256" }, { - "astId": 8062, + "astId": 5019, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "randomNumber", "offset": 0, @@ -1249,15 +1243,15 @@ "type": "t_uint256" }, { - "astId": 8065, + "astId": 5022, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "phase", "offset": 0, "slot": "6", - "type": "t_enum(Phase)7979" + "type": "t_enum(Phase)4936" }, { - "astId": 8067, + "astId": 5024, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "disputesWithoutJurors", "offset": 0, @@ -1265,15 +1259,15 @@ "type": "t_uint256" }, { - "astId": 8071, + "astId": 5028, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "disputes", "offset": 0, "slot": "8", - "type": "t_array(t_struct(Dispute)7994_storage)dyn_storage" + "type": "t_array(t_struct(Dispute)4951_storage)dyn_storage" }, { - "astId": 8075, + "astId": 5032, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "coreDisputeIDToLocal", "offset": 0, @@ -1287,20 +1281,20 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(Dispute)7994_storage)dyn_storage": { - "base": "t_struct(Dispute)7994_storage", + "t_array(t_struct(Dispute)4951_storage)dyn_storage": { + "base": "t_struct(Dispute)4951_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Dispute[]", "numberOfBytes": "32" }, - "t_array(t_struct(Round)8032_storage)dyn_storage": { - "base": "t_struct(Round)8032_storage", + "t_array(t_struct(Round)4989_storage)dyn_storage": { + "base": "t_struct(Round)4989_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Round[]", "numberOfBytes": "32" }, - "t_array(t_struct(Vote)8041_storage)dyn_storage": { - "base": "t_struct(Vote)8041_storage", + "t_array(t_struct(Vote)4998_storage)dyn_storage": { + "base": "t_struct(Vote)4998_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Vote[]", "numberOfBytes": "32" @@ -1326,17 +1320,17 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(KlerosCore)6033": { + "t_contract(KlerosCore)4807": { "encoding": "inplace", "label": "contract KlerosCore", "numberOfBytes": "20" }, - "t_contract(RNG)17208": { + "t_contract(RNG)20065": { "encoding": "inplace", "label": "contract RNG", "numberOfBytes": "20" }, - "t_enum(Phase)7979": { + "t_enum(Phase)4936": { "encoding": "inplace", "label": "enum DisputeKitClassic.Phase", "numberOfBytes": "1" @@ -1362,20 +1356,20 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(Dispute)7994_storage": { + "t_struct(Dispute)4951_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Dispute", "members": [ { - "astId": 7983, + "astId": 4940, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rounds", "offset": 0, "slot": "0", - "type": "t_array(t_struct(Round)8032_storage)dyn_storage" + "type": "t_array(t_struct(Round)4989_storage)dyn_storage" }, { - "astId": 7985, + "astId": 4942, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "numberOfChoices", "offset": 0, @@ -1383,7 +1377,7 @@ "type": "t_uint256" }, { - "astId": 7987, + "astId": 4944, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "jumped", "offset": 0, @@ -1391,7 +1385,7 @@ "type": "t_bool" }, { - "astId": 7991, + "astId": 4948, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "coreRoundIDToLocal", "offset": 0, @@ -1399,7 +1393,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 7993, + "astId": 4950, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "extraData", "offset": 0, @@ -1409,20 +1403,20 @@ ], "numberOfBytes": "160" }, - "t_struct(Round)8032_storage": { + "t_struct(Round)4989_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Round", "members": [ { - "astId": 7998, + "astId": 4955, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "votes", "offset": 0, "slot": "0", - "type": "t_array(t_struct(Vote)8041_storage)dyn_storage" + "type": "t_array(t_struct(Vote)4998_storage)dyn_storage" }, { - "astId": 8000, + "astId": 4957, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "winningChoice", "offset": 0, @@ -1430,7 +1424,7 @@ "type": "t_uint256" }, { - "astId": 8004, + "astId": 4961, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "counts", "offset": 0, @@ -1438,7 +1432,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 8006, + "astId": 4963, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "tied", "offset": 0, @@ -1446,7 +1440,7 @@ "type": "t_bool" }, { - "astId": 8008, + "astId": 4965, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "totalVoted", "offset": 0, @@ -1454,7 +1448,7 @@ "type": "t_uint256" }, { - "astId": 8010, + "astId": 4967, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "totalCommitted", "offset": 0, @@ -1462,7 +1456,7 @@ "type": "t_uint256" }, { - "astId": 8014, + "astId": 4971, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "paidFees", "offset": 0, @@ -1470,7 +1464,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 8018, + "astId": 4975, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "hasPaid", "offset": 0, @@ -1478,7 +1472,7 @@ "type": "t_mapping(t_uint256,t_bool)" }, { - "astId": 8024, + "astId": 4981, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "contributions", "offset": 0, @@ -1486,7 +1480,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" }, { - "astId": 8026, + "astId": 4983, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "feeRewards", "offset": 0, @@ -1494,7 +1488,7 @@ "type": "t_uint256" }, { - "astId": 8029, + "astId": 4986, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "fundedChoices", "offset": 0, @@ -1502,7 +1496,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 8031, + "astId": 4988, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "nbVotes", "offset": 0, @@ -1512,12 +1506,12 @@ ], "numberOfBytes": "384" }, - "t_struct(Vote)8041_storage": { + "t_struct(Vote)4998_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Vote", "members": [ { - "astId": 8034, + "astId": 4991, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "account", "offset": 0, @@ -1525,7 +1519,7 @@ "type": "t_address" }, { - "astId": 8036, + "astId": 4993, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "commit", "offset": 0, @@ -1533,7 +1527,7 @@ "type": "t_bytes32" }, { - "astId": 8038, + "astId": 4995, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "choice", "offset": 0, @@ -1541,7 +1535,7 @@ "type": "t_uint256" }, { - "astId": 8040, + "astId": 4997, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "voted", "offset": 0, diff --git a/contracts/deployments/arbitrumGoerli/DisputeResolver.json b/contracts/deployments/arbitrumGoerli/DisputeResolver.json index 2b7b75ed5..913be336d 100644 --- a/contracts/deployments/arbitrumGoerli/DisputeResolver.json +++ b/contracts/deployments/arbitrumGoerli/DisputeResolver.json @@ -1,5 +1,5 @@ { - "address": "0xa1f52474CFa1ee78758a4bBa35DE547133Bda62f", + "address": "0xDe3eCeB73C453E56F5661ad029a41341CF592b9A", "abi": [ { "inputs": [ @@ -43,37 +43,6 @@ "name": "Dispute", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IArbitrator", - "name": "_arbitrator", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_evidenceGroupID", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "_party", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "_evidence", - "type": "string" - } - ], - "name": "Evidence", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -232,30 +201,30 @@ "type": "function" } ], - "transactionHash": "0x8497b4a18e09133a73c999efd6bfdaadf9a10492bcd0eb035103005197786a20", + "transactionHash": "0xa2e75b2bafb996fa467c67b6fb6c0257e90ee44c834e3c1e7013652aa411c82a", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xa1f52474CFa1ee78758a4bBa35DE547133Bda62f", + "contractAddress": "0xDe3eCeB73C453E56F5661ad029a41341CF592b9A", "transactionIndex": 1, - "gasUsed": "4070987", + "gasUsed": "569678", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1c7f09499d9c301a4d8afbedfe6287251bf32bd6081a9989a6a4931c30b2efd9", - "transactionHash": "0x8497b4a18e09133a73c999efd6bfdaadf9a10492bcd0eb035103005197786a20", + "blockHash": "0x55e35117e10d49471478453183f98c1789438e1563446d57934387d7420a6e35", + "transactionHash": "0xa2e75b2bafb996fa467c67b6fb6c0257e90ee44c834e3c1e7013652aa411c82a", "logs": [], - "blockNumber": 4027984, - "cumulativeGasUsed": "4070987", + "blockNumber": 6456853, + "cumulativeGasUsed": "569678", "status": 1, "byzantium": true }, "args": [ - "0x4d7858e73a8842b5e6422D08a3349924dD062AbB" + "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24" ], - "numDeployments": 3, - "solcInputHash": "8e4e08d76a7f02df476a9f91ae4ef934", - "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_party\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"Evidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"MetaEvidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_metaevidenceURI\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"isRuled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numberOfRulingOptions\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"externalIDtoLocalID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor\",\"params\":{\"_arbitrator\":\"Target global arbitrator for any disputes.\"}},\"createDispute(bytes,string,uint256)\":{\"details\":\"TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_arbitratorExtraData\":\"Extra data for the arbitrator of the dispute.\",\"_metaevidenceURI\":\"Link to metaevidence of the dispute.\",\"_numberOfRulingOptions\":\"Number of ruling options.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the created dispute.\"}},\"rule(uint256,uint256)\":{\"details\":\"To be called by the arbitrator of the dispute, to declare the winning ruling.\",\"params\":{\"_externalDisputeID\":\"ID of the dispute in arbitrator contract.\",\"_ruling\":\"The ruling choice of the arbitration.\"}}},\"title\":\"DisputeResolver DisputeResolver contract adapted for V2 https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/arbitrables/DisputeResolver.sol\":\"DisputeResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0xe63efdae904b4299c17efd4c6174869a49fbfe1b11ccfd05fcc22e735ced7b26\",\"license\":\"MIT\"},\"src/arbitration/arbitrables/DisputeResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@ferittuncer, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n */\\n\\nimport \\\"../IArbitrable.sol\\\";\\nimport \\\"../../evidence/IMetaEvidence.sol\\\";\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title DisputeResolver\\n * DisputeResolver contract adapted for V2 https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\\n */\\ncontract DisputeResolver is IArbitrable, IMetaEvidence {\\n struct DisputeStruct {\\n bytes arbitratorExtraData; // Extra data for the dispute.\\n bool isRuled; // True if the dispute has been ruled.\\n uint256 ruling; // Ruling given to the dispute.\\n uint256 numberOfRulingOptions; // The number of choices the arbitrator can give.\\n }\\n\\n IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed.\\n\\n DisputeStruct[] public disputes; // Local disputes.\\n mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs.\\n\\n /** @dev Constructor\\n * @param _arbitrator Target global arbitrator for any disputes.\\n */\\n constructor(IArbitrator _arbitrator) {\\n arbitrator = _arbitrator;\\n }\\n\\n /** @dev TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute.\\n Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n * @param _arbitratorExtraData Extra data for the arbitrator of the dispute.\\n * @param _metaevidenceURI Link to metaevidence of the dispute.\\n * @param _numberOfRulingOptions Number of ruling options.\\n * @return disputeID Dispute id (on arbitrator side) of the created dispute.\\n */\\n function createDispute(\\n bytes calldata _arbitratorExtraData,\\n string calldata _metaevidenceURI,\\n uint256 _numberOfRulingOptions\\n ) external payable returns (uint256 disputeID) {\\n require(_numberOfRulingOptions > 1, \\\"Should be at least 2 ruling options.\\\");\\n\\n disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n uint256 localDisputeID = disputes.length;\\n disputes.push(\\n DisputeStruct({\\n arbitratorExtraData: _arbitratorExtraData,\\n isRuled: false,\\n ruling: 0,\\n numberOfRulingOptions: _numberOfRulingOptions\\n })\\n );\\n\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit MetaEvidence(localDisputeID, _metaevidenceURI);\\n emit Dispute(arbitrator, disputeID, localDisputeID, localDisputeID);\\n }\\n\\n /** @dev To be called by the arbitrator of the dispute, to declare the winning ruling.\\n * @param _externalDisputeID ID of the dispute in arbitrator contract.\\n * @param _ruling The ruling choice of the arbitration.\\n */\\n function rule(uint256 _externalDisputeID, uint256 _ruling) external override {\\n uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID];\\n DisputeStruct storage dispute = disputes[localDisputeID];\\n require(msg.sender == address(arbitrator), \\\"Only the arbitrator can execute this.\\\");\\n require(_ruling <= dispute.numberOfRulingOptions, \\\"Invalid ruling.\\\");\\n require(!dispute.isRuled, \\\"This dispute has been ruled already.\\\");\\n\\n dispute.isRuled = true;\\n dispute.ruling = _ruling;\\n\\n emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling);\\n }\\n}\\n\",\"keccak256\":\"0x9196cddbe3a32a4cc0695efd31712bcd990ca54fc869bb2eafa25dde3af2c7f4\",\"license\":\"MIT\"},\"src/evidence/IEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IEvidence\\n * ERC-1497: Evidence Standard\\n */\\ninterface IEvidence {\\n /**\\n * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).\\n * @param _arbitrator The arbitrator of the contract.\\n * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.\\n * @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.\\n * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'\\n */\\n event Evidence(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _evidenceGroupID,\\n address indexed _party,\\n string _evidence\\n );\\n}\\n\",\"keccak256\":\"0x9656bf34a7ec73bb3b42b6a880047736f395074ac1841096fec7f65337c197d4\",\"license\":\"MIT\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\nimport \\\"./IEvidence.sol\\\";\\n\\n/** @title IEvidence\\n * ERC-1497: Evidence Standard\\n */\\ninterface IMetaEvidence is IEvidence {\\n /**\\n * @dev To be emitted when meta-evidence is submitted.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json'\\n */\\n event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);\\n\\n /**\\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 _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n */\\n event Dispute(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _disputeID,\\n uint256 _metaEvidenceID,\\n uint256 _evidenceGroupID\\n );\\n}\\n\",\"keccak256\":\"0x0e11c56cda1de6f7976818cca8048b8d6d05090874667570cc9d9685e89d31eb\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516109f23803806109f283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161095361009f6000396000818160bc0152818161017c0152818161044c01526105f501526109536000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea26469706673582212201f4c6680b3acb7d299efdd3561dfb7357ead86be2ce578e95352cf7a65b0385064736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea26469706673582212201f4c6680b3acb7d299efdd3561dfb7357ead86be2ce578e95352cf7a65b0385064736f6c63430008090033", + "numDeployments": 4, + "solcInputHash": "86ef3911afc4fb1dc9daa46f19a1d3ba", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"MetaEvidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_metaevidenceURI\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"isRuled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numberOfRulingOptions\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"externalIDtoLocalID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor\",\"params\":{\"_arbitrator\":\"Target global arbitrator for any disputes.\"}},\"createDispute(bytes,string,uint256)\":{\"details\":\"TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_arbitratorExtraData\":\"Extra data for the arbitrator of the dispute.\",\"_metaevidenceURI\":\"Link to metaevidence of the dispute.\",\"_numberOfRulingOptions\":\"Number of ruling options.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the created dispute.\"}},\"rule(uint256,uint256)\":{\"details\":\"To be called by the arbitrator of the dispute, to declare the winning ruling.\",\"params\":{\"_externalDisputeID\":\"ID of the dispute in arbitrator contract.\",\"_ruling\":\"The ruling choice of the arbitration.\"}}},\"title\":\"DisputeResolver DisputeResolver contract adapted for V2 https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/arbitrables/DisputeResolver.sol\":\"DisputeResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/arbitration/arbitrables/DisputeResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@ferittuncer, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n */\\n\\nimport \\\"../IArbitrable.sol\\\";\\nimport \\\"../../evidence/IMetaEvidence.sol\\\";\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title DisputeResolver\\n * DisputeResolver contract adapted for V2 https://github.com/kleros/arbitrable-proxy-contracts/blob/master/contracts/ArbitrableProxy.sol.\\n */\\ncontract DisputeResolver is IArbitrable, IMetaEvidence {\\n struct DisputeStruct {\\n bytes arbitratorExtraData; // Extra data for the dispute.\\n bool isRuled; // True if the dispute has been ruled.\\n uint256 ruling; // Ruling given to the dispute.\\n uint256 numberOfRulingOptions; // The number of choices the arbitrator can give.\\n }\\n\\n IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed.\\n\\n DisputeStruct[] public disputes; // Local disputes.\\n mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs.\\n\\n /** @dev Constructor\\n * @param _arbitrator Target global arbitrator for any disputes.\\n */\\n constructor(IArbitrator _arbitrator) {\\n arbitrator = _arbitrator;\\n }\\n\\n /** @dev TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute.\\n Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n * @param _arbitratorExtraData Extra data for the arbitrator of the dispute.\\n * @param _metaevidenceURI Link to metaevidence of the dispute.\\n * @param _numberOfRulingOptions Number of ruling options.\\n * @return disputeID Dispute id (on arbitrator side) of the created dispute.\\n */\\n function createDispute(\\n bytes calldata _arbitratorExtraData,\\n string calldata _metaevidenceURI,\\n uint256 _numberOfRulingOptions\\n ) external payable returns (uint256 disputeID) {\\n require(_numberOfRulingOptions > 1, \\\"Should be at least 2 ruling options.\\\");\\n\\n disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n uint256 localDisputeID = disputes.length;\\n disputes.push(\\n DisputeStruct({\\n arbitratorExtraData: _arbitratorExtraData,\\n isRuled: false,\\n ruling: 0,\\n numberOfRulingOptions: _numberOfRulingOptions\\n })\\n );\\n\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit MetaEvidence(localDisputeID, _metaevidenceURI);\\n emit Dispute(arbitrator, disputeID, localDisputeID, localDisputeID);\\n }\\n\\n /** @dev To be called by the arbitrator of the dispute, to declare the winning ruling.\\n * @param _externalDisputeID ID of the dispute in arbitrator contract.\\n * @param _ruling The ruling choice of the arbitration.\\n */\\n function rule(uint256 _externalDisputeID, uint256 _ruling) external override {\\n uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID];\\n DisputeStruct storage dispute = disputes[localDisputeID];\\n require(msg.sender == address(arbitrator), \\\"Only the arbitrator can execute this.\\\");\\n require(_ruling <= dispute.numberOfRulingOptions, \\\"Invalid ruling.\\\");\\n require(!dispute.isRuled, \\\"This dispute has been ruled already.\\\");\\n\\n dispute.isRuled = true;\\n dispute.ruling = _ruling;\\n\\n emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling);\\n }\\n}\\n\",\"keccak256\":\"0x9196cddbe3a32a4cc0695efd31712bcd990ca54fc869bb2eafa25dde3af2c7f4\",\"license\":\"MIT\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IMetaEvidence\\n * ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator.\\n */\\ninterface IMetaEvidence {\\n /**\\n * @dev To be emitted when meta-evidence is submitted.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json'\\n */\\n event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);\\n\\n /**\\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 _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n */\\n event Dispute(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _disputeID,\\n uint256 _metaEvidenceID,\\n uint256 _evidenceGroupID\\n );\\n}\\n\",\"keccak256\":\"0xb87dec548b7c41bb2e2bd25ef3b2159d014c14cdd1e47ca4bec7894817cb8998\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b506040516109f23803806109f283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161095361009f6000396000818160bc0152818161017c0152818161044c01526105f501526109536000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea26469706673582212201d9cbc85ca25f947d5b840f25ea51157201d7dfac42d360364c459a5b4cbd85964736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea26469706673582212201d9cbc85ca25f947d5b840f25ea51157201d7dfac42d360364c459a5b4cbd85964736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { @@ -295,15 +264,15 @@ "storageLayout": { "storage": [ { - "astId": 7717, + "astId": 8233, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "disputes", "offset": 0, "slot": "0", - "type": "t_array(t_struct(DisputeStruct)7710_storage)dyn_storage" + "type": "t_array(t_struct(DisputeStruct)8226_storage)dyn_storage" }, { - "astId": 7721, + "astId": 8237, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "externalIDtoLocalID", "offset": 0, @@ -312,8 +281,8 @@ } ], "types": { - "t_array(t_struct(DisputeStruct)7710_storage)dyn_storage": { - "base": "t_struct(DisputeStruct)7710_storage", + "t_array(t_struct(DisputeStruct)8226_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)8226_storage", "encoding": "dynamic_array", "label": "struct DisputeResolver.DisputeStruct[]", "numberOfBytes": "32" @@ -335,12 +304,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(DisputeStruct)7710_storage": { + "t_struct(DisputeStruct)8226_storage": { "encoding": "inplace", "label": "struct DisputeResolver.DisputeStruct", "members": [ { - "astId": 7703, + "astId": 8219, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "arbitratorExtraData", "offset": 0, @@ -348,7 +317,7 @@ "type": "t_bytes_storage" }, { - "astId": 7705, + "astId": 8221, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "isRuled", "offset": 0, @@ -356,7 +325,7 @@ "type": "t_bool" }, { - "astId": 7707, + "astId": 8223, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "ruling", "offset": 0, @@ -364,7 +333,7 @@ "type": "t_uint256" }, { - "astId": 7709, + "astId": 8225, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "numberOfRulingOptions", "offset": 0, diff --git a/contracts/deployments/arbitrumGoerli/HomeGatewayToGnosis.json b/contracts/deployments/arbitrumGoerli/HomeGatewayToGnosis.json new file mode 100644 index 000000000..5ccd4ac23 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/HomeGatewayToGnosis.json @@ -0,0 +1,528 @@ +{ + "address": "0x12613A66F1E5A2086374e103F66BF0eddA5d1478", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "internalType": "contract IFastBridgeSender", + "name": "_fastBridgeSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiverGateway", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_receiverChainID", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_evidenceGroupID", + "type": "uint256" + } + ], + "name": "Dispute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "_evidence", + "type": "string" + } + ], + "name": "MetaEvidence", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "inputs": [], + "name": "arbitrator", + "outputs": [ + { + "internalType": "contract IArbitrator", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IFastBridgeSender", + "name": "_fastBridgeSender", + "type": "address" + } + ], + "name": "changeFastbridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "disputeHashToHomeID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "disputeHashtoID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "disputeHashtoRelayedData", + "outputs": [ + { + "internalType": "uint256", + "name": "arbitrationCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputeIDtoHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fastBridgeSender", + "outputs": [ + { + "internalType": "contract IFastBridgeSender", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "receiverChainID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "receiverGateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_foreignChainID", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_foreignBlockHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_foreignDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "relayCreateDispute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "rule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x1b37361bc716a5427f13a5eb668f22871da7547ac56e7ef44c4967d6a4772e35", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x12613A66F1E5A2086374e103F66BF0eddA5d1478", + "transactionIndex": 1, + "gasUsed": "693362", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000080000000000000000000000000002000000000000000010000000000000000000000000000000000000000000000000000000000000420000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x65f02fcc32ad3f4fd7aab1fb0f5e9adaf25f167be850f9260ad4f96736866e14", + "transactionHash": "0x1b37361bc716a5427f13a5eb668f22871da7547ac56e7ef44c4967d6a4772e35", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 6613971, + "transactionHash": "0x1b37361bc716a5427f13a5eb668f22871da7547ac56e7ef44c4967d6a4772e35", + "address": "0x12613A66F1E5A2086374e103F66BF0eddA5d1478", + "topics": [ + "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064252494447450000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0x65f02fcc32ad3f4fd7aab1fb0f5e9adaf25f167be850f9260ad4f96736866e14" + } + ], + "blockNumber": 6613971, + "cumulativeGasUsed": "693362", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", + "0x642B66C5D0F8c620C35264F2d2899A0E209D68d9", + "0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE", + 10200 + ], + "numDeployments": 1, + "solcInputHash": "274a15cfb06cddd0a2be7e47f1a3d37a", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"contract IFastBridgeSender\",\"name\":\"_fastBridgeSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiverGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_receiverChainID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"MetaEvidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IFastBridgeSender\",\"name\":\"_fastBridgeSender\",\"type\":\"address\"}],\"name\":\"changeFastbridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"disputeHashToHomeID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoRelayedData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"arbitrationCost\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeIDtoHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fastBridgeSender\",\"outputs\":[{\"internalType\":\"contract IFastBridgeSender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"receiverChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"receiverGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_foreignChainID\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_foreignBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_foreignDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"relayCreateDispute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"changeFastbridge(address)\":{\"details\":\"Changes the fastBridge, useful to increase the claim deposit.\",\"params\":{\"_fastBridgeSender\":\"The address of the new fastBridge.\"}},\"disputeHashToHomeID(bytes32)\":{\"details\":\"Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.\",\"params\":{\"_disputeHash\":\"dispute hash\"}},\"relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)\":{\"details\":\"Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.\",\"params\":{\"_arbitrable\":\"arbitrable\",\"_choices\":\"number of ruling choices\",\"_extraData\":\"extraData\",\"_foreignBlockHash\":\"foreignBlockHash\",\"_foreignChainID\":\"foreignChainId\",\"_foreignDisputeID\":\"foreignDisputeID\"}},\"rule(uint256,uint256)\":{\"details\":\"Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract.\",\"params\":{\"_disputeID\":\"ID of the dispute in the Arbitrator contract.\",\"_ruling\":\"Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Home Gateway Counterpart of `ForeignGateway`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/HomeGateway.sol\":\"HomeGateway\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /**\\n * @dev The Fast Bridge participants watch for these events to decide if a challenge should be submitted.\\n * @param _epoch The epoch for which the the claim was made.\\n * @param _batchMerkleRoot The timestamp of the claim creation.\\n */\\n event ClaimReceived(uint256 indexed _epoch, bytes32 indexed _batchMerkleRoot);\\n\\n /**\\n * @dev This event indicates that `sendSafeFallback()` should be called on the sending side.\\n * @param _epoch The epoch associated with the challenged claim.\\n */\\n event ClaimChallenged(uint256 indexed _epoch);\\n\\n /**\\n * @dev This events indicates that optimistic verification has succeeded. The messages are ready to be relayed.\\n * @param _epoch The epoch associated with the batch.\\n * @param _success The success of the optimistic verification.\\n */\\n event BatchVerified(uint256 indexed _epoch, bool _success);\\n\\n /**\\n * @dev This event indicates that the batch has been received via the Safe Bridge.\\n * @param _epoch The epoch associated with the batch.\\n * @param _isBridgerHonest Whether the bridger made an honest claim.\\n * @param _isChallengerHonest Whether the bridger made an honest challenge.\\n */\\n event BatchSafeVerified(uint256 indexed _epoch, bool _isBridgerHonest, bool _isChallengerHonest);\\n\\n /**\\n * @dev This event indicates that the claim deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _bridger The recipient of the claim deposit.\\n */\\n event ClaimDepositWithdrawn(uint256 indexed _epoch, address indexed _bridger);\\n\\n /**\\n * @dev This event indicates that the challenge deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _challenger The recipient of the challenge deposit.\\n */\\n event ChallengeDepositWithdrawn(uint256 indexed _epoch, address indexed _challenger);\\n\\n /**\\n * @dev This event indicates that a message has been relayed for the batch in this `_epoch`.\\n * @param _epoch The epoch associated with the batch.\\n * @param _nonce The nonce of the message that was relayed.\\n */\\n event MessageRelayed(uint256 indexed _epoch, uint256 indexed _nonce);\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Submit a claim about the `_batchMerkleRoot` for the latests completed Fast bridge epoch and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to claim.\\n * @param _batchMerkleRoot The hash claimed for the ticket.\\n */\\n function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable;\\n\\n /**\\n * @dev Submit a challenge for the claim of the current epoch's Fast Bridge batch merkleroot state and submit a deposit. The `batchMerkleRoot` in the claim already made for the last finalized epoch should be different from the one on the sending side, otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to challenge.\\n */\\n function challenge(uint256 _epoch) external payable;\\n\\n /**\\n * @dev Resolves the optimistic claim for '_epoch'.\\n * @param _epoch The epoch of the optimistic claim.\\n */\\n function verifyBatch(uint256 _epoch) external;\\n\\n /**\\n * @dev Verifies merkle proof for the given message and associated nonce for the most recent possible epoch and relays the message.\\n * @param _epoch The epoch in which the message was batched by the bridge.\\n * @param _proof The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch.\\n * @param _message The data on the cross-domain chain for the message.\\n */\\n function verifyAndRelayMessage(\\n uint256 _epoch,\\n bytes32[] calldata _proof,\\n bytes calldata _message\\n ) external;\\n\\n /**\\n * @dev Sends the deposit back to the Bridger if their claim is not successfully challenged. Includes a portion of the Challenger's deposit if unsuccessfully challenged.\\n * @param _epoch The epoch associated with the claim deposit to withraw.\\n */\\n function withdrawClaimDeposit(uint256 _epoch) external;\\n\\n /**\\n * @dev Sends the deposit back to the Challenger if his challenge is successful. Includes a portion of the Bridger's deposit.\\n * @param _epoch The epoch associated with the challenge deposit to withraw.\\n */\\n function withdrawChallengeDeposit(uint256 _epoch) external;\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Returns the `start` and `end` time of challenge period for this `epoch`.\\n * @param _epoch The epoch of the claim to request the challenge period.\\n * @return start The start time of the challenge period.\\n * @return end The end time of the challenge period.\\n */\\n function claimChallengePeriod(uint256 _epoch) external view returns (uint256 start, uint256 end);\\n\\n /**\\n * @dev Returns the epoch period.\\n */\\n function epochPeriod() external view returns (uint256 epochPeriod);\\n\\n /**\\n * @dev Returns the challenge period.\\n */\\n function challengePeriod() external view returns (uint256 challengePeriod);\\n}\\n\",\"keccak256\":\"0xff909a62e9a08540dafcd08c779a64917ed1e44be52d5a225ff9149ff95909e8\",\"license\":\"MIT\"},\"@kleros/vea-contracts/interfaces/IFastBridgeSender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeSender {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /**\\n * @dev The Fast Bridge participants need to watch for these events and relay the messageHash on the FastBridgeReceiverOnEthereum.\\n * @param fastMessage The fast message data.\\n * @param fastMessage The hash of the fast message data encoded with the nonce.\\n */\\n event MessageReceived(bytes fastMessage, bytes32 fastMessageHash);\\n\\n /**\\n * @dev The event is emitted when messages are sent through the canonical bridge.\\n * @param epoch The epoch of the batch requested to send.\\n * @param canonicalBridgeMessageID The unique identifier of the safe message returned by the canonical bridge.\\n */\\n event SentSafe(uint256 indexed epoch, bytes32 canonicalBridgeMessageID);\\n\\n /**\\n * The bridgers need to watch for these events and relay the\\n * batchMerkleRoot on the FastBridgeReceiver.\\n */\\n event BatchOutgoing(uint256 indexed batchID, uint256 batchSize, uint256 epoch, bytes32 batchMerkleRoot);\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * Note: Access must be restricted by the receiving gateway by checking the sender argument.\\n * @dev Sends an arbitrary message across domain using the Fast Bridge.\\n * @param _receiver The cross-domain contract address which receives the calldata.\\n * @param _calldata The receiving domain encoded message data.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external;\\n\\n /**\\n * Sends a batch of arbitrary message from one domain to another\\n * via the fast bridge mechanism.\\n */\\n function sendBatch() external;\\n\\n /**\\n * @dev Sends a markle root representing an arbitrary batch of messages across domain using the Safe Bridge, which relies on the chain's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.\\n * @param _epoch block number of batch\\n */\\n function sendSafeFallback(uint256 _epoch) external payable;\\n}\\n\",\"keccak256\":\"0xa5cb5243fff3d0eb309c88c3d93bc69a084b5ff46b5ab31967cfb6f41a2fa145\",\"license\":\"MIT\"},\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IFastBridgeReceiver.sol\\\";\\n\\ninterface IReceiverGateway {\\n function fastBridgeReceiver() external view returns (IFastBridgeReceiver);\\n\\n function senderChainID() external view returns (uint256);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xfa82fbd575c462ad6dffa18c67eb097a4c5088715ae956a836726aafa4be0f90\",\"license\":\"MIT\"},\"@kleros/vea-contracts/interfaces/ISenderGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IFastBridgeSender.sol\\\";\\n\\ninterface ISenderGateway {\\n function fastBridgeSender() external view returns (IFastBridgeSender);\\n\\n function receiverChainID() external view returns (uint256);\\n\\n function receiverGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0x0d45430dd52c290a79ab4715052550b23c36c0e83899f0be2559dd8d4477b2d9\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IMetaEvidence\\n * ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator.\\n */\\ninterface IMetaEvidence {\\n /**\\n * @dev To be emitted when meta-evidence is submitted.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json'\\n */\\n event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);\\n\\n /**\\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 _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n */\\n event Dispute(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _disputeID,\\n uint256 _metaEvidenceID,\\n uint256 _evidenceGroupID\\n );\\n}\\n\",\"keccak256\":\"0xb87dec548b7c41bb2e2bd25ef3b2159d014c14cdd1e47ca4bec7894817cb8998\",\"license\":\"MIT\"},\"src/gateway/HomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\nimport \\\"@kleros/vea-contracts/interfaces/IFastBridgeSender.sol\\\";\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\nimport \\\"./interfaces/IHomeGateway.sol\\\";\\n\\n/**\\n * Home Gateway\\n * Counterpart of `ForeignGateway`\\n */\\ncontract HomeGateway is IHomeGateway {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct RelayedData {\\n uint256 arbitrationCost;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n IArbitrator public immutable arbitrator;\\n IFastBridgeSender public fastBridgeSender;\\n address public override receiverGateway;\\n uint256 public immutable override receiverChainID;\\n mapping(uint256 => bytes32) public disputeIDtoHash;\\n mapping(bytes32 => uint256) public disputeHashtoID;\\n mapping(bytes32 => RelayedData) public disputeHashtoRelayedData;\\n\\n constructor(\\n address _governor,\\n IArbitrator _arbitrator,\\n IFastBridgeSender _fastBridgeSender,\\n address _receiverGateway,\\n uint256 _receiverChainID\\n ) {\\n governor = _governor;\\n arbitrator = _arbitrator;\\n fastBridgeSender = _fastBridgeSender;\\n receiverGateway = _receiverGateway;\\n receiverChainID = _receiverChainID;\\n\\n emit MetaEvidence(0, \\\"BRIDGE\\\");\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Changes the fastBridge, useful to increase the claim deposit.\\n * @param _fastBridgeSender The address of the new fastBridge.\\n */\\n function changeFastbridge(IFastBridgeSender _fastBridgeSender) external {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n fastBridgeSender = _fastBridgeSender;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.\\n * @param _foreignChainID foreignChainId\\n * @param _foreignBlockHash foreignBlockHash\\n * @param _foreignDisputeID foreignDisputeID\\n * @param _choices number of ruling choices\\n * @param _extraData extraData\\n * @param _arbitrable arbitrable\\n */\\n function relayCreateDispute(\\n uint256 _foreignChainID,\\n bytes32 _foreignBlockHash,\\n uint256 _foreignDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable override {\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n _foreignChainID,\\n _foreignBlockHash,\\n \\\"createDispute\\\",\\n _foreignDisputeID,\\n _choices,\\n _extraData,\\n _arbitrable\\n )\\n );\\n RelayedData storage relayedData = disputeHashtoRelayedData[disputeHash];\\n require(relayedData.relayer == address(0), \\\"Dispute already relayed\\\");\\n\\n // TODO: will mostly be replaced by the actual arbitrationCost paid on the foreignChain.\\n relayedData.arbitrationCost = arbitrator.arbitrationCost(_extraData);\\n require(msg.value >= relayedData.arbitrationCost, \\\"Not enough arbitration cost paid\\\");\\n\\n uint256 disputeID = arbitrator.createDispute{value: msg.value}(_choices, _extraData);\\n disputeIDtoHash[disputeID] = disputeHash;\\n disputeHashtoID[disputeHash] = disputeID;\\n relayedData.relayer = msg.sender;\\n\\n emit Dispute(arbitrator, disputeID, 0, 0);\\n }\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external override {\\n require(msg.sender == address(arbitrator), \\\"Only Arbitrator\\\");\\n\\n bytes32 disputeHash = disputeIDtoHash[_disputeID];\\n RelayedData memory relayedData = disputeHashtoRelayedData[disputeHash];\\n\\n bytes4 methodSelector = IForeignGateway.relayRule.selector;\\n bytes memory data = abi.encodeWithSelector(methodSelector, disputeHash, _ruling, relayedData.relayer);\\n\\n fastBridgeSender.sendFast(receiverGateway, data);\\n }\\n\\n /**\\n * @dev Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.\\n * @param _disputeHash dispute hash\\n */\\n function disputeHashToHomeID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoID[_disputeHash];\\n }\\n}\\n\",\"keccak256\":\"0x795f5944681e6a795ed33881c51833070024b717645fed51cce692faa26f3720\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrator.sol\\\";\\nimport \\\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitrator, IReceiverGateway {\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n // For cross-chain Evidence standard\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function createDisputeERC20(\\n uint256 _choices,\\n bytes calldata _extraData,\\n uint256 _amount\\n ) external returns (uint256 disputeID);\\n}\\n\",\"keccak256\":\"0x4cfc88d2d7cf211ce9a1f3c991f093baefa026784185da2319d566051d0c8c43\",\"license\":\"MIT\"},\"src/gateway/interfaces/IHomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrable.sol\\\";\\nimport \\\"../../evidence/IMetaEvidence.sol\\\";\\nimport \\\"@kleros/vea-contracts/interfaces/ISenderGateway.sol\\\";\\n\\ninterface IHomeGateway is IArbitrable, IMetaEvidence, ISenderGateway {\\n /**\\n * @dev Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.\\n * @param _foreignChainID foreignChainId\\n * @param _foreignBlockHash foreignBlockHash\\n * @param _foreignDisputeID foreignDisputeID\\n * @param _choices number of ruling choices\\n * @param _extraData extraData\\n * @param _arbitrable arbitrable\\n */\\n function relayCreateDispute(\\n uint256 _foreignChainID,\\n bytes32 _foreignBlockHash,\\n uint256 _foreignDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable;\\n\\n /**\\n * @dev Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.\\n * @param _disputeHash dispute hash\\n */\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x6296077e9f6f88653c48cd4aef0460f63c11a48c53810afd098277f95c778d95\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610bcf380380610bcf83398101604081905261002f916100e6565b600080546001600160a01b038088166001600160a01b031992831617835586811660805260018054878316908416179055600280549186169190921617905560a08290526040517f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906100bc9060208082526006908201526542524944474560d01b604082015260600190565b60405180910390a25050505050610151565b6001600160a01b03811681146100e357600080fd5b50565b600080600080600060a086880312156100fe57600080fd5b8551610109816100ce565b602087015190955061011a816100ce565b604087015190945061012b816100ce565b606087015190935061013c816100ce565b80925050608086015190509295509295909350565b60805160a051610a3d6101926000396000610286015260008181610130015281816102e0015281816104e3015281816105c001526106a90152610a3d6000f3fe6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610790565b6102d5565b005b6101096101193660046107da565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d366004610884565b610709565b34801561017e57600080fd5b5061019f61018d3660046108a8565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108a8565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108a8565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108a8565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c1565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f9796959493929190610926565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104cc5760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d1948185b1c9958591e481c995b185e5959604a1b604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061051a90889088906004016109af565b60206040518083038186803b15801561053257600080fd5b505afa158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a91906109cb565b8082553410156105bc5760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b815260040161060f939291906109e4565b6020604051808303818588803b15801561062857600080fd5b505af115801561063c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066191906109cb565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b0316331461076e5760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a357600080fd5b50508035926020909101359150565b6001600160a01b03811681146107c757600080fd5b50565b80356107d5816107b2565b919050565b600080600080600080600060c0888a0312156107f557600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082957600080fd5b818a0191508a601f83011261083d57600080fd5b81358181111561084c57600080fd5b8b602082850101111561085e57600080fd5b60208301955080945050505061087660a089016107ca565b905092959891949750929550565b60006020828403121561089657600080fd5b81356108a1816107b2565b9392505050565b6000602082840312156108ba57600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b818110156108fd578581018301518582016060015282016108e1565b8181111561090f576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c3602083018486610986565b949350505050565b6000602082840312156109dd57600080fd5b5051919050565b8381526040602082015260006109fe604083018486610986565b9594505050505056fea26469706673582212202706fc81fcec6ac92b29d62968422fd856cfdf693260030262280f3f60a900e464736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610790565b6102d5565b005b6101096101193660046107da565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d366004610884565b610709565b34801561017e57600080fd5b5061019f61018d3660046108a8565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108a8565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108a8565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108a8565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c1565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f9796959493929190610926565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104cc5760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d1948185b1c9958591e481c995b185e5959604a1b604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061051a90889088906004016109af565b60206040518083038186803b15801561053257600080fd5b505afa158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a91906109cb565b8082553410156105bc5760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b815260040161060f939291906109e4565b6020604051808303818588803b15801561062857600080fd5b505af115801561063c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066191906109cb565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b0316331461076e5760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a357600080fd5b50508035926020909101359150565b6001600160a01b03811681146107c757600080fd5b50565b80356107d5816107b2565b919050565b600080600080600080600060c0888a0312156107f557600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082957600080fd5b818a0191508a601f83011261083d57600080fd5b81358181111561084c57600080fd5b8b602082850101111561085e57600080fd5b60208301955080945050505061087660a089016107ca565b905092959891949750929550565b60006020828403121561089657600080fd5b81356108a1816107b2565b9392505050565b6000602082840312156108ba57600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b818110156108fd578581018301518582016060015282016108e1565b8181111561090f576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c3602083018486610986565b949350505050565b6000602082840312156109dd57600080fd5b5051919050565b8381526040602082015260006109fe604083018486610986565b9594505050505056fea26469706673582212202706fc81fcec6ac92b29d62968422fd856cfdf693260030262280f3f60a900e464736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "changeFastbridge(address)": { + "details": "Changes the fastBridge, useful to increase the claim deposit.", + "params": { + "_fastBridgeSender": "The address of the new fastBridge." + } + }, + "disputeHashToHomeID(bytes32)": { + "details": "Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.", + "params": { + "_disputeHash": "dispute hash" + } + }, + "relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)": { + "details": "Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.", + "params": { + "_arbitrable": "arbitrable", + "_choices": "number of ruling choices", + "_extraData": "extraData", + "_foreignBlockHash": "foreignBlockHash", + "_foreignChainID": "foreignChainId", + "_foreignDisputeID": "foreignDisputeID" + } + }, + "rule(uint256,uint256)": { + "details": "Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract.", + "params": { + "_disputeID": "ID of the dispute in the Arbitrator contract.", + "_ruling": "Ruling given by the arbitrator. Note that 0 is reserved for \"Not able/wanting to make a decision\"." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "Home Gateway Counterpart of `ForeignGateway`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15581, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15587, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "fastBridgeSender", + "offset": 0, + "slot": "1", + "type": "t_contract(IFastBridgeSender)162" + }, + { + "astId": 15590, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "receiverGateway", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 15597, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeIDtoHash", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 15601, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoID", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 15606, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoRelayedData", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_bytes32,t_struct(RelayedData)15579_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeSender)162": { + "encoding": "inplace", + "label": "contract IFastBridgeSender", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(RelayedData)15579_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct HomeGateway.RelayedData)", + "numberOfBytes": "32", + "value": "t_struct(RelayedData)15579_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_struct(RelayedData)15579_storage": { + "encoding": "inplace", + "label": "struct HomeGateway.RelayedData", + "members": [ + { + "astId": 15576, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "arbitrationCost", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 15578, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "relayer", + "offset": 0, + "slot": "1", + "type": "t_address" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/KlerosCore.json b/contracts/deployments/arbitrumGoerli/KlerosCore.json index 01735d427..5bc80decf 100644 --- a/contracts/deployments/arbitrumGoerli/KlerosCore.json +++ b/contracts/deployments/arbitrumGoerli/KlerosCore.json @@ -1,5 +1,5 @@ { - "address": "0x4d7858e73a8842b5e6422D08a3349924dD062AbB", + "address": "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", "abi": [ { "inputs": [ @@ -370,6 +370,31 @@ "name": "NewPhase", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrable", + "name": "_arbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -1683,37 +1708,37 @@ "type": "function" } ], - "transactionHash": "0x0c32b5391fcd5d19dac2f9072ae94d3b32fa25c61121b254ab8433a33fe5c99a", + "transactionHash": "0x1ea4535b6ce980a5fd9e9c7232b44a5864c7cb56c95bd29e8e90e8fa23cbb577", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x4d7858e73a8842b5e6422D08a3349924dD062AbB", + "contractAddress": "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", "transactionIndex": 1, - "gasUsed": "30294112", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000040000800000000000000000000000020000000200000000000800400000000000000000000000000000000000100000000000004000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000200000000008000000000000000000000000000000000000000000000000000060001002001000000000000000000000000004000000000000000000000000000000", - "blockHash": "0x503584a5c176e49f916bab232ae342ae5269b584b9e2e9806f63b75000365e4b", - "transactionHash": "0x0c32b5391fcd5d19dac2f9072ae94d3b32fa25c61121b254ab8433a33fe5c99a", + "gasUsed": "5779950", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000040000000000020000000000000000000000000000000000040000800000200000000000000000020000000000000000000800400000000000000000000000000200000000000000000000004000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000001000001000000000000000008000000000000000000000000020000000000000000000000000060001000001000000800000000000000000000000000000000000000000000000000", + "blockHash": "0x62f18267be6211ac7b2e67afdb47b83bf3a9781d1bbed1b794247d2b2a6e1e37", + "transactionHash": "0x1ea4535b6ce980a5fd9e9c7232b44a5864c7cb56c95bd29e8e90e8fa23cbb577", "logs": [ { "transactionIndex": 1, - "blockNumber": 4027978, - "transactionHash": "0x0c32b5391fcd5d19dac2f9072ae94d3b32fa25c61121b254ab8433a33fe5c99a", - "address": "0x4d7858e73a8842b5e6422D08a3349924dD062AbB", + "blockNumber": 6456845, + "transactionHash": "0x1ea4535b6ce980a5fd9e9c7232b44a5864c7cb56c95bd29e8e90e8fa23cbb577", + "address": "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", "topics": [ "0x7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498", "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x000000000000000000000000de31f2245d164620d08f5b0f8d43dce8b9708373", + "0x00000000000000000000000086734488abf0e1ad40bc4de4f820e808f39bea09", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x", "logIndex": 0, - "blockHash": "0x503584a5c176e49f916bab232ae342ae5269b584b9e2e9806f63b75000365e4b" + "blockHash": "0x62f18267be6211ac7b2e67afdb47b83bf3a9781d1bbed1b794247d2b2a6e1e37" }, { "transactionIndex": 1, - "blockNumber": 4027978, - "transactionHash": "0x0c32b5391fcd5d19dac2f9072ae94d3b32fa25c61121b254ab8433a33fe5c99a", - "address": "0x4d7858e73a8842b5e6422D08a3349924dD062AbB", + "blockNumber": 6456845, + "transactionHash": "0x1ea4535b6ce980a5fd9e9c7232b44a5864c7cb56c95bd29e8e90e8fa23cbb577", + "address": "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", "topics": [ "0xc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab10", "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -1721,13 +1746,13 @@ ], "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000", "logIndex": 1, - "blockHash": "0x503584a5c176e49f916bab232ae342ae5269b584b9e2e9806f63b75000365e4b" + "blockHash": "0x62f18267be6211ac7b2e67afdb47b83bf3a9781d1bbed1b794247d2b2a6e1e37" }, { "transactionIndex": 1, - "blockNumber": 4027978, - "transactionHash": "0x0c32b5391fcd5d19dac2f9072ae94d3b32fa25c61121b254ab8433a33fe5c99a", - "address": "0x4d7858e73a8842b5e6422D08a3349924dD062AbB", + "blockNumber": 6456845, + "transactionHash": "0x1ea4535b6ce980a5fd9e9c7232b44a5864c7cb56c95bd29e8e90e8fa23cbb577", + "address": "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24", "topics": [ "0xb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc79", "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -1736,11 +1761,11 @@ ], "data": "0x", "logIndex": 2, - "blockHash": "0x503584a5c176e49f916bab232ae342ae5269b584b9e2e9806f63b75000365e4b" + "blockHash": "0x62f18267be6211ac7b2e67afdb47b83bf3a9781d1bbed1b794247d2b2a6e1e37" } ], - "blockNumber": 4027978, - "cumulativeGasUsed": "30294112", + "blockNumber": 6456845, + "cumulativeGasUsed": "5779950", "status": 1, "byzantium": true }, @@ -1748,7 +1773,7 @@ "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", "0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610", "0x0000000000000000000000000000000000000000", - "0xde31F2245d164620d08f5b0f8D43dCe8B9708373", + "0x86734488ABF0E1AD40bc4DE4F820e808f39Bea09", [ 1800, 1800 @@ -1768,13 +1793,13 @@ ], 3 ], - "numDeployments": 3, - "solcInputHash": "8e4e08d76a7f02df476a9f91ae4ef934", - "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKit\",\"type\":\"address\"},{\"internalType\":\"uint256[2]\",\"name\":\"_phaseTimeouts\",\"type\":\"uint256[2]\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256[4]\",\"name\":\"_courtParameters\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealDecision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealPossible\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"CourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromCourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toCourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_param\",\"type\":\"string\"}],\"name\":\"CourtModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"DisputeKitCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"DisputeKitEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_fromDisputeKitID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_toDisputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"Draw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum KlerosCore.Period\",\"name\":\"_period\",\"type\":\"uint8\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum KlerosCore.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_newTotalStake\",\"type\":\"uint256\"}],\"name\":\"StakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_tokenAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_ethAmount\",\"type\":\"int256\"}],\"name\":\"TokenAndETHShift\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ALPHA_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DISPUTE_KIT_CLASSIC\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FORKING_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GENERAL_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_STAKE_PATHS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NON_PAYABLE_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NULL_DISPUTE_KIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SEARCH_ITERATIONS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"addNewDisputeKit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"appeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"}],\"name\":\"changeCourtAlpha\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"}],\"name\":\"changeCourtHiddenVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorsForJump\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"changeCourtMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"changeCourtTimesPerPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"}],\"name\":\"changeJurorProsecutionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxFreezingTime\",\"type\":\"uint256\"}],\"name\":\"changeMaxFreezingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"}],\"name\":\"changeMinStakingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"}],\"name\":\"changePinakion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"courts\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jurorsForCourtJump\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"createCourt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeReadIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeWriteIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delayedStakes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeKitNodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"parent\",\"type\":\"uint256\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"disputeKit\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"needsFreezing\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"depthLevel\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"contract IArbitrable\",\"name\":\"arbitrated\",\"type\":\"address\"},{\"internalType\":\"enum KlerosCore.Period\",\"name\":\"period\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lastPeriodChange\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputesKitIDsThatNeedFreezing\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[]\",\"name\":\"_disputeKitIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"enableDisputeKits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"executeDelayedStakes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"executeRuling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"freezeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"freezingPhaseTimeout\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKitChildren\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputesKitIDsThatNeedFreezing\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"staked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"locked\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"}],\"name\":\"getJurorCourtIDs\",\"outputs\":[{\"internalType\":\"uint96[]\",\"name\":\"\",\"type\":\"uint96[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfRounds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokensAtStakePerJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeesForJurors\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repartitions\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalties\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"drawnJurors\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"disputeKitID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_nodeIndex\",\"type\":\"uint256\"}],\"name\":\"getSortitionSumTree\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"K\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"ID\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getSortitionSumTreeNode\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getTimesPerPeriod\",\"outputs\":[{\"internalType\":\"uint256[4]\",\"name\":\"timesPerPeriod\",\"type\":\"uint256[4]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"isDisputeKitJumping\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"isSupported\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jurorProsecutionModule\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastPhaseChange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxFreezingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStakingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"passPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum KlerosCore.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pinakion\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_stake\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"addNewDisputeKit(address,uint256)\":{\"details\":\"Add a new supported dispute kit module to the court.\",\"params\":{\"_disputeKitAddress\":\"The address of the dispute kit contract.\",\"_parent\":\"The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court.\"}},\"appeal(uint256,uint256,bytes)\":{\"details\":\"Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_extraData\":\"Extradata for the dispute. Can be required during court jump.\",\"_numberOfChoices\":\"Number of choices for the dispute. Can be required during court jump.\"}},\"appealCost(uint256)\":{\"details\":\"Gets the cost of appealing a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"cost\":\"The appeal cost.\"}},\"appealPeriod(uint256)\":{\"details\":\"Gets the start and the end of a specified dispute's current appeal period.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"end\":\"The end of the appeal period.\",\"start\":\"The start of the appeal period.\"}},\"arbitrationCost(bytes)\":{\"details\":\"Gets the cost of arbitration in a specified court.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost.\"}},\"changeCourtAlpha(uint96,uint256)\":{\"details\":\"Changes the `alpha` property value of a specified court.\",\"params\":{\"_alpha\":\"The new value for the `alpha` property value.\",\"_courtID\":\"The ID of the court.\"}},\"changeCourtHiddenVotes(uint96,bool)\":{\"details\":\"Changes the `hiddenVotes` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_hiddenVotes\":\"The new value for the `hiddenVotes` property value.\"}},\"changeCourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}},\"changeCourtJurorsForJump(uint96,uint256)\":{\"details\":\"Changes the `jurorsForCourtJump` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_jurorsForCourtJump\":\"The new value for the `jurorsForCourtJump` property value.\"}},\"changeCourtMinStake(uint96,uint256)\":{\"details\":\"Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_minStake\":\"The new value for the `minStake` property value.\"}},\"changeCourtTimesPerPeriod(uint96,uint256[4])\":{\"details\":\"Changes the `timesPerPeriod` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_timesPerPeriod\":\"The new value for the `timesPerPeriod` property value.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeJurorProsecutionModule(address)\":{\"details\":\"Changes the `jurorProsecutionModule` storage variable.\",\"params\":{\"_jurorProsecutionModule\":\"The new value for the `jurorProsecutionModule` storage variable.\"}},\"changeMaxFreezingTime(uint256)\":{\"details\":\"Changes the `maxFreezingTime` storage variable.\",\"params\":{\"_maxFreezingTime\":\"The new value for the `maxFreezingTime` storage variable.\"}},\"changeMinStakingTime(uint256)\":{\"details\":\"Changes the `minStakingTime` storage variable.\",\"params\":{\"_minStakingTime\":\"The new value for the `minStakingTime` storage variable.\"}},\"changePinakion(address)\":{\"details\":\"Changes the `pinakion` storage variable.\",\"params\":{\"_pinakion\":\"The new value for the `pinakion` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_courtParameters\":\"Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\",\"_disputeKit\":\"The address of the default dispute kit.\",\"_governor\":\"The governor's address.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the general court.\",\"_jurorProsecutionModule\":\"The address of the juror prosecution module.\",\"_phaseTimeouts\":\"minStakingTime and maxFreezingTime respectively\",\"_pinakion\":\"The address of the token contract.\",\"_sortitionSumTreeK\":\"The number of children per node of the general court's sortition sum tree.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the general court.\"}},\"createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,uint256[])\":{\"details\":\"Creates a court under a specified parent court.\",\"params\":{\"_alpha\":\"The `alpha` property value of the court.\",\"_feeForJuror\":\"The `feeForJuror` property value of the court.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the court.\",\"_jurorsForCourtJump\":\"The `jurorsForCourtJump` property value of the court.\",\"_minStake\":\"The `minStake` property value of the court.\",\"_parent\":\"The `parent` property value of the court.\",\"_sortitionSumTreeK\":\"The number of children per node of the court's sortition sum tree.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this court will support.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the court.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Creates a dispute. Must be called by the arbitrable contract.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"Number of choices for the jurors to choose from.\"},\"returns\":{\"disputeID\":\"The ID of the created dispute.\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws jurors for the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\"}},\"enableDisputeKits(uint96,uint256[],bool)\":{\"details\":\"Adds/removes court's support for specified dispute kits.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the court.\"}},\"execute(uint256,uint256,uint256)\":{\"details\":\"Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\",\"_round\":\"The appeal round.\"}},\"executeDelayedStakes(uint256)\":{\"details\":\"Executes the next delayed stakes.\",\"params\":{\"_iterations\":\"The number of delayed stakes to execute.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"executeRuling(uint256)\":{\"details\":\"Executes a specified dispute's ruling. UNTRUSTED.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getDisputeKitChildren(uint256)\":{\"details\":\"Gets non-primitive properties of a specified dispute kit node.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"},\"returns\":{\"_0\":\"children Indexes of children of this DK.\"}},\"getTimesPerPeriod(uint96)\":{\"details\":\"Gets the timesPerPeriod array for a given court.\",\"params\":{\"_courtID\":\"The ID of the court to get the times from.\"},\"returns\":{\"timesPerPeriod\":\"The timesPerPeriod array for the given court.\"}},\"isDisputeKitJumping(uint256)\":{\"details\":\"Returns true if the dispute kit will be switched to a parent DK.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"_0\":\"Whether DK will be switched or not.\"}},\"passPeriod(uint256)\":{\"details\":\"Passes the period of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"passPhase()\":{\"details\":\"Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\"},\"setStake(uint96,uint256)\":{\"details\":\"Sets the caller's stake in a court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_stake\":\"The new stake.\"}}},\"title\":\"KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the token and the dispute kit contracts.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/KlerosCore.sol\":\"KlerosCore\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0xe63efdae904b4299c17efd4c6174869a49fbfe1b11ccfd05fcc22e735ced7b26\",\"license\":\"MIT\"},\"src/arbitration/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\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.\\n */\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /**\\n * @dev Emitted when casting a vote to provide the justification of juror's choice.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Address of the juror.\\n * @param _choice The choice juror voted for.\\n * @param _justification Justification of the choice.\\n */\\n event Justification(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\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 */\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() 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 * @return drawnAddress The drawn address.\\n */\\n function draw(uint256 _coreDisputeID) 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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\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 */\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 /** @dev Returns the number of disputes without jurors in the dispute kit.\\n * @return The number of disputes without jurors in the dispute kit.\\n */\\n function disputesWithoutJurors() external view returns (uint256);\\n\\n /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\\n * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\\n */\\n function isResolving() external view returns (bool);\\n}\\n\",\"keccak256\":\"0xecebcf3e67b261c5e521f6bd9fd184151833f521008f38e4935f907ca1f17d0f\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrator.sol\\\";\\nimport \\\"./IDisputeKit.sol\\\";\\nimport {SortitionSumTreeFactory} from \\\"../data-structures/SortitionSumTreeFactory.sol\\\";\\n\\n/**\\n * @title KlerosCore\\n * Core arbitrator contract for Kleros v2.\\n * Note that this contract trusts the token and the dispute kit contracts.\\n */\\ncontract KlerosCore is IArbitrator {\\n using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees; // Use library functions for sortition sum trees.\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n staking, // Stake can be updated during this phase.\\n freezing // Phase during which the dispute kits can undergo the drawing process. Staking is not allowed during this phase.\\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 tokens needed to stake in the court.\\n uint256 alpha; // Basis point of tokens that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrable 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 tokensAtStakePerJuror; // The amount of tokens 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 penalties; // The amount of tokens collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n mapping(uint96 => uint256) stakedTokens; // The number of tokens the juror has staked in the court in the form `stakedTokens[courtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the court in the form `lockedTokens[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n bool needsFreezing; // The dispute kit needs freezing.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n uint256 penalty; // Penalty value, in case the stake was set during execution.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Freezing if there are open disputes.\\n uint256 public maxFreezingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public freezeBlock; // Number of the block when Core was frozen.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n uint256[] public disputesKitIDsThatNeedFreezing; // The disputeKitIDs that need switching to Freezing phase.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n SortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking.\\n\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event NewPhase(Phase _phase);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount, uint256 _newTotalStake);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256 _sortitionSumTreeK,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(uint96 indexed _courtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n int256 _tokenAmount,\\n int256 _ethAmount\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _pinakion The address of the token contract.\\n * @param _jurorProsecutionModule The address of the juror prosecution module.\\n * @param _disputeKit The address of the default dispute kit.\\n * @param _phaseTimeouts minStakingTime and maxFreezingTime respectively\\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 _sortitionSumTreeK The number of children per node of the general court's sortition sum tree.\\n */\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n uint256[2] memory _phaseTimeouts,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionSumTrees.createTree(bytes32(uint256(FORKING_COURT)), _sortitionSumTreeK);\\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 sortitionSumTrees.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionSumTreeK);\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n new uint256[](0)\\n );\\n enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\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 */\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Changes the `pinakion` storage variable.\\n * @param _pinakion The new value for the `pinakion` storage variable.\\n */\\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 */\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /** @dev Changes the `minStakingTime` storage variable.\\n * @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n */\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /** @dev Changes the `maxFreezingTime` storage variable.\\n * @param _maxFreezingTime The new value for the `maxFreezingTime` storage variable.\\n */\\n function changeMaxFreezingTime(uint256 _maxFreezingTime) external onlyByGovernor {\\n maxFreezingTime = _maxFreezingTime;\\n }\\n\\n /** @dev Add a new supported dispute kit module to the court.\\n * @param _disputeKitAddress The address of the dispute kit contract.\\n * @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n * Note that the root DK must be supported by the general court.\\n */\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n require(_parent < disputeKitID, \\\"!Parent\\\");\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n require(depthLevel < SEARCH_ITERATIONS, \\\"Depth level max\\\");\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n needsFreezing: false,\\n depthLevel: depthLevel\\n })\\n );\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /** @dev Creates a court under a specified parent court.\\n * @param _parent The `parent` property value of the court.\\n * @param _hiddenVotes The `hiddenVotes` property value of the court.\\n * @param _minStake The `minStake` property value of the court.\\n * @param _alpha The `alpha` property value of the court.\\n * @param _feeForJuror The `feeForJuror` property value of the court.\\n * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n * @param _sortitionSumTreeK The number of children per node of the court's sortition sum tree.\\n * @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n */\\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 uint256 _sortitionSumTreeK,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n require(courts[_parent].minStake <= _minStake, \\\"MinStake lower than parent court\\\");\\n require(_supportedDisputeKits.length > 0, \\\"!Supported DK\\\");\\n require(_parent != FORKING_COURT, \\\"Invalid: Forking court as parent\\\");\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n require(\\n _supportedDisputeKits[i] > 0 && _supportedDisputeKits[i] < disputeKitNodes.length,\\n \\\"Wrong DK index\\\"\\n );\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionSumTrees.createTree(bytes32(courtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n _supportedDisputeKits\\n );\\n }\\n\\n /** @dev Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\\n * @param _courtID The ID of the court.\\n * @param _minStake The new value for the `minStake` property value.\\n */\\n function changeCourtMinStake(uint96 _courtID, uint256 _minStake) external onlyByGovernor {\\n require(\\n _courtID == GENERAL_COURT || courts[courts[_courtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n require(courts[courts[_courtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_courtID].minStake = _minStake;\\n emit CourtModified(_courtID, \\\"minStake\\\");\\n }\\n\\n /** @dev Changes the `alpha` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _alpha The new value for the `alpha` property value.\\n */\\n function changeCourtAlpha(uint96 _courtID, uint256 _alpha) external onlyByGovernor {\\n courts[_courtID].alpha = _alpha;\\n emit CourtModified(_courtID, \\\"alpha\\\");\\n }\\n\\n /** @dev Changes the `feeForJuror` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n courts[_courtID].feeForJuror = _feeForJuror;\\n emit CourtModified(_courtID, \\\"feeForJuror\\\");\\n }\\n\\n /** @dev Changes the `jurorsForCourtJump` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value.\\n */\\n function changeCourtJurorsForJump(uint96 _courtID, uint256 _jurorsForCourtJump) external onlyByGovernor {\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n emit CourtModified(_courtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeCourtHiddenVotes(uint96 _courtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n emit CourtModified(_courtID, \\\"hiddenVotes\\\");\\n }\\n\\n /** @dev Changes the `timesPerPeriod` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _timesPerPeriod The new value for the `timesPerPeriod` property value.\\n */\\n function changeCourtTimesPerPeriod(uint96 _courtID, uint256[4] memory _timesPerPeriod) external onlyByGovernor {\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(_courtID, \\\"timesPerPeriod\\\");\\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 */\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n require(_disputeKitIDs[i] > 0 && _disputeKitIDs[i] < disputeKitNodes.length, \\\"Wrong DK index\\\");\\n enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\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 _stake The new stake.\\n */\\n function setStake(uint96 _courtID, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _courtID, _stake, 0), \\\"Staking failed\\\");\\n }\\n\\n /** @dev Executes the next delayed stakes.\\n * @param _iterations The number of delayed stakes to execute.\\n */\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"!Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.courtID, delayedStake.stake, delayedStake.penalty);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n /** @dev Creates a dispute. Must be called by the arbitrable contract.\\n * @param _numberOfChoices Number of choices for the jurors to choose from.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes),\\n * the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n * @return disputeID The ID of the created dispute.\\n */\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 courtID, , uint256 disputeKitID) = extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[courtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by court\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = msg.value / court.feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = msg.value;\\n\\n if (!disputeKitNodes[disputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[disputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(disputeKitID);\\n }\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n /** @dev Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\\n */\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(block.timestamp - lastPhaseChange >= minStakingTime, \\\"MinStakingTime not passed\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"No DK needs freezing\\\");\\n phase = Phase.freezing;\\n freezeBlock = block.number;\\n } else {\\n // phase == Phase.freezing\\n bool timeout = this.freezingPhaseTimeout();\\n for (int256 i = int256(disputesKitIDsThatNeedFreezing.length) - 1; i >= 0; --i) {\\n uint256 disputeKitID = disputesKitIDsThatNeedFreezing[uint256(i)];\\n IDisputeKit disputeKit = disputeKitNodes[disputesKitIDsThatNeedFreezing[uint256(i)]].disputeKit;\\n if (timeout && !disputeKit.isResolving()) {\\n // Force the dispute kit to be ready for Staking phase.\\n disputeKit.passPhase(); // Should not be called if already in Resolving phase, because it reverts.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n if (disputeKit.disputesWithoutJurors() == 0) {\\n // The dispute kit had time to finish drawing jurors for all its disputes.\\n disputeKitNodes[disputeKitID].needsFreezing = false;\\n if (i < int256(disputesKitIDsThatNeedFreezing.length) - 1) {\\n // This is not the last element so copy the last element to the current one, then pop.\\n disputesKitIDsThatNeedFreezing[uint256(i)] = disputesKitIDsThatNeedFreezing[\\n disputesKitIDsThatNeedFreezing.length - 1\\n ];\\n }\\n disputesKitIDsThatNeedFreezing.pop();\\n }\\n }\\n }\\n phase = Phase.staking;\\n }\\n // Should not be reached if the phase is unchanged.\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /** @dev Passes the period of a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n */\\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 require(\\n currentRound > 0 ||\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Evidence not passed && !Appeal\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"Dispute still drawing\\\");\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID),\\n \\\"Commit period not passed\\\"\\n );\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID),\\n \\\"Vote period not passed\\\"\\n );\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Appeal period not passed\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"Dispute period is final\\\");\\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 */\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n require(phase == Phase.freezing, \\\"Wrong phase\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n require(dispute.period == Period.evidence, \\\"!Evidence period\\\");\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n uint256 startIndex = round.drawnJurors.length;\\n uint256 endIndex = startIndex + _iterations <= round.nbVotes ? startIndex + _iterations : round.nbVotes;\\n\\n for (uint256 i = startIndex; i < endIndex; i++) {\\n address drawnAddress = disputeKit.draw(_disputeID);\\n if (drawnAddress != address(0)) {\\n // In case no one has staked at the court yet.\\n jurors[drawnAddress].lockedTokens[dispute.courtID] += round.tokensAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n }\\n }\\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 */\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"ETH too low for appeal cost\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute not appealable\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), \\\"Dispute Kit only\\\");\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n if (!disputeKitNodes[newDisputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[newDisputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(newDisputeKitID);\\n }\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /** @dev Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\\n * @param _disputeID The ID of the dispute.\\n * @param _round The appeal round.\\n * @param _iterations The number of iterations to run.\\n */\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 end = round.repartitions + _iterations;\\n uint256 penaltiesInRoundCache = round.penalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n address account; // Address of the juror.\\n uint256 degreeOfCoherence; // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\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 penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n\\n for (uint256 i = round.repartitions; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n // Penalty.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i);\\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 // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.tokensAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n penaltiesInRoundCache += penalty;\\n\\n account = round.drawnJurors[i];\\n jurors[account].lockedTokens[dispute.courtID] -= penalty; // Release this part of locked tokens.\\n\\n // Can only update the stake if it is able to cover the minStake and penalty, otherwise unstake from the court.\\n if (jurors[account].stakedTokens[dispute.courtID] >= courts[dispute.courtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.courtID] - penalty;\\n setStakeForAccount(account, dispute.courtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.courtID] != 0) {\\n setStakeForAccount(account, dispute.courtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n uint96[] memory courtIDs = getJurorCourtIDs(account);\\n for (uint256 j = 0; j < courtIDs.length; j++) {\\n setStakeForAccount(account, courtIDs[j], 0, 0);\\n }\\n }\\n emit TokenAndETHShift(account, _disputeID, -int256(penalty), 0);\\n\\n if (i == numberOfVotesInRound - 1) {\\n if (coherentCount == 0) {\\n // No one was coherent. Send the rewards to governor.\\n payable(governor).send(round.totalFeesForJurors);\\n safeTransfer(governor, penaltiesInRoundCache);\\n }\\n }\\n } else {\\n // Reward.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);\\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 account = round.drawnJurors[i % numberOfVotesInRound];\\n\\n // Release the rest of the tokens of the juror for this round.\\n jurors[account].lockedTokens[dispute.courtID] -=\\n (round.tokensAtStakePerJuror * degreeOfCoherence) /\\n ALPHA_DIVISOR;\\n\\n // Give back the locked tokens in case the juror fully unstaked earlier.\\n if (jurors[account].stakedTokens[dispute.courtID] == 0) {\\n uint256 tokenLocked = (round.tokensAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenLocked);\\n }\\n\\n uint256 tokenReward = ((penaltiesInRoundCache / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n uint256 ethReward = ((round.totalFeesForJurors / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenReward);\\n payable(account).send(ethReward);\\n emit TokenAndETHShift(account, _disputeID, int256(tokenReward), int256(ethReward));\\n }\\n }\\n\\n if (round.penalties != penaltiesInRoundCache) {\\n round.penalties = penaltiesInRoundCache;\\n }\\n round.repartitions = end;\\n }\\n\\n /** @dev Executes a specified dispute's ruling. UNTRUSTED.\\n * @param _disputeID The ID of the dispute.\\n */\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n require(!dispute.ruled, \\\"Ruling already executed\\\");\\n\\n (uint256 winningChoice, , ) = currentRuling(_disputeID);\\n dispute.ruled = true;\\n dispute.arbitrated.rule(_disputeID, winningChoice);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /** @dev Gets the cost of arbitration in a specified court.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes)\\n * and the minimum number of jurors required (next 32 bytes).\\n * @return cost The arbitration cost.\\n */\\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 Gets the cost of appealing a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n * @return cost The appeal cost.\\n */\\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 */\\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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(\\n uint256 _disputeID,\\n uint256 _round\\n )\\n external\\n view\\n returns (\\n uint256 tokensAtStakePerJuror,\\n uint256 totalFeesForJurors,\\n uint256 repartitions,\\n uint256 penalties,\\n address[] memory drawnJurors,\\n uint256 disputeKitID\\n )\\n {\\n Round storage round = disputes[_disputeID].rounds[_round];\\n return (\\n round.tokensAtStakePerJuror,\\n round.totalFeesForJurors,\\n round.repartitions,\\n round.penalties,\\n round.drawnJurors,\\n round.disputeKitID\\n );\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _courtID) external view returns (uint256 staked, uint256 locked) {\\n staked = jurors[_juror].stakedTokens[_courtID];\\n locked = jurors[_juror].lockedTokens[_courtID];\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /** @dev Gets non-primitive properties of a specified dispute kit node.\\n * @param _disputeKitID The ID of the dispute kit.\\n * @return children Indexes of children of this DK.\\n */\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /** @dev Gets the timesPerPeriod array for a given court.\\n * @param _courtID The ID of the court to get the times from.\\n * @return timesPerPeriod The timesPerPeriod array for the given court.\\n */\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) external view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTree(\\n bytes32 _key,\\n uint256 _nodeIndex\\n ) public view returns (uint256 K, uint256 length, bytes32 ID) {\\n SortitionSumTreeFactory.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n length = tree.nodes.length;\\n ID = tree.nodeIndexesToIDs[_nodeIndex];\\n }\\n\\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 function freezingPhaseTimeout() external view returns (bool) {\\n return phase == Phase.freezing && block.timestamp - lastPhaseChange >= maxFreezingTime;\\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 */\\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 getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /** @dev Sets the specified juror's stake in a court.\\n * `O(n + p * log_k(j))` where\\n * `n` is the number of courts the juror has staked in,\\n * `p` is the depth of the court tree,\\n * `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n * and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n * @param _account The address of the juror.\\n * @param _courtID The ID of the court.\\n * @param _stake The new stake.\\n * @param _penalty Penalized amount won't be transferred back to juror when the stake is lowered.\\n * @return succeeded True if the call succeeded, false otherwise.\\n */\\n function setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndCourtIDToStakePathID(_account, _courtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_courtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_courtID].minStake || _stake < juror.lockedTokens[_courtID]) return false;\\n if (currentStake == 0 && juror.courtIDs.length >= MAX_STAKE_PATHS) return false;\\n }\\n\\n // Delayed action logic.\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake,\\n penalty: _penalty\\n });\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_stake >= currentStake) {\\n transferredAmount = _stake - currentStake;\\n if (transferredAmount > 0) {\\n if (safeTransferFrom(_account, address(this), transferredAmount)) {\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n return false;\\n }\\n }\\n } else if (_stake == 0) {\\n // Keep locked tokens in the contract and release them after dispute is executed.\\n transferredAmount = currentStake - juror.lockedTokens[_courtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\n for (uint256 i = 0; i < juror.courtIDs.length; i++) {\\n if (juror.courtIDs[i] == _courtID) {\\n juror.courtIDs[i] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n } else {\\n return false;\\n }\\n }\\n } else {\\n transferredAmount = currentStake - _stake - _penalty;\\n if (transferredAmount > 0) {\\n if (!safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n }\\n\\n // Update juror's records.\\n uint256 newTotalStake = juror.stakedTokens[_courtID] - currentStake + _stake;\\n juror.stakedTokens[_courtID] = newTotalStake;\\n\\n // Update court parents.\\n bool finished = false;\\n uint256 currentCourtID = _courtID;\\n while (!finished) {\\n sortitionSumTrees.set(bytes32(currentCourtID), _stake, stakePathID);\\n if (currentCourtID == GENERAL_COURT) finished = true;\\n else currentCourtID = courts[currentCourtID].parent;\\n }\\n\\n emit StakeSet(_account, _courtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n * Note that if extradata contains an incorrect value then this value will be switched to default.\\n * @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return courtID The court ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\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 = MIN_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a court ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _courtID The court ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n\\n /** @dev Calls transfer() without reverting.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransfer(address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transfer.selector, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /** @dev Calls transferFrom() without reverting.\\n * @param _from Sender address.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0xde11c91f411945f1437a1dbd14995162def51b507086fa41d3113f121c047bf0\",\"license\":\"MIT\"},\"src/data-structures/SortitionSumTreeFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactory\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactory {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _K\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _value,\\n bytes32 _ID\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n )\\n external\\n view\\n returns (\\n uint256 startIndex,\\n uint256[] memory values,\\n bool hasMore\\n )\\n {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n bytes32 _ID\\n ) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x158abfe345fecd93d3d6de008c01f4f72ffb03af5c6fbdf0208c7228fc978114\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040526001600f553480156200001657600080fd5b5060405162006655380380620066558339810160408190526200003991620005d3565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c831690841617815560028054928c1692909316919091179091558651600355602080880151600455426005556008805490920182558183526040805160a08101825284815281518581528084019092529293918301915081526001600160a01b0389166020808301919091526000604083018190526060909201829052835460018181018655948352918190208351600490930201918255828101518051939492936200011193850192919091019062000458565b5060408281015160028301805460608601511515600160a01b026001600160a81b03199091166001600160a01b0393841617179055608090930151600390920191909155516000918816906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a4600780546001018155600090815260405163483abc4f60e11b8152600c60048201526024810191909152604481018290527340a78989317B953e427B3BD87C59eA003fcC229690639075789e9060640160006040518083038186803b158015620001ed57600080fd5b505af415801562000202573d6000803e3d6000fd5b5050600780546001810182556000918252600b027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160601b0319168155604080518381526020810190915290935091505080516200027291600184019160209091019062000458565b50805460ff60601b19166c01000000000000000000000000861515021781558351600282015560208401516003820155604084015160048083019190915560608501516005830155620002cc9060068301908590620004a8565b5060405163483abc4f60e11b8152600c600482015260016024820152604481018390527340a78989317B953e427B3BD87C59eA003fcC229690639075789e9060640160006040518083038186803b1580156200032757600080fd5b505af41580156200033c573d6000803e3d6000fd5b5050825486516020808901516040808b015160608c0151825160008152948501928390526001600160601b039096169750600196507fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab1095620003a7958e959094938d918d91620006eb565b60405180910390a3620003bd60018080620003cd565b5050505050505050505062000790565b806007846001600160601b031681548110620003ed57620003ed620006d5565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b82805482825590600052602060002090810192821562000496579160200282015b828111156200049657825182559160200191906001019062000479565b50620004a4929150620004d8565b5090565b82600481019282156200049657916020028201828111156200049657825182559160200191906001019062000479565b5b80821115620004a45760008155600101620004d9565b6001600160a01b03811681146200050557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b038111828210171562000543576200054362000508565b60405290565b805180151581146200055a57600080fd5b919050565b600082601f8301126200057157600080fd5b604051608081016001600160401b038111828210171562000596576200059662000508565b604052806080840185811115620005ac57600080fd5b845b81811015620005c8578051835260209283019201620005ae565b509195945050505050565b60008060008060008060008060006102008a8c031215620005f357600080fd5b89516200060081620004ef565b809950506020808b01516200061581620004ef565b60408c01519099506200062881620004ef565b60608c01519098506200063b81620004ef565b9650609f8b018c136200064d57600080fd5b620006576200051e565b8060c08d018e8111156200066a57600080fd5b60808e015b818110156200068857805184529284019284016200066f565b50819850620006978162000549565b975050505050620006ac8b60e08c016200055f565b9250620006be8b6101608c016200055f565b91506101e08a015190509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b60006101608083018b1515845260208b818601528a604086015289606086015288608086015260a085018860005b6004811015620007385781518352918301919083019060010162000719565b50505061012085018790526101408501929092528451908190526101808401918086019160005b818110156200077d578351855293820193928201926001016200075f565b50929d9c50505050505050505050505050565b615eb580620007a06000396000f3fe60806040526004361061034d5760003560e01c8063840bc19c116101bd578063c057eca7116100f8578063d8b03fd81161009b578063d8b03fd814610b5b578063e4c0aaf414610b70578063eaff425a14610b90578063f12ada8b14610ba5578063f6b4d82d14610bc5578063f7434ea914610c4e578063fbf405b014610c6e578063fc6f8f1614610c8e578063fe524c3914610cae57600080fd5b8063c057eca714610a41578063c13517e114610a57578063c258bb1914610a6a578063c356990214610a8a578063c71f425314610a9d578063cf0c38f814610abd578063d1c1df4814610add578063d2b8035a14610b3b57600080fd5b8063b1c9fe6e11610160578063b1c9fe6e14610919578063b2866af714610947578063b31b454014610967578063b39367ed1461097d578063b4a616081461099d578063b70c4e94146109b2578063b888adfa146109c7578063bfabfe8f146109dd57600080fd5b8063840bc19c146107f75780638a73a4dd146108125780638a9bb02a146108325780638bb04875146108645780638edf4741146108845780639280169a146108a4578063a4370ce4146108c4578063afe15cfb146108e457600080fd5b806335975f4a1161028d57806359ec827e1161023057806359ec827e1461070d5780636235593f1461072d57806367c51947146107425780636c1eb1b9146107625780636e5f35c214610777578063751accd0146107975780637717a6e8146107b7578063823cfd70146107d757600080fd5b806335975f4a146105e95780633a157860146106095780633cfd11841461061f57806343d4137f1461064c57806344c792e714610679578063543f8a3614610699578063564a565d146106c657806356acb050146106f757600080fd5b806319b81529116102f557806319b815291461048d5780631c3db16d146104bd5780631f5a0dd2146104fa57806327e6ec8a146105515780632922d6041461057e5780632d29a47b1461059e5780632ea7b4d0146105be57806334d5fb31146105d457600080fd5b8062f5822c146103525780630b274f2e146103745780630b7414bc146103895780630c340a24146103a95780630d1b9d1a146103e65780630d83b940146104345780630e083ec914610457578063115d53761461046d575b600080fd5b34801561035e57600080fd5b5061037261036d366004615371565b610cce565b005b34801561038057600080fd5b50610372610d23565b34801561039557600080fd5b506103726103a4366004615484565b6112ab565b3480156103b557600080fd5b506000546103c9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f257600080fd5b506104066104013660046154e5565b611481565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016103dd565b34801561044057600080fd5b50610449600181565b6040519081526020016103dd565b34801561046357600080fd5b50610449600e5481565b34801561047957600080fd5b506103726104883660046154e5565b6114ca565b34801561049957600080fd5b506104ad6104a83660046154e5565b611b24565b60405190151581526020016103dd565b3480156104c957600080fd5b506104dd6104d83660046154e5565b611c1b565b6040805193845291151560208401521515908201526060016103dd565b34801561050657600080fd5b5061051a6105153660046154e5565b611d30565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016103dd565b34801561055d57600080fd5b50610566600081565b6040516001600160601b0390911681526020016103dd565b34801561058a57600080fd5b506104496105993660046154fe565b611d87565b3480156105aa57600080fd5b506103726105b9366004615520565b611dbe565b3480156105ca57600080fd5b5061044961271081565b3480156105e057600080fd5b50610566600181565b3480156105f557600080fd5b506103726106043660046154e5565b612601565b34801561061557600080fd5b5061044960065481565b34801561062b57600080fd5b5061063f61063a36600461554c565b61273e565b6040516103dd919061558a565b34801561065857600080fd5b5061066c6106673660046154e5565b6127af565b6040516103dd91906155d3565b34801561068557600080fd5b506103726106943660046155e6565b61282b565b3480156106a557600080fd5b506106b96106b4366004615371565b6128eb565b6040516103dd919061561d565b3480156106d257600080fd5b506106e66106e13660046154e5565b612987565b6040516103dd959493929190615694565b34801561070357600080fd5b50610449600f5481565b34801561071957600080fd5b506104496107283660046154e5565b6129e3565b34801561073957600080fd5b50610449600081565b34801561074e57600080fd5b5061037261075d3660046156d3565b612b36565b34801561076e57600080fd5b50610449600a81565b34801561078357600080fd5b506103726107923660046156d3565b612bd7565b3480156107a357600080fd5b506103726107b236600461576c565b612ddd565b3480156107c357600080fd5b506103726107d23660046156d3565b612eaf565b3480156107e357600080fd5b506103726107f23660046154e5565b612efd565b34801561080357600080fd5b506104496001600160ff1b0381565b34801561081e57600080fd5b5061037261082d366004615831565b612f2c565b34801561083e57600080fd5b5061085261084d3660046154fe565b6132c4565b6040516103dd969594939291906158d4565b34801561087057600080fd5b5061037261087f3660046154e5565b6133a4565b34801561089057600080fd5b5061044961089f3660046154e5565b6134e5565b3480156108b057600080fd5b506103726108bf3660046156d3565b613506565b3480156108d057600080fd5b506103726108df3660046156d3565b6135a1565b3480156108f057600080fd5b506109046108ff3660046154e5565b613649565b604080519283526020830191909152016103dd565b34801561092557600080fd5b5060025461093a90600160a01b900460ff1681565b6040516103dd9190615949565b34801561095357600080fd5b506103726109623660046154e5565b6136f6565b34801561097357600080fd5b5061044960045481565b34801561098957600080fd5b50610372610998366004615963565b613725565b3480156109a957600080fd5b50610449600481565b3480156109be57600080fd5b506104ad6137d4565b3480156109d357600080fd5b5061044960055481565b3480156109e957600080fd5b50610a266109f83660046154fe565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b604080519384526020840192909252908201526060016103dd565b348015610a4d57600080fd5b5061044960035481565b610449610a65366004615997565b613816565b348015610a7657600080fd5b50610372610a85366004615371565b613b92565b610372610a983660046159dd565b613bde565b348015610aa957600080fd5b50610449610ab83660046154e5565b61425c565b348015610ac957600080fd5b506002546103c9906001600160a01b031681565b348015610ae957600080fd5b50610904610af8366004615a16565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b4757600080fd5b50610372610b563660046154fe565b6142c4565b348015610b6757600080fd5b5061066c6145c5565b348015610b7c57600080fd5b50610372610b8b366004615371565b61461d565b348015610b9c57600080fd5b50610449600381565b348015610bb157600080fd5b50610372610bc0366004615a42565b614669565b348015610bd157600080fd5b50610c1c610be03660046154e5565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016103dd565b348015610c5a57600080fd5b50610449610c69366004615a60565b6148c2565b348015610c7a57600080fd5b506001546103c9906001600160a01b031681565b348015610c9a57600080fd5b50610449610ca93660046154e5565b614916565b348015610cba57600080fd5b506104ad610cc93660046156d3565b614945565b6000546001600160a01b03163314610d015760405162461bcd60e51b8152600401610cf890615a94565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610d4357610d4361566a565b1415610e0557600354600554610d599042615ad1565b1015610da35760405162461bcd60e51b8152602060048201526019602482015278135a5b94dd185ada5b99d51a5b59481b9bdd081c185cdcd959603a1b6044820152606401610cf8565b600954610de95760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610cf8565b6002805460ff60a01b1916600160a01b17905543600655611260565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190615ae8565b600954909150600090610e8d90600190615b05565b90505b6000811261125057600060098281548110610ead57610ead615b44565b906000526020600020015490506000600860098481548110610ed157610ed1615b44565b906000526020600020015481548110610eec57610eec615b44565b60009182526020909120600260049092020101546001600160a01b03169050838015610f865750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4c57600080fd5b505afa158015610f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f849190615ae8565b155b1561107057806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc657600080fd5b505af1158015610fda573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104f9190615ae8565b61106b5760405162461bcd60e51b8152600401610cf890615b5a565b61123d565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e19190615ae8565b6110fd5760405162461bcd60e51b8152600401610cf890615b5a565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561113657600080fd5b505afa15801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190615b91565b61123d5760006008838154811061118757611187615b44565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b199092169190911790556009546111c390600190615b05565b83121561121557600980546111da90600190615ad1565b815481106111ea576111ea615b44565b90600052602060002001546009848154811061120857611208615b44565b6000918252602090912001555b600980548061122657611226615baa565b600190038181906000526020600020016000905590555b50508061124990615bc0565b9050610e90565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b93916112a191600160a01b90910460ff1690615949565b60405180910390a1565b6000546001600160a01b031633146112d55760405162461bcd60e51b8152600401610cf890615a94565b60006007846001600160601b0316815481106112f3576112f3615b44565b90600052602060002090600b0201905060005b835181101561147a5782156113a057600084828151811061132957611329615b44565b602002602001015111801561135a5750600854845185908390811061135057611350615b44565b6020026020010151105b6113765760405162461bcd60e51b8152600401610cf890615bde565b61139b8585838151811061138c5761138c615b44565b6020026020010151600161498d565b611468565b6001600160601b03851660011480156113f65750600060088583815181106113ca576113ca615b44565b6020026020010151815481106113e2576113e2615b44565b906000526020600020906004020160000154145b156114435760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610cf8565b6114688585838151811061145957611459615b44565b6020026020010151600061498d565b8061147281615c06565b915050611306565b5050505050565b6008818154811061149157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106114df576114df615b44565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061151257611512615b44565b6000918252602082206003850154600b90920201925061153490600190615ad1565b9050600083600301828154811061154d5761154d615b44565b6000918252602082206007909102019150600185015460ff1660048111156115775761157761566a565b14156116aa5760008211806115c957506001840154600684019060ff1660048111156115a5576115a561566a565b600481106115b5576115b5615b44565b015460028501546115c69042615ad1565b10155b6116155760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610cf8565b60038101546006820154146116645760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610cf8565b8254600160601b900460ff1661167b57600261167e565b60015b60018086018054909160ff19909116908360048111156116a0576116a061566a565b0217905550611ad6565b60018085015460ff1660048111156116c4576116c461566a565b1415611810576001840154600684019060ff1660048111156116e8576116e861566a565b600481106116f8576116f8615b44565b015460028501546117099042615ad1565b1015806117b25750600881600001548154811061172857611728615b44565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b29190615ae8565b6117f95760405162461bcd60e51b815260206004820152601860248201527710dbdb5b5a5d081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460029260ff1990911690836116a0565b6002600185015460ff16600481111561182b5761182b61566a565b14156119b3576001840154600684019060ff16600481111561184f5761184f61566a565b6004811061185f5761185f615b44565b015460028501546118709042615ad1565b1015806119195750600881600001548154811061188f5761188f615b44565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156118e157600080fd5b505afa1580156118f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119199190615ae8565b61195e5760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610cf8565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611ad6565b6003600185015460ff1660048111156119ce576119ce61566a565b1415611a73576001840154600684019060ff1660048111156119f2576119f261566a565b60048110611a0257611a02615b44565b01546002850154611a139042615ad1565b1015611a5c5760405162461bcd60e51b8152602060048201526018602482015277105c1c19585b081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460049260ff1990911690836116a0565b6004600185015460ff166004811115611a8e57611a8e61566a565b1415611ad65760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d19481c195c9a5bd9081a5cc8199a5b985b604a1b6044820152606401610cf8565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611b159160ff1690615c21565b60405180910390a25050505050565b600080600a8381548110611b3a57611b3a615b44565b6000918252602082206003600490920201908101805491935090611b6090600190615ad1565b81548110611b7057611b70615b44565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ba357611ba3615b44565b90600052602060002090600b02019050806005015482600301541015611bce57506000949350505050565b80546007805490916001600160601b0316908110611bee57611bee615b44565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600080600a8581548110611c3457611c34615b44565b6000918252602082206003600490920201908101805491935090611c5a90600190615ad1565b81548110611c6a57611c6a615b44565b9060005260206000209060070201905060006008826000015481548110611c9357611c93615b44565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018990526001600160a01b031691508190631c3db16d9060240160606040518083038186803b158015611ce857600080fd5b505afa158015611cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d209190615c2f565b9199909850909650945050505050565b60078181548110611d4057600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611daa57611daa615b44565b906000526020600020015490505b92915050565b6000600a8481548110611dd357611dd3615b44565b600091825260209091206004918202019150600182015460ff166004811115611dfe57611dfe61566a565b14611e1b5760405162461bcd60e51b8152600401610cf890615c67565b6000816003018481548110611e3257611e32615b44565b9060005260206000209060070201905060006008826000015481548110611e5b57611e5b615b44565b60009182526020822060049182020160020154908401546001600160a01b039091169250611e8a908690615c92565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b158015611ee357600080fd5b505afa158015611ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1b9190615b91565b905060008082611f365783861115611f31578395505b611f56565b611f41846002615caa565b861115611f5657611f53846002615caa565b95505b60048801545b868110156125db578481101561235057604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b158015611fba57600080fd5b505afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190615b91565b91506127108211156120045761271091505b60006127106120138482615ad1565b8b600101546120229190615caa565b61202c9190615cdf565b90506120388188615c92565b965089600601828154811061204f5761204f615b44565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b0316855260020190925290822080549196508392909161209c908490615ad1565b90915550508a546007805483926001600160601b03169081106120c1576120c1615b44565b90600052602060002090600b0201600201546120dd9190615c92565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612171576001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915281205461214f908390615ad1565b8c5490915061216a9086906001600160601b03168385614a15565b50506121c2565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152902054156121c2578a546121c09085906001600160601b0316600084614a15565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b15801561221057600080fd5b505afa158015612224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122489190615ae8565b6122a1576000612257856128eb565b905060005b815181101561229e5761228b8683838151811061227b5761227b615b44565b6020026020010151600080614a15565b508061229681615c06565b91505061225c565b50505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196122d684615cf3565b60408051918252600060208301520160405180910390a36122f8600187615ad1565b82141561234a578461234a576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461234893506001600160a01b0316915089905061502f565b505b506125c9565b6001600160a01b038816634fe264fb8e8e61236b8986615d10565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156123af57600080fd5b505afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190615b91565b91506127108211156123f95761271091505b600689016124078683615d10565b8154811061241757612417615b44565b60009182526020909120015460018a01546001600160a01b03909116935061271090612444908490615caa565b61244e9190615cdf565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526002019091528120805490919061248e908490615ad1565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b031684526001019091529020546124f6576000612710838b600101546124dd9190615caa565b6124e79190615cdf565b90506124f3848261502f565b50505b600061271083612506878a615cdf565b6125109190615caa565b61251a9190615cdf565b9050600061271084878d600201546125329190615cdf565b61253c9190615caa565b6125469190615cdf565b9050612552858361502f565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e1984846040516125be929190918252602082015260400190565b60405180910390a350505b806125d381615c06565b915050611f5c565b50848860050154146125ef57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff1660018111156126215761262161566a565b146126605760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610cf8565b6000600e54600183600f546126759190615c92565b61267f9190615ad1565b1161268a57816126a5565b600f54600e5461269a9190615ad1565b6126a5906001615c92565b9050600081600f546126b79190615c92565b600f549091505b81811015612736576000818152600d60205260409020805460018201546002830154612706926001600160a01b03811692600160a01b9091046001600160601b031691614a15565b50506000818152600d6020526040812081815560018101829055600201558061272e81615c06565b9150506126be565b50600f555050565b6127466152ae565b60006007836001600160601b03168154811061276457612764615b44565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b81548152602001906001019080831161278f575050505050915050919050565b6060600882815481106127c4576127c4615b44565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561281f57602002820191906000526020600020905b81548152602001906001019080831161280b575b50505050509050919050565b6000546001600160a01b031633146128555760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061287257612872615b44565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b60405180910390a25050565b6001600160a01b0381166000908152600b602090815260409182902080548351818402810184019094528084526060939283018282801561281f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b0104928301926001038202915080841161293a575094979650505050505050565b600a818154811061299757600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600a83815481106129f9576129f9615b44565b6000918252602082206003600490920201908101805491935090612a1f90600190615ad1565b81548110612a2f57612a2f615b44565b600091825260208220845460078054938102909201945090916001600160601b03909116908110612a6257612a62615b44565b90600052602060002090600b020190508060050154826003015410612b015782546001600160601b031660011415612aa3576001600160ff1b039350612b2e565b6003820154612ab3906002615caa565b612abe906001615c92565b81546007805490916001600160601b0316908110612ade57612ade615b44565b90600052602060002090600b020160040154612afa9190615caa565b9350612b2e565b6003820154612b11906002615caa565b612b1c906001615c92565b8160040154612b2b9190615caa565b93505b505050919050565b6000546001600160a01b03163314612b605760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b031681548110612b7d57612b7d615b44565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b6000546001600160a01b03163314612c015760405162461bcd60e51b8152600401610cf890615a94565b6001600160601b03821660011480612c74575080600780846001600160601b031681548110612c3257612c32615b44565b60009182526020909120600b909102015481546001600160601b03909116908110612c5f57612c5f615b44565b90600052602060002090600b02016002015411155b612c905760405162461bcd60e51b8152600401610cf890615d24565b60005b6007836001600160601b031681548110612caf57612caf615b44565b90600052602060002090600b020160010180549050811015612d685781600780856001600160601b031681548110612ce957612ce9615b44565b90600052602060002090600b02016001018381548110612d0b57612d0b615b44565b906000526020600020015481548110612d2657612d26615b44565b90600052602060002090600b0201600201541015612d565760405162461bcd60e51b8152600401610cf890615d24565b80612d6081615c06565b915050612c93565b50806007836001600160601b031681548110612d8657612d86615b44565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600890820152676d696e5374616b6560c01b604082015260600190565b6000546001600160a01b03163314612e075760405162461bcd60e51b8152600401610cf890615a94565b6000836001600160a01b03168383604051612e229190615d85565b60006040518083038185875af1925050503d8060008114612e5f576040519150601f19603f3d011682016040523d82523d6000602084013e612e64565b606091505b5050905080612ea95760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cf8565b50505050565b612ebc3383836000614a15565b612ef95760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610cf8565b5050565b6000546001600160a01b03163314612f275760405162461bcd60e51b8152600401610cf890615a94565b600355565b6000546001600160a01b03163314612f565760405162461bcd60e51b8152600401610cf890615a94565b8660078a6001600160601b031681548110612f7357612f73615b44565b90600052602060002090600b0201600201541115612fa35760405162461bcd60e51b8152600401610cf890615d24565b6000815111612fe45760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610cf8565b6001600160601b03891661303a5760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610cf8565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561313657600084828151811061308f5761308f615b44565b60200260200101511180156130c0575060085484518590839081106130b6576130b6615b44565b6020026020010151105b6130dc5760405162461bcd60e51b8152600401610cf890615bde565b600182600a0160008684815181106130f6576130f6615b44565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550808061312e90615c06565b915050613072565b5080546001600160601b0319166001600160601b038c16178155604080516000815260208101918290525161316f9160018401916152cc565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556131b29060068301908790615317565b5060405163483abc4f60e11b8152600c600482015260248101839052604481018590527340a78989317B953e427B3BD87C59eA003fcC229690639075789e9060640160006040518083038186803b15801561320c57600080fd5b505af4158015613220573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061324057613240615b44565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab10906132af908e908e908e908e908e908e908e908e90615da1565b60405180910390a35050505050505050505050565b6000806000806060600080600a89815481106132e2576132e2615b44565b9060005260206000209060040201600301888154811061330457613304615b44565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561338657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613368575b50505050509150965096509650965096509650509295509295509295565b6000600a82815481106133b9576133b9615b44565b600091825260209091206004918202019150600182015460ff1660048111156133e4576133e461566a565b146134015760405162461bcd60e51b8152600401610cf890615c67565b6001810154610100900460ff16156134555760405162461bcd60e51b8152602060048201526017602482015276149d5b1a5b99c8185b1c9958591e48195e1958dd5d1959604a1b6044820152606401610cf8565b600061346083611c1b565b505060018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b1580156134c857600080fd5b505af11580156134dc573d6000803e3d6000fd5b50505050505050565b600981815481106134f557600080fd5b600091825260209091200154905081565b6000546001600160a01b031633146135305760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061354d5761354d615b44565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615e608339815191526040516128df90602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146135cb5760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b0316815481106135e8576135e8615b44565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615e608339815191526040516128df9060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061366157613661615b44565b6000918252602090912060049091020190506003600182015460ff16600481111561368e5761368e61566a565b14156136e7576002810154815460078054929550916001600160601b039091169081106136bd576136bd615b44565b600091825260209091206009600b90920201015460028201546136e09190615c92565b91506136f0565b60009250600091505b50915091565b6000546001600160a01b031633146137205760405162461bcd60e51b8152600401610cf890615a94565b600455565b6000546001600160a01b0316331461374f5760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061376c5761376c615b44565b90600052602060002090600b020160060190600461378b929190615317565b50816001600160601b0316600080516020615e608339815191526040516128df906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b60006001600254600160a01b900460ff1660018111156137f6576137f661566a565b148015613811575060045460055461380e9042615ad1565b10155b905090565b6000613821826148c2565b3410156138705760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610cf8565b60008061387c84615104565b92505091506007826001600160601b03168154811061389d5761389d615b44565b60009182526020808320848452600a600b90930201919091019052604090205460ff166139065760405162461bcd60e51b81526020600482015260176024820152761112c81d5b9cdd5c1c1bdc9d195908189e4818dbdd5c9d604a1b6044820152606401610cf8565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa90910155600880549296509092918490811061399157613991615b44565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b039091169081106139d2576139d2615b44565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613a119034615cdf565b600380830191909155858255820154600283015461271091613a3291615caa565b613a3c9190615cdf565b60018201553460028201556008805486908110613a5b57613a5b615b44565b906000526020600020906004020160020160149054906101000a900460ff16613af257600160088681548110613a9357613a93615b44565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613b27918b918e918e91600401615df9565b600060405180830381600087803b158015613b4157600080fd5b505af1158015613b55573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613bbc5760405162461bcd60e51b8152600401610cf890615a94565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613be7836129e3565b341015613c365760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610cf8565b6000600a8481548110613c4b57613c4b615b44565b6000918252602090912060049091020190506003600182015460ff166004811115613c7857613c7861566a565b14613cbe5760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610cf8565b60038101805460009190613cd490600190615ad1565b81548110613ce457613ce4615b44565b906000526020600020906007020190506008816000015481548110613d0b57613d0b615b44565b60009182526020909120600490910201600201546001600160a01b03163314613d695760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610cf8565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019184908110613daa57613daa615b44565b90600052602060002090600b020160050154846003015410613fae576007836001600160601b031681548110613de257613de2615b44565b600091825260208220600b90910201546001600160601b031693505b600a811015613ef3576007846001600160601b031681548110613e2357613e23615b44565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613e5057613ef3565b600060088481548110613e6557613e65615b44565b90600052602060002090600402016000015414613ea85760088381548110613e8f57613e8f615b44565b9060005260206000209060040201600001549250613ee1565b6007846001600160601b031681548110613ec457613ec4615b44565b60009182526020909120600b90910201546001600160601b031693505b80613eeb81615c06565b915050613dfe565b506007836001600160601b031681548110613f1057613f10615b44565b60009182526020808320858452600a600b90930201919091019052604090205460ff16613f3c57600192505b84546001600160601b03848116911614613fae57845460038601546001600160601b0390911690613f6f90600190615ad1565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff1916905542600287015560078054600092908110613ff157613ff1615b44565b90600052602060002090600b020190508060040154346140119190615cdf565b8260030181905550612710816003015482600201546140309190615caa565b61403a9190615cdf565b6001830155346002830155828255600880548490811061405c5761405c615b44565b906000526020600020906004020160020160149054906101000a900460ff166140f35760016008848154811061409457614094615b44565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b84548254146141d9578454600387015461410f90600190615ad1565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a4600882600001548154811061415d5761415d615b44565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede540926141a6928e928e928e929101615df9565b600060405180830381600087803b1580156141c057600080fd5b505af11580156141d4573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516142499190615c21565b60405180910390a2505050505050505050565b600080600a838154811061427257614272615b44565b90600052602060002090600402019050806003016001826003018054905061429a9190615ad1565b815481106142aa576142aa615b44565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff1660018111156142e4576142e461566a565b1461431f5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610cf8565b6000600a838154811061433457614334615b44565b9060005260206000209060040201905060006001826003018054905061435a9190615ad1565b9050600082600301828154811061437357614373615b44565b6000918252602082206007909102019150600184015460ff16600481111561439d5761439d61566a565b146143dd5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610cf8565b600060088260000154815481106143f6576143f6615b44565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061442c8884615c92565b111561443c578360030154614446565b6144468783615c92565b9050815b818110156145ba57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561449757600080fd5b505af11580156144ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144cf9190615e42565b90506001600160a01b038116156145a75760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614525908490615c92565b909155505060068601546040805189815260208101929092528b916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a3600686018054600181018255600091825260209091200180546001600160a01b0319166001600160a01b0383161790555b50806145b281615c06565b91505061444a565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561461357602002820191906000526020600020905b8154815260200190600101908083116145ff575b5050505050905090565b6000546001600160a01b031633146146475760405162461bcd60e51b8152600401610cf890615a94565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146146935760405162461bcd60e51b8152600401610cf890615a94565b6008548082106146cf5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610cf8565b6000821561474c57600883815481106146ea576146ea615b44565b90600052602060002090600402016003015460016147089190615c92565b9050600a811061474c5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610cf8565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3810191825591518051939491936147fe937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906152cc565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b0390931692909217919091179055608090910151600390910155600880548490811061485857614858615b44565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482612ea957612ea9600183600161498d565b60008060006148d084615104565b5091509150806007836001600160601b0316815481106148f2576148f2615b44565b90600052602060002090600b02016004015461490e9190615caa565b949350505050565b6000600a828154811061492b5761492b615b44565b600091825260209091206003600490920201015492915050565b60006007836001600160601b03168154811061496357614963615b44565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b0316815481106149aa576149aa615b44565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614a3757506007546001600160601b038516115b15614a445750600061490e565b6001600160a01b0385166000908152600b6020526040812090614a678787615188565b604051637521ccb160e01b8152600c60048201526001600160601b0388166024820152604481018290529091506000907340a78989317B953e427B3BD87C59eA003fcC229690637521ccb19060640160206040518083038186803b158015614ace57600080fd5b505af4158015614ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b069190615b91565b90508515614b94576007876001600160601b031681548110614b2a57614b2a615b44565b90600052602060002090600b020160020154861080614b6257506001600160601b038716600090815260028401602052604090205486105b15614b73576000935050505061490e565b80158015614b8357508254600411155b15614b94576000935050505061490e565b6000600254600160a01b900460ff166001811115614bb457614bb461566a565b14614c60576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614bff90615c06565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061490e92505050565b6000818710614cdd57614c738288615ad1565b90508015614ccb57614c868930836151d0565b15614cd05781614ccb578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b614eb2565b600094505050505061490e565b86614e7a576001600160601b03881660009081526002850160205260409020548690614d099084615ad1565b614d139190615ad1565b90508015614ccb57614d25898261502f565b15614cd05760005b8454811015614e7457886001600160601b0316856000018281548110614d5557614d55615b44565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415614e625784548590614d9290600190615ad1565b81548110614da257614da2615b44565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614de057614de0615b44565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480614e2c57614e2c615baa565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055614e74565b80614e6c81615c06565b915050614d2d565b50614eb2565b85614e858884615ad1565b614e8f9190615ad1565b90508015614eb257614ea1898261502f565b614eb257600094505050505061490e565b6001600160601b03881660009081526001850160205260408120548890614eda908590615ad1565b614ee49190615c92565b6001600160601b038a16600081815260018801602052604081208390559192505b81614fc857604051631712e1c560e11b8152600c600482015260248101829052604481018b9052606481018790527340a78989317B953e427B3BD87C59eA003fcC229690632e25c38a9060840160006040518083038186803b158015614f6a57600080fd5b505af4158015614f7e573d6000803e3d6000fd5b505050506001811415614f945760019150614f05565b60078181548110614fa757614fa7615b44565b60009182526020909120600b90910201546001600160601b03169050614f05565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000938493849391169161508f9190615d85565b6000604051808303816000865af19150503d80600081146150cc576040519150601f19603f3d011682016040523d82523d6000602084013e6150d1565b606091505b50915091508180156150fb5750805115806150fb5750808060200190518101906150fb9190615ae8565b95945050505050565b60008060006040845110615176575050506020810151604082015160608301516001600160601b038316158061514557506007546001600160601b03841610155b1561514f57600192505b8161515957600391505b80158061516857506008548110155b15615171575060015b615181565b506001915060039050815b9193909250565b600060405160005b60148110156151ab578481600c011a81830153600101615190565b5060145b60208110156151c75783811a818301536001016151af565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916152389190615d85565b6000604051808303816000865af19150503d8060008114615275576040519150601f19603f3d011682016040523d82523d6000602084013e61527a565b606091505b50915091508180156152a45750805115806152a45750808060200190518101906152a49190615ae8565b9695505050505050565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215615307579160200282015b828111156153075782518255916020019190600101906152ec565b50615313929150615344565b5090565b826004810192821561530757916020028201828111156153075782518255916020019190600101906152ec565b5b808211156153135760008155600101615345565b6001600160a01b038116811461536e57600080fd5b50565b60006020828403121561538357600080fd5b813561538e81615359565b9392505050565b80356001600160601b03811681146153ac57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156153ef576153ef6153b1565b604052919050565b600082601f83011261540857600080fd5b813560206001600160401b03821115615423576154236153b1565b8160051b6154328282016153c7565b928352848101820192828101908785111561544c57600080fd5b83870192505b8483101561546b57823582529183019190830190615452565b979650505050505050565b801515811461536e57600080fd5b60008060006060848603121561549957600080fd5b6154a284615395565b925060208401356001600160401b038111156154bd57600080fd5b6154c9868287016153f7565b92505060408401356154da81615476565b809150509250925092565b6000602082840312156154f757600080fd5b5035919050565b6000806040838503121561551157600080fd5b50508035926020909101359150565b60008060006060848603121561553557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561555e57600080fd5b61538e82615395565b8060005b6004811015612ea957815184526020938401939091019060010161556b565b60808101611db88284615567565b600081518084526020808501945080840160005b838110156155c8578151875295820195908201906001016155ac565b509495945050505050565b60208152600061538e6020830184615598565b600080604083850312156155f957600080fd5b61560283615395565b9150602083013561561281615476565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561565e5783516001600160601b031683529284019291840191600101615639565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106156905761569061566a565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016156c06040830186615680565b9215156060820152608001529392505050565b600080604083850312156156e657600080fd5b6156ef83615395565b946020939093013593505050565b600082601f83011261570e57600080fd5b81356001600160401b03811115615727576157276153b1565b61573a601f8201601f19166020016153c7565b81815284602083860101111561574f57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561578157600080fd5b833561578c81615359565b92506020840135915060408401356001600160401b038111156157ae57600080fd5b6157ba868287016156fd565b9150509250925092565b600082601f8301126157d557600080fd5b604051608081018181106001600160401b03821117156157f7576157f76153b1565b60405280608084018581111561580c57600080fd5b845b8181101561582657803583526020928301920161580e565b509195945050505050565b60008060008060008060008060006101808a8c03121561585057600080fd5b6158598a615395565b985060208a013561586981615476565b975060408a0135965060608a0135955060808a0135945060a08a013593506158948b60c08c016157c4565b92506101408a013591506101608a01356001600160401b038111156158b857600080fd5b6158c48c828d016153f7565b9150509295985092959850929598565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b818110156159305784516001600160a01b03168352938301939183019160010161590b565b50508093505050508260a0830152979650505050505050565b602081016002831061595d5761595d61566a565b91905290565b60008060a0838503121561597657600080fd5b61597f83615395565b915061598e84602085016157c4565b90509250929050565b600080604083850312156159aa57600080fd5b8235915060208301356001600160401b038111156159c757600080fd5b6159d3858286016156fd565b9150509250929050565b6000806000606084860312156159f257600080fd5b833592506020840135915060408401356001600160401b038111156157ae57600080fd5b60008060408385031215615a2957600080fd5b8235615a3481615359565b915061598e60208401615395565b60008060408385031215615a5557600080fd5b82356156ef81615359565b600060208284031215615a7257600080fd5b81356001600160401b03811115615a8857600080fd5b61490e848285016156fd565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615ae357615ae3615abb565b500390565b600060208284031215615afa57600080fd5b815161538e81615476565b60008083128015600160ff1b850184121615615b2357615b23615abb565b6001600160ff1b0384018313811615615b3e57615b3e615abb565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f536f6d6520444b206e6f7420696e205265736f6c76696e672070686173650000604082015260600190565b600060208284031215615ba357600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615bd657615bd6615abb565b506000190190565b6020808252600e908201526d0aee4dedcce40889640d2dcc8caf60931b604082015260600190565b6000600019821415615c1a57615c1a615abb565b5060010190565b60208101611db88284615680565b600080600060608486031215615c4457600080fd5b835192506020840151615c5681615476565b60408501519092506154da81615476565b60208082526011908201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b604082015260600190565b60008219821115615ca557615ca5615abb565b500190565b6000816000190483118215151615615cc457615cc4615abb565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615cee57615cee615cc9565b500490565b6000600160ff1b821415615d0957615d09615abb565b5060000390565b600082615d1f57615d1f615cc9565b500690565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60005b83811015615d74578181015183820152602001615d5c565b83811115612ea95750506000910152565b60008251615d97818460208701615d59565b9190910192915050565b60006101608a15158352896020840152886040840152876060840152866080840152615dd060a0840187615567565b8461012084015280610140840152615dea81840185615598565b9b9a5050505050505050505050565b8481528360208201526080604082015260008351806080840152615e248160a0850160208801615d59565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615e5457600080fd5b815161538e8161535956fee83e0a05baa75e68db64db7387055029be50c8d8de00a3e3e56978509b9bc2dea264697066735822122002e319f86cb632099714813977d3a5996c5b7c4f0f7cc908f3c7e3771996e90364736f6c63430008090033", - "deployedBytecode": "0x60806040526004361061034d5760003560e01c8063840bc19c116101bd578063c057eca7116100f8578063d8b03fd81161009b578063d8b03fd814610b5b578063e4c0aaf414610b70578063eaff425a14610b90578063f12ada8b14610ba5578063f6b4d82d14610bc5578063f7434ea914610c4e578063fbf405b014610c6e578063fc6f8f1614610c8e578063fe524c3914610cae57600080fd5b8063c057eca714610a41578063c13517e114610a57578063c258bb1914610a6a578063c356990214610a8a578063c71f425314610a9d578063cf0c38f814610abd578063d1c1df4814610add578063d2b8035a14610b3b57600080fd5b8063b1c9fe6e11610160578063b1c9fe6e14610919578063b2866af714610947578063b31b454014610967578063b39367ed1461097d578063b4a616081461099d578063b70c4e94146109b2578063b888adfa146109c7578063bfabfe8f146109dd57600080fd5b8063840bc19c146107f75780638a73a4dd146108125780638a9bb02a146108325780638bb04875146108645780638edf4741146108845780639280169a146108a4578063a4370ce4146108c4578063afe15cfb146108e457600080fd5b806335975f4a1161028d57806359ec827e1161023057806359ec827e1461070d5780636235593f1461072d57806367c51947146107425780636c1eb1b9146107625780636e5f35c214610777578063751accd0146107975780637717a6e8146107b7578063823cfd70146107d757600080fd5b806335975f4a146105e95780633a157860146106095780633cfd11841461061f57806343d4137f1461064c57806344c792e714610679578063543f8a3614610699578063564a565d146106c657806356acb050146106f757600080fd5b806319b81529116102f557806319b815291461048d5780631c3db16d146104bd5780631f5a0dd2146104fa57806327e6ec8a146105515780632922d6041461057e5780632d29a47b1461059e5780632ea7b4d0146105be57806334d5fb31146105d457600080fd5b8062f5822c146103525780630b274f2e146103745780630b7414bc146103895780630c340a24146103a95780630d1b9d1a146103e65780630d83b940146104345780630e083ec914610457578063115d53761461046d575b600080fd5b34801561035e57600080fd5b5061037261036d366004615371565b610cce565b005b34801561038057600080fd5b50610372610d23565b34801561039557600080fd5b506103726103a4366004615484565b6112ab565b3480156103b557600080fd5b506000546103c9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f257600080fd5b506104066104013660046154e5565b611481565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016103dd565b34801561044057600080fd5b50610449600181565b6040519081526020016103dd565b34801561046357600080fd5b50610449600e5481565b34801561047957600080fd5b506103726104883660046154e5565b6114ca565b34801561049957600080fd5b506104ad6104a83660046154e5565b611b24565b60405190151581526020016103dd565b3480156104c957600080fd5b506104dd6104d83660046154e5565b611c1b565b6040805193845291151560208401521515908201526060016103dd565b34801561050657600080fd5b5061051a6105153660046154e5565b611d30565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016103dd565b34801561055d57600080fd5b50610566600081565b6040516001600160601b0390911681526020016103dd565b34801561058a57600080fd5b506104496105993660046154fe565b611d87565b3480156105aa57600080fd5b506103726105b9366004615520565b611dbe565b3480156105ca57600080fd5b5061044961271081565b3480156105e057600080fd5b50610566600181565b3480156105f557600080fd5b506103726106043660046154e5565b612601565b34801561061557600080fd5b5061044960065481565b34801561062b57600080fd5b5061063f61063a36600461554c565b61273e565b6040516103dd919061558a565b34801561065857600080fd5b5061066c6106673660046154e5565b6127af565b6040516103dd91906155d3565b34801561068557600080fd5b506103726106943660046155e6565b61282b565b3480156106a557600080fd5b506106b96106b4366004615371565b6128eb565b6040516103dd919061561d565b3480156106d257600080fd5b506106e66106e13660046154e5565b612987565b6040516103dd959493929190615694565b34801561070357600080fd5b50610449600f5481565b34801561071957600080fd5b506104496107283660046154e5565b6129e3565b34801561073957600080fd5b50610449600081565b34801561074e57600080fd5b5061037261075d3660046156d3565b612b36565b34801561076e57600080fd5b50610449600a81565b34801561078357600080fd5b506103726107923660046156d3565b612bd7565b3480156107a357600080fd5b506103726107b236600461576c565b612ddd565b3480156107c357600080fd5b506103726107d23660046156d3565b612eaf565b3480156107e357600080fd5b506103726107f23660046154e5565b612efd565b34801561080357600080fd5b506104496001600160ff1b0381565b34801561081e57600080fd5b5061037261082d366004615831565b612f2c565b34801561083e57600080fd5b5061085261084d3660046154fe565b6132c4565b6040516103dd969594939291906158d4565b34801561087057600080fd5b5061037261087f3660046154e5565b6133a4565b34801561089057600080fd5b5061044961089f3660046154e5565b6134e5565b3480156108b057600080fd5b506103726108bf3660046156d3565b613506565b3480156108d057600080fd5b506103726108df3660046156d3565b6135a1565b3480156108f057600080fd5b506109046108ff3660046154e5565b613649565b604080519283526020830191909152016103dd565b34801561092557600080fd5b5060025461093a90600160a01b900460ff1681565b6040516103dd9190615949565b34801561095357600080fd5b506103726109623660046154e5565b6136f6565b34801561097357600080fd5b5061044960045481565b34801561098957600080fd5b50610372610998366004615963565b613725565b3480156109a957600080fd5b50610449600481565b3480156109be57600080fd5b506104ad6137d4565b3480156109d357600080fd5b5061044960055481565b3480156109e957600080fd5b50610a266109f83660046154fe565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b604080519384526020840192909252908201526060016103dd565b348015610a4d57600080fd5b5061044960035481565b610449610a65366004615997565b613816565b348015610a7657600080fd5b50610372610a85366004615371565b613b92565b610372610a983660046159dd565b613bde565b348015610aa957600080fd5b50610449610ab83660046154e5565b61425c565b348015610ac957600080fd5b506002546103c9906001600160a01b031681565b348015610ae957600080fd5b50610904610af8366004615a16565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b4757600080fd5b50610372610b563660046154fe565b6142c4565b348015610b6757600080fd5b5061066c6145c5565b348015610b7c57600080fd5b50610372610b8b366004615371565b61461d565b348015610b9c57600080fd5b50610449600381565b348015610bb157600080fd5b50610372610bc0366004615a42565b614669565b348015610bd157600080fd5b50610c1c610be03660046154e5565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016103dd565b348015610c5a57600080fd5b50610449610c69366004615a60565b6148c2565b348015610c7a57600080fd5b506001546103c9906001600160a01b031681565b348015610c9a57600080fd5b50610449610ca93660046154e5565b614916565b348015610cba57600080fd5b506104ad610cc93660046156d3565b614945565b6000546001600160a01b03163314610d015760405162461bcd60e51b8152600401610cf890615a94565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610d4357610d4361566a565b1415610e0557600354600554610d599042615ad1565b1015610da35760405162461bcd60e51b8152602060048201526019602482015278135a5b94dd185ada5b99d51a5b59481b9bdd081c185cdcd959603a1b6044820152606401610cf8565b600954610de95760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610cf8565b6002805460ff60a01b1916600160a01b17905543600655611260565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190615ae8565b600954909150600090610e8d90600190615b05565b90505b6000811261125057600060098281548110610ead57610ead615b44565b906000526020600020015490506000600860098481548110610ed157610ed1615b44565b906000526020600020015481548110610eec57610eec615b44565b60009182526020909120600260049092020101546001600160a01b03169050838015610f865750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4c57600080fd5b505afa158015610f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f849190615ae8565b155b1561107057806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc657600080fd5b505af1158015610fda573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104f9190615ae8565b61106b5760405162461bcd60e51b8152600401610cf890615b5a565b61123d565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e19190615ae8565b6110fd5760405162461bcd60e51b8152600401610cf890615b5a565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561113657600080fd5b505afa15801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190615b91565b61123d5760006008838154811061118757611187615b44565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b199092169190911790556009546111c390600190615b05565b83121561121557600980546111da90600190615ad1565b815481106111ea576111ea615b44565b90600052602060002001546009848154811061120857611208615b44565b6000918252602090912001555b600980548061122657611226615baa565b600190038181906000526020600020016000905590555b50508061124990615bc0565b9050610e90565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b93916112a191600160a01b90910460ff1690615949565b60405180910390a1565b6000546001600160a01b031633146112d55760405162461bcd60e51b8152600401610cf890615a94565b60006007846001600160601b0316815481106112f3576112f3615b44565b90600052602060002090600b0201905060005b835181101561147a5782156113a057600084828151811061132957611329615b44565b602002602001015111801561135a5750600854845185908390811061135057611350615b44565b6020026020010151105b6113765760405162461bcd60e51b8152600401610cf890615bde565b61139b8585838151811061138c5761138c615b44565b6020026020010151600161498d565b611468565b6001600160601b03851660011480156113f65750600060088583815181106113ca576113ca615b44565b6020026020010151815481106113e2576113e2615b44565b906000526020600020906004020160000154145b156114435760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610cf8565b6114688585838151811061145957611459615b44565b6020026020010151600061498d565b8061147281615c06565b915050611306565b5050505050565b6008818154811061149157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106114df576114df615b44565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061151257611512615b44565b6000918252602082206003850154600b90920201925061153490600190615ad1565b9050600083600301828154811061154d5761154d615b44565b6000918252602082206007909102019150600185015460ff1660048111156115775761157761566a565b14156116aa5760008211806115c957506001840154600684019060ff1660048111156115a5576115a561566a565b600481106115b5576115b5615b44565b015460028501546115c69042615ad1565b10155b6116155760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610cf8565b60038101546006820154146116645760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610cf8565b8254600160601b900460ff1661167b57600261167e565b60015b60018086018054909160ff19909116908360048111156116a0576116a061566a565b0217905550611ad6565b60018085015460ff1660048111156116c4576116c461566a565b1415611810576001840154600684019060ff1660048111156116e8576116e861566a565b600481106116f8576116f8615b44565b015460028501546117099042615ad1565b1015806117b25750600881600001548154811061172857611728615b44565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b29190615ae8565b6117f95760405162461bcd60e51b815260206004820152601860248201527710dbdb5b5a5d081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460029260ff1990911690836116a0565b6002600185015460ff16600481111561182b5761182b61566a565b14156119b3576001840154600684019060ff16600481111561184f5761184f61566a565b6004811061185f5761185f615b44565b015460028501546118709042615ad1565b1015806119195750600881600001548154811061188f5761188f615b44565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156118e157600080fd5b505afa1580156118f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119199190615ae8565b61195e5760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610cf8565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611ad6565b6003600185015460ff1660048111156119ce576119ce61566a565b1415611a73576001840154600684019060ff1660048111156119f2576119f261566a565b60048110611a0257611a02615b44565b01546002850154611a139042615ad1565b1015611a5c5760405162461bcd60e51b8152602060048201526018602482015277105c1c19585b081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460049260ff1990911690836116a0565b6004600185015460ff166004811115611a8e57611a8e61566a565b1415611ad65760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d19481c195c9a5bd9081a5cc8199a5b985b604a1b6044820152606401610cf8565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611b159160ff1690615c21565b60405180910390a25050505050565b600080600a8381548110611b3a57611b3a615b44565b6000918252602082206003600490920201908101805491935090611b6090600190615ad1565b81548110611b7057611b70615b44565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ba357611ba3615b44565b90600052602060002090600b02019050806005015482600301541015611bce57506000949350505050565b80546007805490916001600160601b0316908110611bee57611bee615b44565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600080600a8581548110611c3457611c34615b44565b6000918252602082206003600490920201908101805491935090611c5a90600190615ad1565b81548110611c6a57611c6a615b44565b9060005260206000209060070201905060006008826000015481548110611c9357611c93615b44565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018990526001600160a01b031691508190631c3db16d9060240160606040518083038186803b158015611ce857600080fd5b505afa158015611cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d209190615c2f565b9199909850909650945050505050565b60078181548110611d4057600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611daa57611daa615b44565b906000526020600020015490505b92915050565b6000600a8481548110611dd357611dd3615b44565b600091825260209091206004918202019150600182015460ff166004811115611dfe57611dfe61566a565b14611e1b5760405162461bcd60e51b8152600401610cf890615c67565b6000816003018481548110611e3257611e32615b44565b9060005260206000209060070201905060006008826000015481548110611e5b57611e5b615b44565b60009182526020822060049182020160020154908401546001600160a01b039091169250611e8a908690615c92565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b158015611ee357600080fd5b505afa158015611ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1b9190615b91565b905060008082611f365783861115611f31578395505b611f56565b611f41846002615caa565b861115611f5657611f53846002615caa565b95505b60048801545b868110156125db578481101561235057604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b158015611fba57600080fd5b505afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190615b91565b91506127108211156120045761271091505b60006127106120138482615ad1565b8b600101546120229190615caa565b61202c9190615cdf565b90506120388188615c92565b965089600601828154811061204f5761204f615b44565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b0316855260020190925290822080549196508392909161209c908490615ad1565b90915550508a546007805483926001600160601b03169081106120c1576120c1615b44565b90600052602060002090600b0201600201546120dd9190615c92565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612171576001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915281205461214f908390615ad1565b8c5490915061216a9086906001600160601b03168385614a15565b50506121c2565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152902054156121c2578a546121c09085906001600160601b0316600084614a15565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b15801561221057600080fd5b505afa158015612224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122489190615ae8565b6122a1576000612257856128eb565b905060005b815181101561229e5761228b8683838151811061227b5761227b615b44565b6020026020010151600080614a15565b508061229681615c06565b91505061225c565b50505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196122d684615cf3565b60408051918252600060208301520160405180910390a36122f8600187615ad1565b82141561234a578461234a576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461234893506001600160a01b0316915089905061502f565b505b506125c9565b6001600160a01b038816634fe264fb8e8e61236b8986615d10565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156123af57600080fd5b505afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190615b91565b91506127108211156123f95761271091505b600689016124078683615d10565b8154811061241757612417615b44565b60009182526020909120015460018a01546001600160a01b03909116935061271090612444908490615caa565b61244e9190615cdf565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526002019091528120805490919061248e908490615ad1565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b031684526001019091529020546124f6576000612710838b600101546124dd9190615caa565b6124e79190615cdf565b90506124f3848261502f565b50505b600061271083612506878a615cdf565b6125109190615caa565b61251a9190615cdf565b9050600061271084878d600201546125329190615cdf565b61253c9190615caa565b6125469190615cdf565b9050612552858361502f565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e1984846040516125be929190918252602082015260400190565b60405180910390a350505b806125d381615c06565b915050611f5c565b50848860050154146125ef57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff1660018111156126215761262161566a565b146126605760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610cf8565b6000600e54600183600f546126759190615c92565b61267f9190615ad1565b1161268a57816126a5565b600f54600e5461269a9190615ad1565b6126a5906001615c92565b9050600081600f546126b79190615c92565b600f549091505b81811015612736576000818152600d60205260409020805460018201546002830154612706926001600160a01b03811692600160a01b9091046001600160601b031691614a15565b50506000818152600d6020526040812081815560018101829055600201558061272e81615c06565b9150506126be565b50600f555050565b6127466152ae565b60006007836001600160601b03168154811061276457612764615b44565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b81548152602001906001019080831161278f575050505050915050919050565b6060600882815481106127c4576127c4615b44565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561281f57602002820191906000526020600020905b81548152602001906001019080831161280b575b50505050509050919050565b6000546001600160a01b031633146128555760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061287257612872615b44565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b60405180910390a25050565b6001600160a01b0381166000908152600b602090815260409182902080548351818402810184019094528084526060939283018282801561281f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b0104928301926001038202915080841161293a575094979650505050505050565b600a818154811061299757600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600a83815481106129f9576129f9615b44565b6000918252602082206003600490920201908101805491935090612a1f90600190615ad1565b81548110612a2f57612a2f615b44565b600091825260208220845460078054938102909201945090916001600160601b03909116908110612a6257612a62615b44565b90600052602060002090600b020190508060050154826003015410612b015782546001600160601b031660011415612aa3576001600160ff1b039350612b2e565b6003820154612ab3906002615caa565b612abe906001615c92565b81546007805490916001600160601b0316908110612ade57612ade615b44565b90600052602060002090600b020160040154612afa9190615caa565b9350612b2e565b6003820154612b11906002615caa565b612b1c906001615c92565b8160040154612b2b9190615caa565b93505b505050919050565b6000546001600160a01b03163314612b605760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b031681548110612b7d57612b7d615b44565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b6000546001600160a01b03163314612c015760405162461bcd60e51b8152600401610cf890615a94565b6001600160601b03821660011480612c74575080600780846001600160601b031681548110612c3257612c32615b44565b60009182526020909120600b909102015481546001600160601b03909116908110612c5f57612c5f615b44565b90600052602060002090600b02016002015411155b612c905760405162461bcd60e51b8152600401610cf890615d24565b60005b6007836001600160601b031681548110612caf57612caf615b44565b90600052602060002090600b020160010180549050811015612d685781600780856001600160601b031681548110612ce957612ce9615b44565b90600052602060002090600b02016001018381548110612d0b57612d0b615b44565b906000526020600020015481548110612d2657612d26615b44565b90600052602060002090600b0201600201541015612d565760405162461bcd60e51b8152600401610cf890615d24565b80612d6081615c06565b915050612c93565b50806007836001600160601b031681548110612d8657612d86615b44565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615e608339815191526040516128df906020808252600890820152676d696e5374616b6560c01b604082015260600190565b6000546001600160a01b03163314612e075760405162461bcd60e51b8152600401610cf890615a94565b6000836001600160a01b03168383604051612e229190615d85565b60006040518083038185875af1925050503d8060008114612e5f576040519150601f19603f3d011682016040523d82523d6000602084013e612e64565b606091505b5050905080612ea95760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cf8565b50505050565b612ebc3383836000614a15565b612ef95760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610cf8565b5050565b6000546001600160a01b03163314612f275760405162461bcd60e51b8152600401610cf890615a94565b600355565b6000546001600160a01b03163314612f565760405162461bcd60e51b8152600401610cf890615a94565b8660078a6001600160601b031681548110612f7357612f73615b44565b90600052602060002090600b0201600201541115612fa35760405162461bcd60e51b8152600401610cf890615d24565b6000815111612fe45760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610cf8565b6001600160601b03891661303a5760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610cf8565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561313657600084828151811061308f5761308f615b44565b60200260200101511180156130c0575060085484518590839081106130b6576130b6615b44565b6020026020010151105b6130dc5760405162461bcd60e51b8152600401610cf890615bde565b600182600a0160008684815181106130f6576130f6615b44565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550808061312e90615c06565b915050613072565b5080546001600160601b0319166001600160601b038c16178155604080516000815260208101918290525161316f9160018401916152cc565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556131b29060068301908790615317565b5060405163483abc4f60e11b8152600c6004820152602481018390526044810185905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90639075789e9060640160006040518083038186803b15801561320c57600080fd5b505af4158015613220573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061324057613240615b44565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab10906132af908e908e908e908e908e908e908e908e90615da1565b60405180910390a35050505050505050505050565b6000806000806060600080600a89815481106132e2576132e2615b44565b9060005260206000209060040201600301888154811061330457613304615b44565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561338657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613368575b50505050509150965096509650965096509650509295509295509295565b6000600a82815481106133b9576133b9615b44565b600091825260209091206004918202019150600182015460ff1660048111156133e4576133e461566a565b146134015760405162461bcd60e51b8152600401610cf890615c67565b6001810154610100900460ff16156134555760405162461bcd60e51b8152602060048201526017602482015276149d5b1a5b99c8185b1c9958591e48195e1958dd5d1959604a1b6044820152606401610cf8565b600061346083611c1b565b505060018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b1580156134c857600080fd5b505af11580156134dc573d6000803e3d6000fd5b50505050505050565b600981815481106134f557600080fd5b600091825260209091200154905081565b6000546001600160a01b031633146135305760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061354d5761354d615b44565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615e608339815191526040516128df90602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146135cb5760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b0316815481106135e8576135e8615b44565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615e608339815191526040516128df9060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061366157613661615b44565b6000918252602090912060049091020190506003600182015460ff16600481111561368e5761368e61566a565b14156136e7576002810154815460078054929550916001600160601b039091169081106136bd576136bd615b44565b600091825260209091206009600b90920201015460028201546136e09190615c92565b91506136f0565b60009250600091505b50915091565b6000546001600160a01b031633146137205760405162461bcd60e51b8152600401610cf890615a94565b600455565b6000546001600160a01b0316331461374f5760405162461bcd60e51b8152600401610cf890615a94565b806007836001600160601b03168154811061376c5761376c615b44565b90600052602060002090600b020160060190600461378b929190615317565b50816001600160601b0316600080516020615e608339815191526040516128df906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b60006001600254600160a01b900460ff1660018111156137f6576137f661566a565b148015613811575060045460055461380e9042615ad1565b10155b905090565b6000613821826148c2565b3410156138705760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610cf8565b60008061387c84615104565b92505091506007826001600160601b03168154811061389d5761389d615b44565b60009182526020808320848452600a600b90930201919091019052604090205460ff166139065760405162461bcd60e51b81526020600482015260176024820152761112c81d5b9cdd5c1c1bdc9d195908189e4818dbdd5c9d604a1b6044820152606401610cf8565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa90910155600880549296509092918490811061399157613991615b44565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b039091169081106139d2576139d2615b44565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613a119034615cdf565b600380830191909155858255820154600283015461271091613a3291615caa565b613a3c9190615cdf565b60018201553460028201556008805486908110613a5b57613a5b615b44565b906000526020600020906004020160020160149054906101000a900460ff16613af257600160088681548110613a9357613a93615b44565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613b27918b918e918e91600401615df9565b600060405180830381600087803b158015613b4157600080fd5b505af1158015613b55573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613bbc5760405162461bcd60e51b8152600401610cf890615a94565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613be7836129e3565b341015613c365760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610cf8565b6000600a8481548110613c4b57613c4b615b44565b6000918252602090912060049091020190506003600182015460ff166004811115613c7857613c7861566a565b14613cbe5760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610cf8565b60038101805460009190613cd490600190615ad1565b81548110613ce457613ce4615b44565b906000526020600020906007020190506008816000015481548110613d0b57613d0b615b44565b60009182526020909120600490910201600201546001600160a01b03163314613d695760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610cf8565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019184908110613daa57613daa615b44565b90600052602060002090600b020160050154846003015410613fae576007836001600160601b031681548110613de257613de2615b44565b600091825260208220600b90910201546001600160601b031693505b600a811015613ef3576007846001600160601b031681548110613e2357613e23615b44565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613e5057613ef3565b600060088481548110613e6557613e65615b44565b90600052602060002090600402016000015414613ea85760088381548110613e8f57613e8f615b44565b9060005260206000209060040201600001549250613ee1565b6007846001600160601b031681548110613ec457613ec4615b44565b60009182526020909120600b90910201546001600160601b031693505b80613eeb81615c06565b915050613dfe565b506007836001600160601b031681548110613f1057613f10615b44565b60009182526020808320858452600a600b90930201919091019052604090205460ff16613f3c57600192505b84546001600160601b03848116911614613fae57845460038601546001600160601b0390911690613f6f90600190615ad1565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff1916905542600287015560078054600092908110613ff157613ff1615b44565b90600052602060002090600b020190508060040154346140119190615cdf565b8260030181905550612710816003015482600201546140309190615caa565b61403a9190615cdf565b6001830155346002830155828255600880548490811061405c5761405c615b44565b906000526020600020906004020160020160149054906101000a900460ff166140f35760016008848154811061409457614094615b44565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b84548254146141d9578454600387015461410f90600190615ad1565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a4600882600001548154811061415d5761415d615b44565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede540926141a6928e928e928e929101615df9565b600060405180830381600087803b1580156141c057600080fd5b505af11580156141d4573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516142499190615c21565b60405180910390a2505050505050505050565b600080600a838154811061427257614272615b44565b90600052602060002090600402019050806003016001826003018054905061429a9190615ad1565b815481106142aa576142aa615b44565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff1660018111156142e4576142e461566a565b1461431f5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610cf8565b6000600a838154811061433457614334615b44565b9060005260206000209060040201905060006001826003018054905061435a9190615ad1565b9050600082600301828154811061437357614373615b44565b6000918252602082206007909102019150600184015460ff16600481111561439d5761439d61566a565b146143dd5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610cf8565b600060088260000154815481106143f6576143f6615b44565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061442c8884615c92565b111561443c578360030154614446565b6144468783615c92565b9050815b818110156145ba57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561449757600080fd5b505af11580156144ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144cf9190615e42565b90506001600160a01b038116156145a75760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614525908490615c92565b909155505060068601546040805189815260208101929092528b916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a3600686018054600181018255600091825260209091200180546001600160a01b0319166001600160a01b0383161790555b50806145b281615c06565b91505061444a565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561461357602002820191906000526020600020905b8154815260200190600101908083116145ff575b5050505050905090565b6000546001600160a01b031633146146475760405162461bcd60e51b8152600401610cf890615a94565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146146935760405162461bcd60e51b8152600401610cf890615a94565b6008548082106146cf5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610cf8565b6000821561474c57600883815481106146ea576146ea615b44565b90600052602060002090600402016003015460016147089190615c92565b9050600a811061474c5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610cf8565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3810191825591518051939491936147fe937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906152cc565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b0390931692909217919091179055608090910151600390910155600880548490811061485857614858615b44565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482612ea957612ea9600183600161498d565b60008060006148d084615104565b5091509150806007836001600160601b0316815481106148f2576148f2615b44565b90600052602060002090600b02016004015461490e9190615caa565b949350505050565b6000600a828154811061492b5761492b615b44565b600091825260209091206003600490920201015492915050565b60006007836001600160601b03168154811061496357614963615b44565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b0316815481106149aa576149aa615b44565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614a3757506007546001600160601b038516115b15614a445750600061490e565b6001600160a01b0385166000908152600b6020526040812090614a678787615188565b604051637521ccb160e01b8152600c60048201526001600160601b03881660248201526044810182905290915060009073__$52cf47af9c3c0d67e54ac2a3225447effa$__90637521ccb19060640160206040518083038186803b158015614ace57600080fd5b505af4158015614ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b069190615b91565b90508515614b94576007876001600160601b031681548110614b2a57614b2a615b44565b90600052602060002090600b020160020154861080614b6257506001600160601b038716600090815260028401602052604090205486105b15614b73576000935050505061490e565b80158015614b8357508254600411155b15614b94576000935050505061490e565b6000600254600160a01b900460ff166001811115614bb457614bb461566a565b14614c60576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614bff90615c06565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061490e92505050565b6000818710614cdd57614c738288615ad1565b90508015614ccb57614c868930836151d0565b15614cd05781614ccb578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b614eb2565b600094505050505061490e565b86614e7a576001600160601b03881660009081526002850160205260409020548690614d099084615ad1565b614d139190615ad1565b90508015614ccb57614d25898261502f565b15614cd05760005b8454811015614e7457886001600160601b0316856000018281548110614d5557614d55615b44565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415614e625784548590614d9290600190615ad1565b81548110614da257614da2615b44565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614de057614de0615b44565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480614e2c57614e2c615baa565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055614e74565b80614e6c81615c06565b915050614d2d565b50614eb2565b85614e858884615ad1565b614e8f9190615ad1565b90508015614eb257614ea1898261502f565b614eb257600094505050505061490e565b6001600160601b03881660009081526001850160205260408120548890614eda908590615ad1565b614ee49190615c92565b6001600160601b038a16600081815260018801602052604081208390559192505b81614fc857604051631712e1c560e11b8152600c600482015260248101829052604481018b90526064810187905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90632e25c38a9060840160006040518083038186803b158015614f6a57600080fd5b505af4158015614f7e573d6000803e3d6000fd5b505050506001811415614f945760019150614f05565b60078181548110614fa757614fa7615b44565b60009182526020909120600b90910201546001600160601b03169050614f05565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000938493849391169161508f9190615d85565b6000604051808303816000865af19150503d80600081146150cc576040519150601f19603f3d011682016040523d82523d6000602084013e6150d1565b606091505b50915091508180156150fb5750805115806150fb5750808060200190518101906150fb9190615ae8565b95945050505050565b60008060006040845110615176575050506020810151604082015160608301516001600160601b038316158061514557506007546001600160601b03841610155b1561514f57600192505b8161515957600391505b80158061516857506008548110155b15615171575060015b615181565b506001915060039050815b9193909250565b600060405160005b60148110156151ab578481600c011a81830153600101615190565b5060145b60208110156151c75783811a818301536001016151af565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916152389190615d85565b6000604051808303816000865af19150503d8060008114615275576040519150601f19603f3d011682016040523d82523d6000602084013e61527a565b606091505b50915091508180156152a45750805115806152a45750808060200190518101906152a49190615ae8565b9695505050505050565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215615307579160200282015b828111156153075782518255916020019190600101906152ec565b50615313929150615344565b5090565b826004810192821561530757916020028201828111156153075782518255916020019190600101906152ec565b5b808211156153135760008155600101615345565b6001600160a01b038116811461536e57600080fd5b50565b60006020828403121561538357600080fd5b813561538e81615359565b9392505050565b80356001600160601b03811681146153ac57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156153ef576153ef6153b1565b604052919050565b600082601f83011261540857600080fd5b813560206001600160401b03821115615423576154236153b1565b8160051b6154328282016153c7565b928352848101820192828101908785111561544c57600080fd5b83870192505b8483101561546b57823582529183019190830190615452565b979650505050505050565b801515811461536e57600080fd5b60008060006060848603121561549957600080fd5b6154a284615395565b925060208401356001600160401b038111156154bd57600080fd5b6154c9868287016153f7565b92505060408401356154da81615476565b809150509250925092565b6000602082840312156154f757600080fd5b5035919050565b6000806040838503121561551157600080fd5b50508035926020909101359150565b60008060006060848603121561553557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561555e57600080fd5b61538e82615395565b8060005b6004811015612ea957815184526020938401939091019060010161556b565b60808101611db88284615567565b600081518084526020808501945080840160005b838110156155c8578151875295820195908201906001016155ac565b509495945050505050565b60208152600061538e6020830184615598565b600080604083850312156155f957600080fd5b61560283615395565b9150602083013561561281615476565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561565e5783516001600160601b031683529284019291840191600101615639565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106156905761569061566a565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016156c06040830186615680565b9215156060820152608001529392505050565b600080604083850312156156e657600080fd5b6156ef83615395565b946020939093013593505050565b600082601f83011261570e57600080fd5b81356001600160401b03811115615727576157276153b1565b61573a601f8201601f19166020016153c7565b81815284602083860101111561574f57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561578157600080fd5b833561578c81615359565b92506020840135915060408401356001600160401b038111156157ae57600080fd5b6157ba868287016156fd565b9150509250925092565b600082601f8301126157d557600080fd5b604051608081018181106001600160401b03821117156157f7576157f76153b1565b60405280608084018581111561580c57600080fd5b845b8181101561582657803583526020928301920161580e565b509195945050505050565b60008060008060008060008060006101808a8c03121561585057600080fd5b6158598a615395565b985060208a013561586981615476565b975060408a0135965060608a0135955060808a0135945060a08a013593506158948b60c08c016157c4565b92506101408a013591506101608a01356001600160401b038111156158b857600080fd5b6158c48c828d016153f7565b9150509295985092959850929598565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b818110156159305784516001600160a01b03168352938301939183019160010161590b565b50508093505050508260a0830152979650505050505050565b602081016002831061595d5761595d61566a565b91905290565b60008060a0838503121561597657600080fd5b61597f83615395565b915061598e84602085016157c4565b90509250929050565b600080604083850312156159aa57600080fd5b8235915060208301356001600160401b038111156159c757600080fd5b6159d3858286016156fd565b9150509250929050565b6000806000606084860312156159f257600080fd5b833592506020840135915060408401356001600160401b038111156157ae57600080fd5b60008060408385031215615a2957600080fd5b8235615a3481615359565b915061598e60208401615395565b60008060408385031215615a5557600080fd5b82356156ef81615359565b600060208284031215615a7257600080fd5b81356001600160401b03811115615a8857600080fd5b61490e848285016156fd565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615ae357615ae3615abb565b500390565b600060208284031215615afa57600080fd5b815161538e81615476565b60008083128015600160ff1b850184121615615b2357615b23615abb565b6001600160ff1b0384018313811615615b3e57615b3e615abb565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f536f6d6520444b206e6f7420696e205265736f6c76696e672070686173650000604082015260600190565b600060208284031215615ba357600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615bd657615bd6615abb565b506000190190565b6020808252600e908201526d0aee4dedcce40889640d2dcc8caf60931b604082015260600190565b6000600019821415615c1a57615c1a615abb565b5060010190565b60208101611db88284615680565b600080600060608486031215615c4457600080fd5b835192506020840151615c5681615476565b60408501519092506154da81615476565b60208082526011908201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b604082015260600190565b60008219821115615ca557615ca5615abb565b500190565b6000816000190483118215151615615cc457615cc4615abb565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615cee57615cee615cc9565b500490565b6000600160ff1b821415615d0957615d09615abb565b5060000390565b600082615d1f57615d1f615cc9565b500690565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60005b83811015615d74578181015183820152602001615d5c565b83811115612ea95750506000910152565b60008251615d97818460208701615d59565b9190910192915050565b60006101608a15158352896020840152886040840152876060840152866080840152615dd060a0840187615567565b8461012084015280610140840152615dea81840185615598565b9b9a5050505050505050505050565b8481528360208201526080604082015260008351806080840152615e248160a0850160208801615d59565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615e5457600080fd5b815161538e8161535956fee83e0a05baa75e68db64db7387055029be50c8d8de00a3e3e56978509b9bc2dea264697066735822122002e319f86cb632099714813977d3a5996c5b7c4f0f7cc908f3c7e3771996e90364736f6c63430008090033", + "numDeployments": 4, + "solcInputHash": "385558cd8f2e0323787dead6b7cecab9", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKit\",\"type\":\"address\"},{\"internalType\":\"uint256[2]\",\"name\":\"_phaseTimeouts\",\"type\":\"uint256[2]\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256[4]\",\"name\":\"_courtParameters\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealDecision\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"AppealPossible\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"CourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromCourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toCourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_param\",\"type\":\"string\"}],\"name\":\"CourtModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"DisputeKitCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"DisputeKitEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_fromDisputeKitID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_toDisputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitJump\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"Draw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum KlerosCore.Period\",\"name\":\"_period\",\"type\":\"uint8\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum KlerosCore.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_newTotalStake\",\"type\":\"uint256\"}],\"name\":\"StakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_tokenAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_ethAmount\",\"type\":\"int256\"}],\"name\":\"TokenAndETHShift\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ALPHA_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DISPUTE_KIT_CLASSIC\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FORKING_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GENERAL_COURT\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_STAKE_PATHS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NON_PAYABLE_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NULL_DISPUTE_KIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SEARCH_ITERATIONS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"addNewDisputeKit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"appeal\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"appealPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"}],\"name\":\"changeCourtAlpha\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"}],\"name\":\"changeCourtHiddenVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorsForJump\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"changeCourtMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"changeCourtTimesPerPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jurorProsecutionModule\",\"type\":\"address\"}],\"name\":\"changeJurorProsecutionModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxFreezingTime\",\"type\":\"uint256\"}],\"name\":\"changeMaxFreezingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"}],\"name\":\"changeMinStakingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_pinakion\",\"type\":\"address\"}],\"name\":\"changePinakion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"courts\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jurorsForCourtJump\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"type\":\"uint256[]\"}],\"name\":\"createCourt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"overridden\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeReadIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"delayedStakeWriteIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delayedStakes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputeKitNodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"parent\",\"type\":\"uint256\"},{\"internalType\":\"contract IDisputeKit\",\"name\":\"disputeKit\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"needsFreezing\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"depthLevel\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"courtID\",\"type\":\"uint96\"},{\"internalType\":\"contract IArbitrable\",\"name\":\"arbitrated\",\"type\":\"address\"},{\"internalType\":\"enum KlerosCore.Period\",\"name\":\"period\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"lastPeriodChange\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputesKitIDsThatNeedFreezing\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"draw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[]\",\"name\":\"_disputeKitIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"_enable\",\"type\":\"bool\"}],\"name\":\"enableDisputeKits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"executeDelayedStakes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"executeRuling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"freezeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"freezingPhaseTimeout\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKitChildren\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputesKitIDsThatNeedFreezing\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"staked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"locked\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"}],\"name\":\"getJurorCourtIDs\",\"outputs\":[{\"internalType\":\"uint96[]\",\"name\":\"\",\"type\":\"uint96[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfRounds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getNumberOfVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getRoundInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokensAtStakePerJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalFeesForJurors\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"repartitions\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalties\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"drawnJurors\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"disputeKitID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_nodeIndex\",\"type\":\"uint256\"}],\"name\":\"getSortitionSumTree\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"K\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"ID\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getSortitionSumTreeNode\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"}],\"name\":\"getTimesPerPeriod\",\"outputs\":[{\"internalType\":\"uint256[4]\",\"name\":\"timesPerPeriod\",\"type\":\"uint256[4]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"isDisputeKitJumping\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"isSupported\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jurorProsecutionModule\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastPhaseChange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxFreezingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStakingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"passPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"passPhase\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum KlerosCore.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pinakion\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_stake\",\"type\":\"uint256\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"addNewDisputeKit(address,uint256)\":{\"details\":\"Add a new supported dispute kit module to the court.\",\"params\":{\"_disputeKitAddress\":\"The address of the dispute kit contract.\",\"_parent\":\"The ID of the parent dispute kit. It is left empty when root DK is created. Note that the root DK must be supported by the general court.\"}},\"appeal(uint256,uint256,bytes)\":{\"details\":\"Appeals the ruling of a specified dispute. Note: Access restricted to the Dispute Kit for this `disputeID`.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_extraData\":\"Extradata for the dispute. Can be required during court jump.\",\"_numberOfChoices\":\"Number of choices for the dispute. Can be required during court jump.\"}},\"appealCost(uint256)\":{\"details\":\"Gets the cost of appealing a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"cost\":\"The appeal cost.\"}},\"appealPeriod(uint256)\":{\"details\":\"Gets the start and the end of a specified dispute's current appeal period.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"end\":\"The end of the appeal period.\",\"start\":\"The start of the appeal period.\"}},\"arbitrationCost(bytes)\":{\"details\":\"Gets the cost of arbitration in a specified court.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\"},\"returns\":{\"cost\":\"The arbitration cost.\"}},\"changeCourtAlpha(uint96,uint256)\":{\"details\":\"Changes the `alpha` property value of a specified court.\",\"params\":{\"_alpha\":\"The new value for the `alpha` property value.\",\"_courtID\":\"The ID of the court.\"}},\"changeCourtHiddenVotes(uint96,bool)\":{\"details\":\"Changes the `hiddenVotes` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_hiddenVotes\":\"The new value for the `hiddenVotes` property value.\"}},\"changeCourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}},\"changeCourtJurorsForJump(uint96,uint256)\":{\"details\":\"Changes the `jurorsForCourtJump` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_jurorsForCourtJump\":\"The new value for the `jurorsForCourtJump` property value.\"}},\"changeCourtMinStake(uint96,uint256)\":{\"details\":\"Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_minStake\":\"The new value for the `minStake` property value.\"}},\"changeCourtTimesPerPeriod(uint96,uint256[4])\":{\"details\":\"Changes the `timesPerPeriod` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_timesPerPeriod\":\"The new value for the `timesPerPeriod` property value.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeJurorProsecutionModule(address)\":{\"details\":\"Changes the `jurorProsecutionModule` storage variable.\",\"params\":{\"_jurorProsecutionModule\":\"The new value for the `jurorProsecutionModule` storage variable.\"}},\"changeMaxFreezingTime(uint256)\":{\"details\":\"Changes the `maxFreezingTime` storage variable.\",\"params\":{\"_maxFreezingTime\":\"The new value for the `maxFreezingTime` storage variable.\"}},\"changeMinStakingTime(uint256)\":{\"details\":\"Changes the `minStakingTime` storage variable.\",\"params\":{\"_minStakingTime\":\"The new value for the `minStakingTime` storage variable.\"}},\"changePinakion(address)\":{\"details\":\"Changes the `pinakion` storage variable.\",\"params\":{\"_pinakion\":\"The new value for the `pinakion` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_courtParameters\":\"Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively).\",\"_disputeKit\":\"The address of the default dispute kit.\",\"_governor\":\"The governor's address.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the general court.\",\"_jurorProsecutionModule\":\"The address of the juror prosecution module.\",\"_phaseTimeouts\":\"minStakingTime and maxFreezingTime respectively\",\"_pinakion\":\"The address of the token contract.\",\"_sortitionSumTreeK\":\"The number of children per node of the general court's sortition sum tree.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the general court.\"}},\"createCourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,uint256[])\":{\"details\":\"Creates a court under a specified parent court.\",\"params\":{\"_alpha\":\"The `alpha` property value of the court.\",\"_feeForJuror\":\"The `feeForJuror` property value of the court.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the court.\",\"_jurorsForCourtJump\":\"The `jurorsForCourtJump` property value of the court.\",\"_minStake\":\"The `minStake` property value of the court.\",\"_parent\":\"The `parent` property value of the court.\",\"_sortitionSumTreeK\":\"The number of children per node of the court's sortition sum tree.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this court will support.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the court.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Creates a dispute. Must be called by the arbitrable contract.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\",\"_numberOfChoices\":\"Number of choices for the jurors to choose from.\"},\"returns\":{\"disputeID\":\"The ID of the created dispute.\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"overridden\":\"Whether the ruling was overridden by appeal funding or not.\",\"ruling\":\"The current ruling.\",\"tied\":\"Whether it's a tie or not.\"}},\"draw(uint256,uint256)\":{\"details\":\"Draws jurors for the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\"}},\"enableDisputeKits(uint96,uint256[],bool)\":{\"details\":\"Adds/removes court's support for specified dispute kits.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the court.\"}},\"execute(uint256,uint256,uint256)\":{\"details\":\"Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_iterations\":\"The number of iterations to run.\",\"_round\":\"The appeal round.\"}},\"executeDelayedStakes(uint256)\":{\"details\":\"Executes the next delayed stakes.\",\"params\":{\"_iterations\":\"The number of delayed stakes to execute.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Allows the governor to call anything on behalf of the contract.\",\"params\":{\"_amount\":\"The value sent with the call.\",\"_data\":\"The data sent with the call.\",\"_destination\":\"The destination of the call.\"}},\"executeRuling(uint256)\":{\"details\":\"Executes a specified dispute's ruling. UNTRUSTED.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"getDisputeKitChildren(uint256)\":{\"details\":\"Gets non-primitive properties of a specified dispute kit node.\",\"params\":{\"_disputeKitID\":\"The ID of the dispute kit.\"},\"returns\":{\"_0\":\"children Indexes of children of this DK.\"}},\"getTimesPerPeriod(uint96)\":{\"details\":\"Gets the timesPerPeriod array for a given court.\",\"params\":{\"_courtID\":\"The ID of the court to get the times from.\"},\"returns\":{\"timesPerPeriod\":\"The timesPerPeriod array for the given court.\"}},\"isDisputeKitJumping(uint256)\":{\"details\":\"Returns true if the dispute kit will be switched to a parent DK.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"_0\":\"Whether DK will be switched or not.\"}},\"passPeriod(uint256)\":{\"details\":\"Passes the period of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"}},\"passPhase()\":{\"details\":\"Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\"},\"setStake(uint96,uint256)\":{\"details\":\"Sets the caller's stake in a court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_stake\":\"The new stake.\"}}},\"title\":\"KlerosCore Core arbitrator contract for Kleros v2. Note that this contract trusts the token and the dispute kit contracts.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/KlerosCore.sol\":\"KlerosCore\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/arbitration/IDisputeKit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\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.\\n */\\ninterface IDisputeKit {\\n // ************************************ //\\n // * Events * //\\n // ************************************ //\\n\\n /**\\n * @dev Emitted when casting a vote to provide the justification of juror's choice.\\n * @param _coreDisputeID ID of the dispute in the core contract.\\n * @param _juror Address of the juror.\\n * @param _choice The choice juror voted for.\\n * @param _justification Justification of the choice.\\n */\\n event Justification(\\n uint256 indexed _coreDisputeID,\\n address indexed _juror,\\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 */\\n function createDispute(\\n uint256 _coreDisputeID,\\n uint256 _numberOfChoices,\\n bytes calldata _extraData,\\n uint256 _nbVotes\\n ) external;\\n\\n /** @dev Passes the phase.\\n */\\n function passPhase() 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 * @return drawnAddress The drawn address.\\n */\\n function draw(uint256 _coreDisputeID) 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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden);\\n\\n /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the vote.\\n * @return The degree of coherence in basis points.\\n */\\n function getDegreeOfCoherence(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) external view returns (uint256);\\n\\n /** @dev Gets the number of jurors who are eligible to a reward in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @return The number of coherent jurors.\\n */\\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 */\\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 */\\n function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool);\\n\\n /** @dev Returns true if the specified voter was active in this round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit.\\n * @param _voteID The ID of the voter.\\n * @return Whether the voter was active or not.\\n */\\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 /** @dev Returns the number of disputes without jurors in the dispute kit.\\n * @return The number of disputes without jurors in the dispute kit.\\n */\\n function disputesWithoutJurors() external view returns (uint256);\\n\\n /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors.\\n * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors.\\n */\\n function isResolving() external view returns (bool);\\n}\\n\",\"keccak256\":\"0xecebcf3e67b261c5e521f6bd9fd184151833f521008f38e4935f907ca1f17d0f\",\"license\":\"MIT\"},\"src/arbitration/KlerosCore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@unknownunknown1, @jaybuidl]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./IArbitrator.sol\\\";\\nimport \\\"./IDisputeKit.sol\\\";\\nimport {SortitionSumTreeFactoryV2} from \\\"../libraries/SortitionSumTreeFactoryV2.sol\\\";\\n\\n/**\\n * @title KlerosCore\\n * Core arbitrator contract for Kleros v2.\\n * Note that this contract trusts the token and the dispute kit contracts.\\n */\\ncontract KlerosCore is IArbitrator {\\n using SortitionSumTreeFactoryV2 for SortitionSumTreeFactoryV2.SortitionSumTrees; // Use library functions for sortition sum trees.\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n enum Phase {\\n staking, // Stake can be updated during this phase.\\n freezing // Phase during which the dispute kits can undergo the drawing process. Staking is not allowed during this phase.\\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 tokens needed to stake in the court.\\n uint256 alpha; // Basis point of tokens that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n mapping(uint256 => bool) supportedDisputeKits; // True if DK with this ID is supported by the court.\\n }\\n\\n struct Dispute {\\n uint96 courtID; // The ID of the court the dispute is in.\\n IArbitrable 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 tokensAtStakePerJuror; // The amount of tokens 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 penalties; // The amount of tokens collected from penalties in this round.\\n address[] drawnJurors; // Addresses of the jurors that were drawn in this round.\\n }\\n\\n struct Juror {\\n uint96[] courtIDs; // The IDs of courts where the juror's stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n mapping(uint96 => uint256) stakedTokens; // The number of tokens the juror has staked in the court in the form `stakedTokens[courtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the court in the form `lockedTokens[courtID]`.\\n }\\n\\n struct DisputeKitNode {\\n uint256 parent; // Index of the parent dispute kit. If it's 0 then this DK is a root.\\n uint256[] children; // List of child dispute kits.\\n IDisputeKit disputeKit; // The dispute kit implementation.\\n bool needsFreezing; // The dispute kit needs freezing.\\n uint256 depthLevel; // How far this DK is from the root. 0 for root DK.\\n }\\n\\n struct DelayedStake {\\n address account; // The address of the juror.\\n uint96 courtID; // The ID of the court.\\n uint256 stake; // The new stake.\\n uint256 penalty; // Penalty value, in case the stake was set during execution.\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint96 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint96 public constant GENERAL_COURT = 1; // Index of the default (general) court.\\n uint256 public constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.\\n uint256 public constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant SEARCH_ITERATIONS = 10; // Number of iterations to search for suitable parent court before jumping to the top court.\\n\\n address public governor; // The governor of the contract.\\n IERC20 public pinakion; // The Pinakion token contract.\\n // TODO: interactions with jurorProsecutionModule.\\n address public jurorProsecutionModule; // The module for juror's prosecution.\\n Phase public phase; // The current phase.\\n uint256 public minStakingTime; // The time after which the phase can be switched to Freezing if there are open disputes.\\n uint256 public maxFreezingTime; // The time after which the phase can be switched back to Staking.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public freezeBlock; // Number of the block when Core was frozen.\\n Court[] public courts; // The courts.\\n DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID.\\n uint256[] public disputesKitIDsThatNeedFreezing; // The disputeKitIDs that need switching to Freezing phase.\\n Dispute[] public disputes; // The disputes.\\n mapping(address => Juror) internal jurors; // The jurors.\\n SortitionSumTreeFactoryV2.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees.\\n mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking.\\n\\n uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped.\\n uint256 public delayedStakeReadIndex = 1; // The index of the next `delayedStake` item that should be processed. Starts at 1 because 0 index is skipped.\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event NewPhase(Phase _phase);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount, uint256 _newTotalStake);\\n event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);\\n event CourtCreated(\\n uint256 indexed _courtID,\\n uint96 indexed _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] _timesPerPeriod,\\n uint256 _sortitionSumTreeK,\\n uint256[] _supportedDisputeKits\\n );\\n event CourtModified(uint96 indexed _courtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _courtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromCourtID,\\n uint96 _toCourtID\\n );\\n event DisputeKitJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint256 indexed _fromDisputeKitID,\\n uint256 _toDisputeKitID\\n );\\n event TokenAndETHShift(\\n address indexed _account,\\n uint256 indexed _disputeID,\\n int256 _tokenAmount,\\n int256 _ethAmount\\n );\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _governor The governor's address.\\n * @param _pinakion The address of the token contract.\\n * @param _jurorProsecutionModule The address of the juror prosecution module.\\n * @param _disputeKit The address of the default dispute kit.\\n * @param _phaseTimeouts minStakingTime and maxFreezingTime respectively\\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 _sortitionSumTreeK The number of children per node of the general court's sortition sum tree.\\n */\\n constructor(\\n address _governor,\\n IERC20 _pinakion,\\n address _jurorProsecutionModule,\\n IDisputeKit _disputeKit,\\n uint256[2] memory _phaseTimeouts,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK\\n ) {\\n governor = _governor;\\n pinakion = _pinakion;\\n jurorProsecutionModule = _jurorProsecutionModule;\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push();\\n\\n // DISPUTE_KIT_CLASSIC\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: NULL_DISPUTE_KIT,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT);\\n\\n // FORKING_COURT\\n // TODO: Fill the properties for the Forking court, emit CourtCreated.\\n courts.push();\\n sortitionSumTrees.createTree(bytes32(uint256(FORKING_COURT)), _sortitionSumTreeK);\\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 sortitionSumTrees.createTree(bytes32(uint256(GENERAL_COURT)), _sortitionSumTreeK);\\n emit CourtCreated(\\n 1,\\n court.parent,\\n _hiddenVotes,\\n _courtParameters[0],\\n _courtParameters[1],\\n _courtParameters[2],\\n _courtParameters[3],\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n new uint256[](0)\\n );\\n enableDisputeKit(GENERAL_COURT, DISPUTE_KIT_CLASSIC, true);\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Allows the governor to call anything on behalf of the contract.\\n * @param _destination The destination of the call.\\n * @param _amount The value sent with the call.\\n * @param _data The data sent with the call.\\n */\\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 */\\n function changeGovernor(address payable _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Changes the `pinakion` storage variable.\\n * @param _pinakion The new value for the `pinakion` storage variable.\\n */\\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 */\\n function changeJurorProsecutionModule(address _jurorProsecutionModule) external onlyByGovernor {\\n jurorProsecutionModule = _jurorProsecutionModule;\\n }\\n\\n /** @dev Changes the `minStakingTime` storage variable.\\n * @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n */\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /** @dev Changes the `maxFreezingTime` storage variable.\\n * @param _maxFreezingTime The new value for the `maxFreezingTime` storage variable.\\n */\\n function changeMaxFreezingTime(uint256 _maxFreezingTime) external onlyByGovernor {\\n maxFreezingTime = _maxFreezingTime;\\n }\\n\\n /** @dev Add a new supported dispute kit module to the court.\\n * @param _disputeKitAddress The address of the dispute kit contract.\\n * @param _parent The ID of the parent dispute kit. It is left empty when root DK is created.\\n * Note that the root DK must be supported by the general court.\\n */\\n function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor {\\n uint256 disputeKitID = disputeKitNodes.length;\\n require(_parent < disputeKitID, \\\"!Parent\\\");\\n uint256 depthLevel;\\n if (_parent != NULL_DISPUTE_KIT) {\\n depthLevel = disputeKitNodes[_parent].depthLevel + 1;\\n // It should be always possible to reach the root from the leaf with the defined number of search iterations.\\n require(depthLevel < SEARCH_ITERATIONS, \\\"Depth level max\\\");\\n }\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: _parent,\\n children: new uint256[](0),\\n disputeKit: _disputeKitAddress,\\n needsFreezing: false,\\n depthLevel: depthLevel\\n })\\n );\\n disputeKitNodes[_parent].children.push(disputeKitID);\\n emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent);\\n if (_parent == NULL_DISPUTE_KIT) {\\n // A new dispute kit tree root should always be supported by the General court.\\n enableDisputeKit(GENERAL_COURT, disputeKitID, true);\\n }\\n }\\n\\n /** @dev Creates a court under a specified parent court.\\n * @param _parent The `parent` property value of the court.\\n * @param _hiddenVotes The `hiddenVotes` property value of the court.\\n * @param _minStake The `minStake` property value of the court.\\n * @param _alpha The `alpha` property value of the court.\\n * @param _feeForJuror The `feeForJuror` property value of the court.\\n * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the court.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the court.\\n * @param _sortitionSumTreeK The number of children per node of the court's sortition sum tree.\\n * @param _supportedDisputeKits Indexes of dispute kits that this court will support.\\n */\\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 uint256 _sortitionSumTreeK,\\n uint256[] memory _supportedDisputeKits\\n ) external onlyByGovernor {\\n require(courts[_parent].minStake <= _minStake, \\\"MinStake lower than parent court\\\");\\n require(_supportedDisputeKits.length > 0, \\\"!Supported DK\\\");\\n require(_parent != FORKING_COURT, \\\"Invalid: Forking court as parent\\\");\\n\\n uint256 courtID = courts.length;\\n Court storage court = courts.push();\\n\\n for (uint256 i = 0; i < _supportedDisputeKits.length; i++) {\\n require(\\n _supportedDisputeKits[i] > 0 && _supportedDisputeKits[i] < disputeKitNodes.length,\\n \\\"Wrong DK index\\\"\\n );\\n court.supportedDisputeKits[_supportedDisputeKits[i]] = true;\\n }\\n\\n court.parent = _parent;\\n court.children = new uint256[](0);\\n court.hiddenVotes = _hiddenVotes;\\n court.minStake = _minStake;\\n court.alpha = _alpha;\\n court.feeForJuror = _feeForJuror;\\n court.jurorsForCourtJump = _jurorsForCourtJump;\\n court.timesPerPeriod = _timesPerPeriod;\\n\\n sortitionSumTrees.createTree(bytes32(courtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(courtID);\\n emit CourtCreated(\\n courtID,\\n _parent,\\n _hiddenVotes,\\n _minStake,\\n _alpha,\\n _feeForJuror,\\n _jurorsForCourtJump,\\n _timesPerPeriod,\\n _sortitionSumTreeK,\\n _supportedDisputeKits\\n );\\n }\\n\\n /** @dev Changes the `minStake` property value of a specified court. Don't set to a value lower than its parent's `minStake` property value.\\n * @param _courtID The ID of the court.\\n * @param _minStake The new value for the `minStake` property value.\\n */\\n function changeCourtMinStake(uint96 _courtID, uint256 _minStake) external onlyByGovernor {\\n require(\\n _courtID == GENERAL_COURT || courts[courts[_courtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_courtID].children.length; i++) {\\n require(courts[courts[_courtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_courtID].minStake = _minStake;\\n emit CourtModified(_courtID, \\\"minStake\\\");\\n }\\n\\n /** @dev Changes the `alpha` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _alpha The new value for the `alpha` property value.\\n */\\n function changeCourtAlpha(uint96 _courtID, uint256 _alpha) external onlyByGovernor {\\n courts[_courtID].alpha = _alpha;\\n emit CourtModified(_courtID, \\\"alpha\\\");\\n }\\n\\n /** @dev Changes the `feeForJuror` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n courts[_courtID].feeForJuror = _feeForJuror;\\n emit CourtModified(_courtID, \\\"feeForJuror\\\");\\n }\\n\\n /** @dev Changes the `jurorsForCourtJump` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value.\\n */\\n function changeCourtJurorsForJump(uint96 _courtID, uint256 _jurorsForCourtJump) external onlyByGovernor {\\n courts[_courtID].jurorsForCourtJump = _jurorsForCourtJump;\\n emit CourtModified(_courtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeCourtHiddenVotes(uint96 _courtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_courtID].hiddenVotes = _hiddenVotes;\\n emit CourtModified(_courtID, \\\"hiddenVotes\\\");\\n }\\n\\n /** @dev Changes the `timesPerPeriod` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _timesPerPeriod The new value for the `timesPerPeriod` property value.\\n */\\n function changeCourtTimesPerPeriod(uint96 _courtID, uint256[4] memory _timesPerPeriod) external onlyByGovernor {\\n courts[_courtID].timesPerPeriod = _timesPerPeriod;\\n emit CourtModified(_courtID, \\\"timesPerPeriod\\\");\\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 */\\n function enableDisputeKits(uint96 _courtID, uint256[] memory _disputeKitIDs, bool _enable) external onlyByGovernor {\\n Court storage court = courts[_courtID];\\n for (uint256 i = 0; i < _disputeKitIDs.length; i++) {\\n if (_enable) {\\n require(_disputeKitIDs[i] > 0 && _disputeKitIDs[i] < disputeKitNodes.length, \\\"Wrong DK index\\\");\\n enableDisputeKit(_courtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_courtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_courtID, _disputeKitIDs[i], false);\\n }\\n }\\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 _stake The new stake.\\n */\\n function setStake(uint96 _courtID, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _courtID, _stake, 0), \\\"Staking failed\\\");\\n }\\n\\n /** @dev Executes the next delayed stakes.\\n * @param _iterations The number of delayed stakes to execute.\\n */\\n function executeDelayedStakes(uint256 _iterations) external {\\n require(phase == Phase.staking, \\\"!Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.courtID, delayedStake.stake, delayedStake.penalty);\\n delete delayedStakes[i];\\n }\\n delayedStakeReadIndex = newDelayedStakeReadIndex;\\n }\\n\\n /** @dev Creates a dispute. Must be called by the arbitrable contract.\\n * @param _numberOfChoices Number of choices for the jurors to choose from.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes),\\n * the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).\\n * @return disputeID The ID of the created dispute.\\n */\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable override returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 courtID, , uint256 disputeKitID) = extraDataToCourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[courtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by court\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.courtID = courtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.courtID];\\n Round storage round = dispute.rounds.push();\\n round.nbVotes = msg.value / court.feeForJuror;\\n round.disputeKitID = disputeKitID;\\n round.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n round.totalFeesForJurors = msg.value;\\n\\n if (!disputeKitNodes[disputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[disputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(disputeKitID);\\n }\\n\\n disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n /** @dev Switches the phases between Staking and Freezing, also signal the switch to the dispute kits.\\n */\\n function passPhase() external {\\n if (phase == Phase.staking) {\\n require(block.timestamp - lastPhaseChange >= minStakingTime, \\\"MinStakingTime not passed\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"No DK needs freezing\\\");\\n phase = Phase.freezing;\\n freezeBlock = block.number;\\n } else {\\n // phase == Phase.freezing\\n bool timeout = this.freezingPhaseTimeout();\\n for (int256 i = int256(disputesKitIDsThatNeedFreezing.length) - 1; i >= 0; --i) {\\n uint256 disputeKitID = disputesKitIDsThatNeedFreezing[uint256(i)];\\n IDisputeKit disputeKit = disputeKitNodes[disputesKitIDsThatNeedFreezing[uint256(i)]].disputeKit;\\n if (timeout && !disputeKit.isResolving()) {\\n // Force the dispute kit to be ready for Staking phase.\\n disputeKit.passPhase(); // Should not be called if already in Resolving phase, because it reverts.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"Some DK not in Resolving phase\\\");\\n if (disputeKit.disputesWithoutJurors() == 0) {\\n // The dispute kit had time to finish drawing jurors for all its disputes.\\n disputeKitNodes[disputeKitID].needsFreezing = false;\\n if (i < int256(disputesKitIDsThatNeedFreezing.length) - 1) {\\n // This is not the last element so copy the last element to the current one, then pop.\\n disputesKitIDsThatNeedFreezing[uint256(i)] = disputesKitIDsThatNeedFreezing[\\n disputesKitIDsThatNeedFreezing.length - 1\\n ];\\n }\\n disputesKitIDsThatNeedFreezing.pop();\\n }\\n }\\n }\\n phase = Phase.staking;\\n }\\n // Should not be reached if the phase is unchanged.\\n lastPhaseChange = block.timestamp;\\n emit NewPhase(phase);\\n }\\n\\n /** @dev Passes the period of a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n */\\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 require(\\n currentRound > 0 ||\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Evidence not passed && !Appeal\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"Dispute still drawing\\\");\\n dispute.period = court.hiddenVotes ? Period.commit : Period.vote;\\n } else if (dispute.period == Period.commit) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID),\\n \\\"Commit period not passed\\\"\\n );\\n dispute.period = Period.vote;\\n } else if (dispute.period == Period.vote) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] ||\\n disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID),\\n \\\"Vote period not passed\\\"\\n );\\n dispute.period = Period.appeal;\\n emit AppealPossible(_disputeID, dispute.arbitrated);\\n } else if (dispute.period == Period.appeal) {\\n require(\\n block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)],\\n \\\"Appeal period not passed\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"Dispute period is final\\\");\\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 */\\n function draw(uint256 _disputeID, uint256 _iterations) external {\\n require(phase == Phase.freezing, \\\"Wrong phase\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n uint256 currentRound = dispute.rounds.length - 1;\\n Round storage round = dispute.rounds[currentRound];\\n require(dispute.period == Period.evidence, \\\"!Evidence period\\\");\\n\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n uint256 startIndex = round.drawnJurors.length;\\n uint256 endIndex = startIndex + _iterations <= round.nbVotes ? startIndex + _iterations : round.nbVotes;\\n\\n for (uint256 i = startIndex; i < endIndex; i++) {\\n address drawnAddress = disputeKit.draw(_disputeID);\\n if (drawnAddress != address(0)) {\\n // In case no one has staked at the court yet.\\n jurors[drawnAddress].lockedTokens[dispute.courtID] += round.tokensAtStakePerJuror;\\n emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length);\\n round.drawnJurors.push(drawnAddress);\\n }\\n }\\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 */\\n function appeal(uint256 _disputeID, uint256 _numberOfChoices, bytes memory _extraData) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"ETH too low for appeal cost\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute not appealable\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), \\\"Dispute Kit only\\\");\\n\\n uint96 newCourtID = dispute.courtID;\\n uint256 newDisputeKitID = round.disputeKitID;\\n\\n // Warning: the extra round must be created before calling disputeKit.createDispute()\\n Round storage extraRound = dispute.rounds.push();\\n\\n if (round.nbVotes >= courts[newCourtID].jurorsForCourtJump) {\\n // Jump to parent court.\\n newCourtID = courts[newCourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n break;\\n } else if (disputeKitNodes[newDisputeKitID].parent != NULL_DISPUTE_KIT) {\\n newDisputeKitID = disputeKitNodes[newDisputeKitID].parent;\\n } else {\\n // DK's parent has 0 index, that means we reached the root DK (0 depth level).\\n // Jump to the next parent court if the current court doesn't support any DK from this tree.\\n // Note that we don't reset newDisputeKitID in this case as, a precaution.\\n newCourtID = courts[newCourtID].parent;\\n }\\n }\\n // We didn't find a court that is compatible with DK from this tree, so we jump directly to the top court.\\n // Note that this can only happen when disputeKitID is at its root, and each root DK is supported by the top court by default.\\n if (!courts[newCourtID].supportedDisputeKits[newDisputeKitID]) {\\n newCourtID = GENERAL_COURT;\\n }\\n\\n if (newCourtID != dispute.courtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.courtID, newCourtID);\\n }\\n }\\n\\n dispute.courtID = newCourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newCourtID];\\n extraRound.nbVotes = msg.value / court.feeForJuror; // As many votes that can be afforded by the provided funds.\\n extraRound.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR;\\n extraRound.totalFeesForJurors = msg.value;\\n extraRound.disputeKitID = newDisputeKitID;\\n\\n if (!disputeKitNodes[newDisputeKitID].needsFreezing) {\\n // Ensures uniqueness in the disputesKitIDsThatNeedFreezing array.\\n disputeKitNodes[newDisputeKitID].needsFreezing = true;\\n disputesKitIDsThatNeedFreezing.push(newDisputeKitID);\\n }\\n\\n // Dispute kit was changed, so create a dispute in the new DK contract.\\n if (extraRound.disputeKitID != round.disputeKitID) {\\n emit DisputeKitJump(_disputeID, dispute.rounds.length - 1, round.disputeKitID, extraRound.disputeKitID);\\n disputeKitNodes[extraRound.disputeKitID].disputeKit.createDispute(\\n _disputeID,\\n _numberOfChoices,\\n _extraData,\\n extraRound.nbVotes\\n );\\n }\\n\\n emit AppealDecision(_disputeID, dispute.arbitrated);\\n emit NewPeriod(_disputeID, Period.evidence);\\n }\\n\\n /** @dev Distribute tokens and ETH for the specific round of the dispute. Can be called in parts.\\n * @param _disputeID The ID of the dispute.\\n * @param _round The appeal round.\\n * @param _iterations The number of iterations to run.\\n */\\n function execute(uint256 _disputeID, uint256 _round, uint256 _iterations) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n\\n Round storage round = dispute.rounds[_round];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n\\n uint256 end = round.repartitions + _iterations;\\n uint256 penaltiesInRoundCache = round.penalties; // For saving gas.\\n uint256 numberOfVotesInRound = round.drawnJurors.length;\\n uint256 coherentCount = disputeKit.getCoherentCount(_disputeID, _round); // Total number of jurors that are eligible to a reward in this round.\\n\\n address account; // Address of the juror.\\n uint256 degreeOfCoherence; // [0, 1] value that determines how coherent the juror was in this round, in basis points.\\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 penalties, and second to distribute them as rewards along with arbitration fees.\\n if (end > numberOfVotesInRound * 2) end = numberOfVotesInRound * 2;\\n }\\n\\n for (uint256 i = round.repartitions; i < end; i++) {\\n if (i < numberOfVotesInRound) {\\n // Penalty.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i);\\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 // Fully coherent jurors won't be penalized.\\n uint256 penalty = (round.tokensAtStakePerJuror * (ALPHA_DIVISOR - degreeOfCoherence)) / ALPHA_DIVISOR;\\n penaltiesInRoundCache += penalty;\\n\\n account = round.drawnJurors[i];\\n jurors[account].lockedTokens[dispute.courtID] -= penalty; // Release this part of locked tokens.\\n\\n // Can only update the stake if it is able to cover the minStake and penalty, otherwise unstake from the court.\\n if (jurors[account].stakedTokens[dispute.courtID] >= courts[dispute.courtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.courtID] - penalty;\\n setStakeForAccount(account, dispute.courtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.courtID] != 0) {\\n setStakeForAccount(account, dispute.courtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n uint96[] memory courtIDs = getJurorCourtIDs(account);\\n for (uint256 j = 0; j < courtIDs.length; j++) {\\n setStakeForAccount(account, courtIDs[j], 0, 0);\\n }\\n }\\n emit TokenAndETHShift(account, _disputeID, -int256(penalty), 0);\\n\\n if (i == numberOfVotesInRound - 1) {\\n if (coherentCount == 0) {\\n // No one was coherent. Send the rewards to governor.\\n payable(governor).send(round.totalFeesForJurors);\\n safeTransfer(governor, penaltiesInRoundCache);\\n }\\n }\\n } else {\\n // Reward.\\n degreeOfCoherence = disputeKit.getDegreeOfCoherence(_disputeID, _round, i % numberOfVotesInRound);\\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 account = round.drawnJurors[i % numberOfVotesInRound];\\n\\n // Release the rest of the tokens of the juror for this round.\\n jurors[account].lockedTokens[dispute.courtID] -=\\n (round.tokensAtStakePerJuror * degreeOfCoherence) /\\n ALPHA_DIVISOR;\\n\\n // Give back the locked tokens in case the juror fully unstaked earlier.\\n if (jurors[account].stakedTokens[dispute.courtID] == 0) {\\n uint256 tokenLocked = (round.tokensAtStakePerJuror * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenLocked);\\n }\\n\\n uint256 tokenReward = ((penaltiesInRoundCache / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n uint256 ethReward = ((round.totalFeesForJurors / coherentCount) * degreeOfCoherence) / ALPHA_DIVISOR;\\n safeTransfer(account, tokenReward);\\n payable(account).send(ethReward);\\n emit TokenAndETHShift(account, _disputeID, int256(tokenReward), int256(ethReward));\\n }\\n }\\n\\n if (round.penalties != penaltiesInRoundCache) {\\n round.penalties = penaltiesInRoundCache;\\n }\\n round.repartitions = end;\\n }\\n\\n /** @dev Executes a specified dispute's ruling. UNTRUSTED.\\n * @param _disputeID The ID of the dispute.\\n */\\n function executeRuling(uint256 _disputeID) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"!Execution period\\\");\\n require(!dispute.ruled, \\\"Ruling already executed\\\");\\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 Gets the cost of arbitration in a specified court.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the court to create the dispute in (first 32 bytes)\\n * and the minimum number of jurors required (next 32 bytes).\\n * @return cost The arbitration cost.\\n */\\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 Gets the cost of appealing a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n * @return cost The appeal cost.\\n */\\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 */\\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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool overridden) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n (ruling, tied, overridden) = disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(\\n uint256 _disputeID,\\n uint256 _round\\n )\\n external\\n view\\n returns (\\n uint256 tokensAtStakePerJuror,\\n uint256 totalFeesForJurors,\\n uint256 repartitions,\\n uint256 penalties,\\n address[] memory drawnJurors,\\n uint256 disputeKitID\\n )\\n {\\n Round storage round = disputes[_disputeID].rounds[_round];\\n return (\\n round.tokensAtStakePerJuror,\\n round.totalFeesForJurors,\\n round.repartitions,\\n round.penalties,\\n round.drawnJurors,\\n round.disputeKitID\\n );\\n }\\n\\n function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {\\n return disputes[_disputeID].rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _courtID) external view returns (uint256 staked, uint256 locked) {\\n staked = jurors[_juror].stakedTokens[_courtID];\\n locked = jurors[_juror].lockedTokens[_courtID];\\n }\\n\\n function isSupported(uint96 _courtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_courtID].supportedDisputeKits[_disputeKitID];\\n }\\n\\n /** @dev Gets non-primitive properties of a specified dispute kit node.\\n * @param _disputeKitID The ID of the dispute kit.\\n * @return children Indexes of children of this DK.\\n */\\n function getDisputeKitChildren(uint256 _disputeKitID) external view returns (uint256[] memory) {\\n return disputeKitNodes[_disputeKitID].children;\\n }\\n\\n /** @dev Gets the timesPerPeriod array for a given court.\\n * @param _courtID The ID of the court to get the times from.\\n * @return timesPerPeriod The timesPerPeriod array for the given court.\\n */\\n function getTimesPerPeriod(uint96 _courtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_courtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) external view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTree(\\n bytes32 _key,\\n uint256 _nodeIndex\\n ) public view returns (uint256 K, uint256 length, bytes32 ID) {\\n SortitionSumTreeFactoryV2.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n length = tree.nodes.length;\\n ID = tree.nodeIndexesToIDs[_nodeIndex];\\n }\\n\\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 function freezingPhaseTimeout() external view returns (bool) {\\n return phase == Phase.freezing && block.timestamp - lastPhaseChange >= maxFreezingTime;\\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 */\\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 getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n function getJurorCourtIDs(address _juror) public view returns (uint96[] memory) {\\n return jurors[_juror].courtIDs;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(uint96 _courtID, uint256 _disputeKitID, bool _enable) internal {\\n courts[_courtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_courtID, _disputeKitID, _enable);\\n }\\n\\n /** @dev Sets the specified juror's stake in a court.\\n * `O(n + p * log_k(j))` where\\n * `n` is the number of courts the juror has staked in,\\n * `p` is the depth of the court tree,\\n * `k` is the minimum number of children per node of one of these courts' sortition sum tree,\\n * and `j` is the maximum number of jurors that ever staked in one of these courts simultaneously.\\n * @param _account The address of the juror.\\n * @param _courtID The ID of the court.\\n * @param _stake The new stake.\\n * @param _penalty Penalized amount won't be transferred back to juror when the stake is lowered.\\n * @return succeeded True if the call succeeded, false otherwise.\\n */\\n function setStakeForAccount(\\n address _account,\\n uint96 _courtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_courtID == FORKING_COURT || _courtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndCourtIDToStakePathID(_account, _courtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_courtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_courtID].minStake || _stake < juror.lockedTokens[_courtID]) return false;\\n if (currentStake == 0 && juror.courtIDs.length >= MAX_STAKE_PATHS) return false;\\n }\\n\\n // Delayed action logic.\\n if (phase != Phase.staking) {\\n delayedStakes[++delayedStakeWriteIndex] = DelayedStake({\\n account: _account,\\n courtID: _courtID,\\n stake: _stake,\\n penalty: _penalty\\n });\\n return true;\\n }\\n\\n uint256 transferredAmount;\\n if (_stake >= currentStake) {\\n transferredAmount = _stake - currentStake;\\n if (transferredAmount > 0) {\\n if (safeTransferFrom(_account, address(this), transferredAmount)) {\\n if (currentStake == 0) {\\n juror.courtIDs.push(_courtID);\\n }\\n } else {\\n return false;\\n }\\n }\\n } else if (_stake == 0) {\\n // Keep locked tokens in the contract and release them after dispute is executed.\\n transferredAmount = currentStake - juror.lockedTokens[_courtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\n for (uint256 i = 0; i < juror.courtIDs.length; i++) {\\n if (juror.courtIDs[i] == _courtID) {\\n juror.courtIDs[i] = juror.courtIDs[juror.courtIDs.length - 1];\\n juror.courtIDs.pop();\\n break;\\n }\\n }\\n } else {\\n return false;\\n }\\n }\\n } else {\\n transferredAmount = currentStake - _stake - _penalty;\\n if (transferredAmount > 0) {\\n if (!safeTransfer(_account, transferredAmount)) {\\n return false;\\n }\\n }\\n }\\n\\n // Update juror's records.\\n uint256 newTotalStake = juror.stakedTokens[_courtID] - currentStake + _stake;\\n juror.stakedTokens[_courtID] = newTotalStake;\\n\\n // Update court parents.\\n bool finished = false;\\n uint256 currentCourtID = _courtID;\\n while (!finished) {\\n sortitionSumTrees.set(bytes32(currentCourtID), _stake, stakePathID);\\n if (currentCourtID == GENERAL_COURT) finished = true;\\n else currentCourtID = courts[currentCourtID].parent;\\n }\\n\\n emit StakeSet(_account, _courtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a court ID, the minimum number of jurors and an ID of a dispute kit from a specified extra data bytes array.\\n * Note that if extradata contains an incorrect value then this value will be switched to default.\\n * @param _extraData The extra data bytes array. The first 32 bytes are the court ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return courtID The court ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\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 = MIN_JURORS;\\n }\\n if (disputeKitID == NULL_DISPUTE_KIT || disputeKitID >= disputeKitNodes.length) {\\n disputeKitID = DISPUTE_KIT_CLASSIC; // 0 index is not used.\\n }\\n } else {\\n courtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a court ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _courtID The court ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndCourtIDToStakePathID(\\n address _account,\\n uint96 _courtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _courtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n\\n /** @dev Calls transfer() without reverting.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransfer(address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transfer.selector, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n\\n /** @dev Calls transferFrom() without reverting.\\n * @param _from Sender address.\\n * @param _to Recepient address.\\n * @param _value Amount transferred.\\n * @return Whether transfer succeeded or not.\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _value) internal returns (bool) {\\n (bool success, bytes memory data) = address(pinakion).call(\\n abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _value)\\n );\\n return (success && (data.length == 0 || abi.decode(data, (bool))));\\n }\\n}\\n\",\"keccak256\":\"0xdc9174289416383ba9118ddb377daaf4696a8431ef18e64ac1327f848edeba64\",\"license\":\"MIT\"},\"src/libraries/SortitionSumTreeFactoryV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactoryV2\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactoryV2 {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(SortitionSumTrees storage self, bytes32 _key, uint256 _K) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(SortitionSumTrees storage self, bytes32 _key, uint256 _value, bytes32 _ID) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n ) external view returns (uint256 startIndex, uint256[] memory values, bool hasMore) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x68d9aee384a067204cd8b1b68641fb50e28e38b6d8137877d7052011108f9c6b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526001600f553480156200001657600080fd5b50604051620066a0380380620066a08339810160408190526200003991620005d3565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c831690841617815560028054928c1692909316919091179091558651600355602080880151600455426005556008805490920182558183526040805160a08101825284815281518581528084019092529293918301915081526001600160a01b0389166020808301919091526000604083018190526060909201829052835460018181018655948352918190208351600490930201918255828101518051939492936200011193850192919091019062000458565b5060408281015160028301805460608601511515600160a01b026001600160a81b03199091166001600160a01b0393841617179055608090930151600390920191909155516000918816906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a4600780546001018155600090815260405163de0fe69d60e01b8152600c600482015260248101919091526044810182905273678E676fd0048da8c35d5B03fabB53a7beBf73A69063de0fe69d9060640160006040518083038186803b158015620001ed57600080fd5b505af415801562000202573d6000803e3d6000fd5b5050600780546001810182556000918252600b027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160601b0319168155604080518381526020810190915290935091505080516200027291600184019160209091019062000458565b50805460ff60601b19166c01000000000000000000000000861515021781558351600282015560208401516003820155604084015160048083019190915560608501516005830155620002cc9060068301908590620004a8565b5060405163de0fe69d60e01b8152600c6004820152600160248201526044810183905273678E676fd0048da8c35d5B03fabB53a7beBf73A69063de0fe69d9060640160006040518083038186803b1580156200032757600080fd5b505af41580156200033c573d6000803e3d6000fd5b5050825486516020808901516040808b015160608c0151825160008152948501928390526001600160601b039096169750600196507fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab1095620003a7958e959094938d918d91620006eb565b60405180910390a3620003bd60018080620003cd565b5050505050505050505062000790565b806007846001600160601b031681548110620003ed57620003ed620006d5565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b82805482825590600052602060002090810192821562000496579160200282015b828111156200049657825182559160200191906001019062000479565b50620004a4929150620004d8565b5090565b82600481019282156200049657916020028201828111156200049657825182559160200191906001019062000479565b5b80821115620004a45760008155600101620004d9565b6001600160a01b03811681146200050557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b038111828210171562000543576200054362000508565b60405290565b805180151581146200055a57600080fd5b919050565b600082601f8301126200057157600080fd5b604051608081016001600160401b038111828210171562000596576200059662000508565b604052806080840185811115620005ac57600080fd5b845b81811015620005c8578051835260209283019201620005ae565b509195945050505050565b60008060008060008060008060006102008a8c031215620005f357600080fd5b89516200060081620004ef565b809950506020808b01516200061581620004ef565b60408c01519099506200062881620004ef565b60608c01519098506200063b81620004ef565b9650609f8b018c136200064d57600080fd5b620006576200051e565b8060c08d018e8111156200066a57600080fd5b60808e015b818110156200068857805184529284019284016200066f565b50819850620006978162000549565b975050505050620006ac8b60e08c016200055f565b9250620006be8b6101608c016200055f565b91506101e08a015190509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b60006101608083018b1515845260208b818601528a604086015289606086015288608086015260a085018860005b6004811015620007385781518352918301919083019060010162000719565b50505061012085018790526101408501929092528451908190526101808401918086019160005b818110156200077d578351855293820193928201926001016200075f565b50929d9c50505050505050505050505050565b615f0080620007a06000396000f3fe60806040526004361061034d5760003560e01c8063840bc19c116101bd578063c057eca7116100f8578063d8b03fd81161009b578063d8b03fd814610b5b578063e4c0aaf414610b70578063eaff425a14610b90578063f12ada8b14610ba5578063f6b4d82d14610bc5578063f7434ea914610c4e578063fbf405b014610c6e578063fc6f8f1614610c8e578063fe524c3914610cae57600080fd5b8063c057eca714610a41578063c13517e114610a57578063c258bb1914610a6a578063c356990214610a8a578063c71f425314610a9d578063cf0c38f814610abd578063d1c1df4814610add578063d2b8035a14610b3b57600080fd5b8063b1c9fe6e11610160578063b1c9fe6e14610919578063b2866af714610947578063b31b454014610967578063b39367ed1461097d578063b4a616081461099d578063b70c4e94146109b2578063b888adfa146109c7578063bfabfe8f146109dd57600080fd5b8063840bc19c146107f75780638a73a4dd146108125780638a9bb02a146108325780638bb04875146108645780638edf4741146108845780639280169a146108a4578063a4370ce4146108c4578063afe15cfb146108e457600080fd5b806335975f4a1161028d57806359ec827e1161023057806359ec827e1461070d5780636235593f1461072d57806367c51947146107425780636c1eb1b9146107625780636e5f35c214610777578063751accd0146107975780637717a6e8146107b7578063823cfd70146107d757600080fd5b806335975f4a146105e95780633a157860146106095780633cfd11841461061f57806343d4137f1461064c57806344c792e714610679578063543f8a3614610699578063564a565d146106c657806356acb050146106f757600080fd5b806319b81529116102f557806319b815291461048d5780631c3db16d146104bd5780631f5a0dd2146104fa57806327e6ec8a146105515780632922d6041461057e5780632d29a47b1461059e5780632ea7b4d0146105be57806334d5fb31146105d457600080fd5b8062f5822c146103525780630b274f2e146103745780630b7414bc146103895780630c340a24146103a95780630d1b9d1a146103e65780630d83b940146104345780630e083ec914610457578063115d53761461046d575b600080fd5b34801561035e57600080fd5b5061037261036d3660046153bc565b610cce565b005b34801561038057600080fd5b50610372610d23565b34801561039557600080fd5b506103726103a43660046154cf565b6112ab565b3480156103b557600080fd5b506000546103c9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f257600080fd5b50610406610401366004615530565b611481565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016103dd565b34801561044057600080fd5b50610449600181565b6040519081526020016103dd565b34801561046357600080fd5b50610449600e5481565b34801561047957600080fd5b50610372610488366004615530565b6114ca565b34801561049957600080fd5b506104ad6104a8366004615530565b611b24565b60405190151581526020016103dd565b3480156104c957600080fd5b506104dd6104d8366004615530565b611c1b565b6040805193845291151560208401521515908201526060016103dd565b34801561050657600080fd5b5061051a610515366004615530565b611d30565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016103dd565b34801561055d57600080fd5b50610566600081565b6040516001600160601b0390911681526020016103dd565b34801561058a57600080fd5b50610449610599366004615549565b611d87565b3480156105aa57600080fd5b506103726105b936600461556b565b611dbe565b3480156105ca57600080fd5b5061044961271081565b3480156105e057600080fd5b50610566600181565b3480156105f557600080fd5b50610372610604366004615530565b612601565b34801561061557600080fd5b5061044960065481565b34801561062b57600080fd5b5061063f61063a366004615597565b61273e565b6040516103dd91906155d5565b34801561065857600080fd5b5061066c610667366004615530565b6127af565b6040516103dd919061561e565b34801561068557600080fd5b50610372610694366004615631565b61282b565b3480156106a557600080fd5b506106b96106b43660046153bc565b6128eb565b6040516103dd9190615668565b3480156106d257600080fd5b506106e66106e1366004615530565b612987565b6040516103dd9594939291906156df565b34801561070357600080fd5b50610449600f5481565b34801561071957600080fd5b50610449610728366004615530565b6129e3565b34801561073957600080fd5b50610449600081565b34801561074e57600080fd5b5061037261075d36600461571e565b612b36565b34801561076e57600080fd5b50610449600a81565b34801561078357600080fd5b5061037261079236600461571e565b612bd7565b3480156107a357600080fd5b506103726107b23660046157b7565b612ddd565b3480156107c357600080fd5b506103726107d236600461571e565b612eaf565b3480156107e357600080fd5b506103726107f2366004615530565b612efd565b34801561080357600080fd5b506104496001600160ff1b0381565b34801561081e57600080fd5b5061037261082d36600461587c565b612f2c565b34801561083e57600080fd5b5061085261084d366004615549565b6132c4565b6040516103dd9695949392919061591f565b34801561087057600080fd5b5061037261087f366004615530565b6133a4565b34801561089057600080fd5b5061044961089f366004615530565b613530565b3480156108b057600080fd5b506103726108bf36600461571e565b613551565b3480156108d057600080fd5b506103726108df36600461571e565b6135ec565b3480156108f057600080fd5b506109046108ff366004615530565b613694565b604080519283526020830191909152016103dd565b34801561092557600080fd5b5060025461093a90600160a01b900460ff1681565b6040516103dd9190615994565b34801561095357600080fd5b50610372610962366004615530565b613741565b34801561097357600080fd5b5061044960045481565b34801561098957600080fd5b506103726109983660046159ae565b613770565b3480156109a957600080fd5b50610449600481565b3480156109be57600080fd5b506104ad61381f565b3480156109d357600080fd5b5061044960055481565b3480156109e957600080fd5b50610a266109f8366004615549565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b604080519384526020840192909252908201526060016103dd565b348015610a4d57600080fd5b5061044960035481565b610449610a653660046159e2565b613861565b348015610a7657600080fd5b50610372610a853660046153bc565b613bdd565b610372610a98366004615a28565b613c29565b348015610aa957600080fd5b50610449610ab8366004615530565b6142a7565b348015610ac957600080fd5b506002546103c9906001600160a01b031681565b348015610ae957600080fd5b50610904610af8366004615a61565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b4757600080fd5b50610372610b56366004615549565b61430f565b348015610b6757600080fd5b5061066c614610565b348015610b7c57600080fd5b50610372610b8b3660046153bc565b614668565b348015610b9c57600080fd5b50610449600381565b348015610bb157600080fd5b50610372610bc0366004615a8d565b6146b4565b348015610bd157600080fd5b50610c1c610be0366004615530565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016103dd565b348015610c5a57600080fd5b50610449610c69366004615aab565b61490d565b348015610c7a57600080fd5b506001546103c9906001600160a01b031681565b348015610c9a57600080fd5b50610449610ca9366004615530565b614961565b348015610cba57600080fd5b506104ad610cc936600461571e565b614990565b6000546001600160a01b03163314610d015760405162461bcd60e51b8152600401610cf890615adf565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610d4357610d436156b5565b1415610e0557600354600554610d599042615b1c565b1015610da35760405162461bcd60e51b8152602060048201526019602482015278135a5b94dd185ada5b99d51a5b59481b9bdd081c185cdcd959603a1b6044820152606401610cf8565b600954610de95760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610cf8565b6002805460ff60a01b1916600160a01b17905543600655611260565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190615b33565b600954909150600090610e8d90600190615b50565b90505b6000811261125057600060098281548110610ead57610ead615b8f565b906000526020600020015490506000600860098481548110610ed157610ed1615b8f565b906000526020600020015481548110610eec57610eec615b8f565b60009182526020909120600260049092020101546001600160a01b03169050838015610f865750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4c57600080fd5b505afa158015610f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f849190615b33565b155b1561107057806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc657600080fd5b505af1158015610fda573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104f9190615b33565b61106b5760405162461bcd60e51b8152600401610cf890615ba5565b61123d565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e19190615b33565b6110fd5760405162461bcd60e51b8152600401610cf890615ba5565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561113657600080fd5b505afa15801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190615bdc565b61123d5760006008838154811061118757611187615b8f565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b199092169190911790556009546111c390600190615b50565b83121561121557600980546111da90600190615b1c565b815481106111ea576111ea615b8f565b90600052602060002001546009848154811061120857611208615b8f565b6000918252602090912001555b600980548061122657611226615bf5565b600190038181906000526020600020016000905590555b50508061124990615c0b565b9050610e90565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b93916112a191600160a01b90910460ff1690615994565b60405180910390a1565b6000546001600160a01b031633146112d55760405162461bcd60e51b8152600401610cf890615adf565b60006007846001600160601b0316815481106112f3576112f3615b8f565b90600052602060002090600b0201905060005b835181101561147a5782156113a057600084828151811061132957611329615b8f565b602002602001015111801561135a5750600854845185908390811061135057611350615b8f565b6020026020010151105b6113765760405162461bcd60e51b8152600401610cf890615c29565b61139b8585838151811061138c5761138c615b8f565b602002602001015160016149d8565b611468565b6001600160601b03851660011480156113f65750600060088583815181106113ca576113ca615b8f565b6020026020010151815481106113e2576113e2615b8f565b906000526020600020906004020160000154145b156114435760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610cf8565b6114688585838151811061145957611459615b8f565b602002602001015160006149d8565b8061147281615c51565b915050611306565b5050505050565b6008818154811061149157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106114df576114df615b8f565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061151257611512615b8f565b6000918252602082206003850154600b90920201925061153490600190615b1c565b9050600083600301828154811061154d5761154d615b8f565b6000918252602082206007909102019150600185015460ff166004811115611577576115776156b5565b14156116aa5760008211806115c957506001840154600684019060ff1660048111156115a5576115a56156b5565b600481106115b5576115b5615b8f565b015460028501546115c69042615b1c565b10155b6116155760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610cf8565b60038101546006820154146116645760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610cf8565b8254600160601b900460ff1661167b57600261167e565b60015b60018086018054909160ff19909116908360048111156116a0576116a06156b5565b0217905550611ad6565b60018085015460ff1660048111156116c4576116c46156b5565b1415611810576001840154600684019060ff1660048111156116e8576116e86156b5565b600481106116f8576116f8615b8f565b015460028501546117099042615b1c565b1015806117b25750600881600001548154811061172857611728615b8f565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b29190615b33565b6117f95760405162461bcd60e51b815260206004820152601860248201527710dbdb5b5a5d081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460029260ff1990911690836116a0565b6002600185015460ff16600481111561182b5761182b6156b5565b14156119b3576001840154600684019060ff16600481111561184f5761184f6156b5565b6004811061185f5761185f615b8f565b015460028501546118709042615b1c565b1015806119195750600881600001548154811061188f5761188f615b8f565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156118e157600080fd5b505afa1580156118f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119199190615b33565b61195e5760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610cf8565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611ad6565b6003600185015460ff1660048111156119ce576119ce6156b5565b1415611a73576001840154600684019060ff1660048111156119f2576119f26156b5565b60048110611a0257611a02615b8f565b01546002850154611a139042615b1c565b1015611a5c5760405162461bcd60e51b8152602060048201526018602482015277105c1c19585b081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460049260ff1990911690836116a0565b6004600185015460ff166004811115611a8e57611a8e6156b5565b1415611ad65760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d19481c195c9a5bd9081a5cc8199a5b985b604a1b6044820152606401610cf8565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611b159160ff1690615c6c565b60405180910390a25050505050565b600080600a8381548110611b3a57611b3a615b8f565b6000918252602082206003600490920201908101805491935090611b6090600190615b1c565b81548110611b7057611b70615b8f565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ba357611ba3615b8f565b90600052602060002090600b02019050806005015482600301541015611bce57506000949350505050565b80546007805490916001600160601b0316908110611bee57611bee615b8f565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600080600a8581548110611c3457611c34615b8f565b6000918252602082206003600490920201908101805491935090611c5a90600190615b1c565b81548110611c6a57611c6a615b8f565b9060005260206000209060070201905060006008826000015481548110611c9357611c93615b8f565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018990526001600160a01b031691508190631c3db16d9060240160606040518083038186803b158015611ce857600080fd5b505afa158015611cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d209190615c7a565b9199909850909650945050505050565b60078181548110611d4057600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611daa57611daa615b8f565b906000526020600020015490505b92915050565b6000600a8481548110611dd357611dd3615b8f565b600091825260209091206004918202019150600182015460ff166004811115611dfe57611dfe6156b5565b14611e1b5760405162461bcd60e51b8152600401610cf890615cb2565b6000816003018481548110611e3257611e32615b8f565b9060005260206000209060070201905060006008826000015481548110611e5b57611e5b615b8f565b60009182526020822060049182020160020154908401546001600160a01b039091169250611e8a908690615cdd565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b158015611ee357600080fd5b505afa158015611ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1b9190615bdc565b905060008082611f365783861115611f31578395505b611f56565b611f41846002615cf5565b861115611f5657611f53846002615cf5565b95505b60048801545b868110156125db578481101561235057604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b158015611fba57600080fd5b505afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190615bdc565b91506127108211156120045761271091505b60006127106120138482615b1c565b8b600101546120229190615cf5565b61202c9190615d2a565b90506120388188615cdd565b965089600601828154811061204f5761204f615b8f565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b0316855260020190925290822080549196508392909161209c908490615b1c565b90915550508a546007805483926001600160601b03169081106120c1576120c1615b8f565b90600052602060002090600b0201600201546120dd9190615cdd565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612171576001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915281205461214f908390615b1c565b8c5490915061216a9086906001600160601b03168385614a60565b50506121c2565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152902054156121c2578a546121c09085906001600160601b0316600084614a60565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b15801561221057600080fd5b505afa158015612224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122489190615b33565b6122a1576000612257856128eb565b905060005b815181101561229e5761228b8683838151811061227b5761227b615b8f565b6020026020010151600080614a60565b508061229681615c51565b91505061225c565b50505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196122d684615d3e565b60408051918252600060208301520160405180910390a36122f8600187615b1c565b82141561234a578461234a576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461234893506001600160a01b0316915089905061507a565b505b506125c9565b6001600160a01b038816634fe264fb8e8e61236b8986615d5b565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156123af57600080fd5b505afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190615bdc565b91506127108211156123f95761271091505b600689016124078683615d5b565b8154811061241757612417615b8f565b60009182526020909120015460018a01546001600160a01b03909116935061271090612444908490615cf5565b61244e9190615d2a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526002019091528120805490919061248e908490615b1c565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b031684526001019091529020546124f6576000612710838b600101546124dd9190615cf5565b6124e79190615d2a565b90506124f3848261507a565b50505b600061271083612506878a615d2a565b6125109190615cf5565b61251a9190615d2a565b9050600061271084878d600201546125329190615d2a565b61253c9190615cf5565b6125469190615d2a565b9050612552858361507a565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e1984846040516125be929190918252602082015260400190565b60405180910390a350505b806125d381615c51565b915050611f5c565b50848860050154146125ef57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612621576126216156b5565b146126605760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610cf8565b6000600e54600183600f546126759190615cdd565b61267f9190615b1c565b1161268a57816126a5565b600f54600e5461269a9190615b1c565b6126a5906001615cdd565b9050600081600f546126b79190615cdd565b600f549091505b81811015612736576000818152600d60205260409020805460018201546002830154612706926001600160a01b03811692600160a01b9091046001600160601b031691614a60565b50506000818152600d6020526040812081815560018101829055600201558061272e81615c51565b9150506126be565b50600f555050565b6127466152f9565b60006007836001600160601b03168154811061276457612764615b8f565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b81548152602001906001019080831161278f575050505050915050919050565b6060600882815481106127c4576127c4615b8f565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561281f57602002820191906000526020600020905b81548152602001906001019080831161280b575b50505050509050919050565b6000546001600160a01b031633146128555760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061287257612872615b8f565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b60405180910390a25050565b6001600160a01b0381166000908152600b602090815260409182902080548351818402810184019094528084526060939283018282801561281f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b0104928301926001038202915080841161293a575094979650505050505050565b600a818154811061299757600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600a83815481106129f9576129f9615b8f565b6000918252602082206003600490920201908101805491935090612a1f90600190615b1c565b81548110612a2f57612a2f615b8f565b600091825260208220845460078054938102909201945090916001600160601b03909116908110612a6257612a62615b8f565b90600052602060002090600b020190508060050154826003015410612b015782546001600160601b031660011415612aa3576001600160ff1b039350612b2e565b6003820154612ab3906002615cf5565b612abe906001615cdd565b81546007805490916001600160601b0316908110612ade57612ade615b8f565b90600052602060002090600b020160040154612afa9190615cf5565b9350612b2e565b6003820154612b11906002615cf5565b612b1c906001615cdd565b8160040154612b2b9190615cf5565b93505b505050919050565b6000546001600160a01b03163314612b605760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b031681548110612b7d57612b7d615b8f565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b6000546001600160a01b03163314612c015760405162461bcd60e51b8152600401610cf890615adf565b6001600160601b03821660011480612c74575080600780846001600160601b031681548110612c3257612c32615b8f565b60009182526020909120600b909102015481546001600160601b03909116908110612c5f57612c5f615b8f565b90600052602060002090600b02016002015411155b612c905760405162461bcd60e51b8152600401610cf890615d6f565b60005b6007836001600160601b031681548110612caf57612caf615b8f565b90600052602060002090600b020160010180549050811015612d685781600780856001600160601b031681548110612ce957612ce9615b8f565b90600052602060002090600b02016001018381548110612d0b57612d0b615b8f565b906000526020600020015481548110612d2657612d26615b8f565b90600052602060002090600b0201600201541015612d565760405162461bcd60e51b8152600401610cf890615d6f565b80612d6081615c51565b915050612c93565b50806007836001600160601b031681548110612d8657612d86615b8f565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600890820152676d696e5374616b6560c01b604082015260600190565b6000546001600160a01b03163314612e075760405162461bcd60e51b8152600401610cf890615adf565b6000836001600160a01b03168383604051612e229190615dd0565b60006040518083038185875af1925050503d8060008114612e5f576040519150601f19603f3d011682016040523d82523d6000602084013e612e64565b606091505b5050905080612ea95760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cf8565b50505050565b612ebc3383836000614a60565b612ef95760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610cf8565b5050565b6000546001600160a01b03163314612f275760405162461bcd60e51b8152600401610cf890615adf565b600355565b6000546001600160a01b03163314612f565760405162461bcd60e51b8152600401610cf890615adf565b8660078a6001600160601b031681548110612f7357612f73615b8f565b90600052602060002090600b0201600201541115612fa35760405162461bcd60e51b8152600401610cf890615d6f565b6000815111612fe45760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610cf8565b6001600160601b03891661303a5760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610cf8565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561313657600084828151811061308f5761308f615b8f565b60200260200101511180156130c0575060085484518590839081106130b6576130b6615b8f565b6020026020010151105b6130dc5760405162461bcd60e51b8152600401610cf890615c29565b600182600a0160008684815181106130f6576130f6615b8f565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550808061312e90615c51565b915050613072565b5080546001600160601b0319166001600160601b038c16178155604080516000815260208101918290525161316f916001840191615317565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556131b29060068301908790615362565b5060405163de0fe69d60e01b8152600c6004820152602481018390526044810185905273678E676fd0048da8c35d5B03fabB53a7beBf73A69063de0fe69d9060640160006040518083038186803b15801561320c57600080fd5b505af4158015613220573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061324057613240615b8f565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab10906132af908e908e908e908e908e908e908e908e90615dec565b60405180910390a35050505050505050505050565b6000806000806060600080600a89815481106132e2576132e2615b8f565b9060005260206000209060040201600301888154811061330457613304615b8f565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561338657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613368575b50505050509150965096509650965096509650509295509295509295565b6000600a82815481106133b9576133b9615b8f565b600091825260209091206004918202019150600182015460ff1660048111156133e4576133e46156b5565b146134015760405162461bcd60e51b8152600401610cf890615cb2565b6001810154610100900460ff16156134555760405162461bcd60e51b8152602060048201526017602482015276149d5b1a5b99c8185b1c9958591e48195e1958dd5d1959604a1b6044820152606401610cf8565b600061346083611c1b565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561351357600080fd5b505af1158015613527573d6000803e3d6000fd5b50505050505050565b6009818154811061354057600080fd5b600091825260209091200154905081565b6000546001600160a01b0316331461357b5760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061359857613598615b8f565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615eab8339815191526040516128df90602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146136165760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061363357613633615b8f565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615eab8339815191526040516128df9060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a84815481106136ac576136ac615b8f565b6000918252602090912060049091020190506003600182015460ff1660048111156136d9576136d96156b5565b1415613732576002810154815460078054929550916001600160601b0390911690811061370857613708615b8f565b600091825260209091206009600b909202010154600282015461372b9190615cdd565b915061373b565b60009250600091505b50915091565b6000546001600160a01b0316331461376b5760405162461bcd60e51b8152600401610cf890615adf565b600455565b6000546001600160a01b0316331461379a5760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b0316815481106137b7576137b7615b8f565b90600052602060002090600b02016006019060046137d6929190615362565b50816001600160601b0316600080516020615eab8339815191526040516128df906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b60006001600254600160a01b900460ff166001811115613841576138416156b5565b14801561385c57506004546005546138599042615b1c565b10155b905090565b600061386c8261490d565b3410156138bb5760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610cf8565b6000806138c78461514f565b92505091506007826001600160601b0316815481106138e8576138e8615b8f565b60009182526020808320848452600a600b90930201919091019052604090205460ff166139515760405162461bcd60e51b81526020600482015260176024820152761112c81d5b9cdd5c1c1bdc9d195908189e4818dbdd5c9d604a1b6044820152606401610cf8565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa9091015560088054929650909291849081106139dc576139dc615b8f565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613a1d57613a1d615b8f565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613a5c9034615d2a565b600380830191909155858255820154600283015461271091613a7d91615cf5565b613a879190615d2a565b60018201553460028201556008805486908110613aa657613aa6615b8f565b906000526020600020906004020160020160149054906101000a900460ff16613b3d57600160088681548110613ade57613ade615b8f565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613b72918b918e918e91600401615e44565b600060405180830381600087803b158015613b8c57600080fd5b505af1158015613ba0573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613c075760405162461bcd60e51b8152600401610cf890615adf565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613c32836129e3565b341015613c815760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610cf8565b6000600a8481548110613c9657613c96615b8f565b6000918252602090912060049091020190506003600182015460ff166004811115613cc357613cc36156b5565b14613d095760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610cf8565b60038101805460009190613d1f90600190615b1c565b81548110613d2f57613d2f615b8f565b906000526020600020906007020190506008816000015481548110613d5657613d56615b8f565b60009182526020909120600490910201600201546001600160a01b03163314613db45760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610cf8565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019184908110613df557613df5615b8f565b90600052602060002090600b020160050154846003015410613ff9576007836001600160601b031681548110613e2d57613e2d615b8f565b600091825260208220600b90910201546001600160601b031693505b600a811015613f3e576007846001600160601b031681548110613e6e57613e6e615b8f565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613e9b57613f3e565b600060088481548110613eb057613eb0615b8f565b90600052602060002090600402016000015414613ef35760088381548110613eda57613eda615b8f565b9060005260206000209060040201600001549250613f2c565b6007846001600160601b031681548110613f0f57613f0f615b8f565b60009182526020909120600b90910201546001600160601b031693505b80613f3681615c51565b915050613e49565b506007836001600160601b031681548110613f5b57613f5b615b8f565b60009182526020808320858452600a600b90930201919091019052604090205460ff16613f8757600192505b84546001600160601b03848116911614613ff957845460038601546001600160601b0390911690613fba90600190615b1c565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061403c5761403c615b8f565b90600052602060002090600b0201905080600401543461405c9190615d2a565b82600301819055506127108160030154826002015461407b9190615cf5565b6140859190615d2a565b600183015534600283015582825560088054849081106140a7576140a7615b8f565b906000526020600020906004020160020160149054906101000a900460ff1661413e576001600884815481106140df576140df615b8f565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614224578454600387015461415a90600190615b1c565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106141a8576141a8615b8f565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede540926141f1928e928e928e929101615e44565b600060405180830381600087803b15801561420b57600080fd5b505af115801561421f573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516142949190615c6c565b60405180910390a2505050505050505050565b600080600a83815481106142bd576142bd615b8f565b9060005260206000209060040201905080600301600182600301805490506142e59190615b1c565b815481106142f5576142f5615b8f565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561432f5761432f6156b5565b1461436a5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610cf8565b6000600a838154811061437f5761437f615b8f565b906000526020600020906004020190506000600182600301805490506143a59190615b1c565b905060008260030182815481106143be576143be615b8f565b6000918252602082206007909102019150600184015460ff1660048111156143e8576143e86156b5565b146144285760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610cf8565b6000600882600001548154811061444157614441615b8f565b60009182526020822060026004909202010154600684015460038501546001600160a01b03909216935091906144778884615cdd565b1115614487578360030154614491565b6144918783615cdd565b9050815b8181101561460557604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b1580156144e257600080fd5b505af11580156144f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061451a9190615e8d565b90506001600160a01b038116156145f25760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614570908490615cdd565b909155505060068601546040805189815260208101929092528b916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a3600686018054600181018255600091825260209091200180546001600160a01b0319166001600160a01b0383161790555b50806145fd81615c51565b915050614495565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561465e57602002820191906000526020600020905b81548152602001906001019080831161464a575b5050505050905090565b6000546001600160a01b031633146146925760405162461bcd60e51b8152600401610cf890615adf565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146146de5760405162461bcd60e51b8152600401610cf890615adf565b60085480821061471a5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610cf8565b60008215614797576008838154811061473557614735615b8f565b90600052602060002090600402016003015460016147539190615cdd565b9050600a81106147975760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610cf8565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381019182559151805193949193614849937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee401929190910190615317565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106148a3576148a3615b8f565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482612ea957612ea960018360016149d8565b600080600061491b8461514f565b5091509150806007836001600160601b03168154811061493d5761493d615b8f565b90600052602060002090600b0201600401546149599190615cf5565b949350505050565b6000600a828154811061497657614976615b8f565b600091825260209091206003600490920201015492915050565b60006007836001600160601b0316815481106149ae576149ae615b8f565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b0316815481106149f5576149f5615b8f565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614a8257506007546001600160601b038516115b15614a8f57506000614959565b6001600160a01b0385166000908152600b6020526040812090614ab287876151d3565b604051630b8ea8ad60e41b8152600c60048201526001600160601b03881660248201526044810182905290915060009073678E676fd0048da8c35d5B03fabB53a7beBf73A69063b8ea8ad09060640160206040518083038186803b158015614b1957600080fd5b505af4158015614b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b519190615bdc565b90508515614bdf576007876001600160601b031681548110614b7557614b75615b8f565b90600052602060002090600b020160020154861080614bad57506001600160601b038716600090815260028401602052604090205486105b15614bbe5760009350505050614959565b80158015614bce57508254600411155b15614bdf5760009350505050614959565b6000600254600160a01b900460ff166001811115614bff57614bff6156b5565b14614cab576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614c4a90615c51565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061495992505050565b6000818710614d2857614cbe8288615b1c565b90508015614d1657614cd189308361521b565b15614d1b5781614d16578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b614efd565b6000945050505050614959565b86614ec5576001600160601b03881660009081526002850160205260409020548690614d549084615b1c565b614d5e9190615b1c565b90508015614d1657614d70898261507a565b15614d1b5760005b8454811015614ebf57886001600160601b0316856000018281548110614da057614da0615b8f565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415614ead5784548590614ddd90600190615b1c565b81548110614ded57614ded615b8f565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614e2b57614e2b615b8f565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480614e7757614e77615bf5565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055614ebf565b80614eb781615c51565b915050614d78565b50614efd565b85614ed08884615b1c565b614eda9190615b1c565b90508015614efd57614eec898261507a565b614efd576000945050505050614959565b6001600160601b03881660009081526001850160205260408120548890614f25908590615b1c565b614f2f9190615cdd565b6001600160601b038a16600081815260018801602052604081208390559192505b81615013576040516314955f6d60e21b8152600c600482015260248101829052604481018b90526064810187905273678E676fd0048da8c35d5B03fabB53a7beBf73A6906352557db49060840160006040518083038186803b158015614fb557600080fd5b505af4158015614fc9573d6000803e3d6000fd5b505050506001811415614fdf5760019150614f50565b60078181548110614ff257614ff2615b8f565b60009182526020909120600b90910201546001600160601b03169050614f50565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916150da9190615dd0565b6000604051808303816000865af19150503d8060008114615117576040519150601f19603f3d011682016040523d82523d6000602084013e61511c565b606091505b50915091508180156151465750805115806151465750808060200190518101906151469190615b33565b95945050505050565b600080600060408451106151c1575050506020810151604082015160608301516001600160601b038316158061519057506007546001600160601b03841610155b1561519a57600192505b816151a457600391505b8015806151b357506008548110155b156151bc575060015b6151cc565b506001915060039050815b9193909250565b600060405160005b60148110156151f6578481600c011a818301536001016151db565b5060145b60208110156152125783811a818301536001016151fa565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916152839190615dd0565b6000604051808303816000865af19150503d80600081146152c0576040519150601f19603f3d011682016040523d82523d6000602084013e6152c5565b606091505b50915091508180156152ef5750805115806152ef5750808060200190518101906152ef9190615b33565b9695505050505050565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215615352579160200282015b82811115615352578251825591602001919060010190615337565b5061535e92915061538f565b5090565b82600481019282156153525791602002820182811115615352578251825591602001919060010190615337565b5b8082111561535e5760008155600101615390565b6001600160a01b03811681146153b957600080fd5b50565b6000602082840312156153ce57600080fd5b81356153d9816153a4565b9392505050565b80356001600160601b03811681146153f757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561543a5761543a6153fc565b604052919050565b600082601f83011261545357600080fd5b813560206001600160401b0382111561546e5761546e6153fc565b8160051b61547d828201615412565b928352848101820192828101908785111561549757600080fd5b83870192505b848310156154b65782358252918301919083019061549d565b979650505050505050565b80151581146153b957600080fd5b6000806000606084860312156154e457600080fd5b6154ed846153e0565b925060208401356001600160401b0381111561550857600080fd5b61551486828701615442565b9250506040840135615525816154c1565b809150509250925092565b60006020828403121561554257600080fd5b5035919050565b6000806040838503121561555c57600080fd5b50508035926020909101359150565b60008060006060848603121561558057600080fd5b505081359360208301359350604090920135919050565b6000602082840312156155a957600080fd5b6153d9826153e0565b8060005b6004811015612ea95781518452602093840193909101906001016155b6565b60808101611db882846155b2565b600081518084526020808501945080840160005b83811015615613578151875295820195908201906001016155f7565b509495945050505050565b6020815260006153d960208301846155e3565b6000806040838503121561564457600080fd5b61564d836153e0565b9150602083013561565d816154c1565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156156a95783516001600160601b031683529284019291840191600101615684565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106156db576156db6156b5565b9052565b6001600160601b03861681526001600160a01b038516602082015260a0810161570b60408301866156cb565b9215156060820152608001529392505050565b6000806040838503121561573157600080fd5b61573a836153e0565b946020939093013593505050565b600082601f83011261575957600080fd5b81356001600160401b03811115615772576157726153fc565b615785601f8201601f1916602001615412565b81815284602083860101111561579a57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156157cc57600080fd5b83356157d7816153a4565b92506020840135915060408401356001600160401b038111156157f957600080fd5b61580586828701615748565b9150509250925092565b600082601f83011261582057600080fd5b604051608081018181106001600160401b0382111715615842576158426153fc565b60405280608084018581111561585757600080fd5b845b81811015615871578035835260209283019201615859565b509195945050505050565b60008060008060008060008060006101808a8c03121561589b57600080fd5b6158a48a6153e0565b985060208a01356158b4816154c1565b975060408a0135965060608a0135955060808a0135945060a08a013593506158df8b60c08c0161580f565b92506101408a013591506101608a01356001600160401b0381111561590357600080fd5b61590f8c828d01615442565b9150509295985092959850929598565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b8181101561597b5784516001600160a01b031683529383019391830191600101615956565b50508093505050508260a0830152979650505050505050565b60208101600283106159a8576159a86156b5565b91905290565b60008060a083850312156159c157600080fd5b6159ca836153e0565b91506159d9846020850161580f565b90509250929050565b600080604083850312156159f557600080fd5b8235915060208301356001600160401b03811115615a1257600080fd5b615a1e85828601615748565b9150509250929050565b600080600060608486031215615a3d57600080fd5b833592506020840135915060408401356001600160401b038111156157f957600080fd5b60008060408385031215615a7457600080fd5b8235615a7f816153a4565b91506159d9602084016153e0565b60008060408385031215615aa057600080fd5b823561573a816153a4565b600060208284031215615abd57600080fd5b81356001600160401b03811115615ad357600080fd5b61495984828501615748565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615b2e57615b2e615b06565b500390565b600060208284031215615b4557600080fd5b81516153d9816154c1565b60008083128015600160ff1b850184121615615b6e57615b6e615b06565b6001600160ff1b0384018313811615615b8957615b89615b06565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f536f6d6520444b206e6f7420696e205265736f6c76696e672070686173650000604082015260600190565b600060208284031215615bee57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615c2157615c21615b06565b506000190190565b6020808252600e908201526d0aee4dedcce40889640d2dcc8caf60931b604082015260600190565b6000600019821415615c6557615c65615b06565b5060010190565b60208101611db882846156cb565b600080600060608486031215615c8f57600080fd5b835192506020840151615ca1816154c1565b6040850151909250615525816154c1565b60208082526011908201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b604082015260600190565b60008219821115615cf057615cf0615b06565b500190565b6000816000190483118215151615615d0f57615d0f615b06565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615d3957615d39615d14565b500490565b6000600160ff1b821415615d5457615d54615b06565b5060000390565b600082615d6a57615d6a615d14565b500690565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60005b83811015615dbf578181015183820152602001615da7565b83811115612ea95750506000910152565b60008251615de2818460208701615da4565b9190910192915050565b60006101608a15158352896020840152886040840152876060840152866080840152615e1b60a08401876155b2565b8461012084015280610140840152615e35818401856155e3565b9b9a5050505050505050505050565b8481528360208201526080604082015260008351806080840152615e6f8160a0850160208801615da4565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615e9f57600080fd5b81516153d9816153a456fee83e0a05baa75e68db64db7387055029be50c8d8de00a3e3e56978509b9bc2dea2646970667358221220222902153881fcc32a573ebff21d26b0f46dab0fc92553713dac75545ed01ae964736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061034d5760003560e01c8063840bc19c116101bd578063c057eca7116100f8578063d8b03fd81161009b578063d8b03fd814610b5b578063e4c0aaf414610b70578063eaff425a14610b90578063f12ada8b14610ba5578063f6b4d82d14610bc5578063f7434ea914610c4e578063fbf405b014610c6e578063fc6f8f1614610c8e578063fe524c3914610cae57600080fd5b8063c057eca714610a41578063c13517e114610a57578063c258bb1914610a6a578063c356990214610a8a578063c71f425314610a9d578063cf0c38f814610abd578063d1c1df4814610add578063d2b8035a14610b3b57600080fd5b8063b1c9fe6e11610160578063b1c9fe6e14610919578063b2866af714610947578063b31b454014610967578063b39367ed1461097d578063b4a616081461099d578063b70c4e94146109b2578063b888adfa146109c7578063bfabfe8f146109dd57600080fd5b8063840bc19c146107f75780638a73a4dd146108125780638a9bb02a146108325780638bb04875146108645780638edf4741146108845780639280169a146108a4578063a4370ce4146108c4578063afe15cfb146108e457600080fd5b806335975f4a1161028d57806359ec827e1161023057806359ec827e1461070d5780636235593f1461072d57806367c51947146107425780636c1eb1b9146107625780636e5f35c214610777578063751accd0146107975780637717a6e8146107b7578063823cfd70146107d757600080fd5b806335975f4a146105e95780633a157860146106095780633cfd11841461061f57806343d4137f1461064c57806344c792e714610679578063543f8a3614610699578063564a565d146106c657806356acb050146106f757600080fd5b806319b81529116102f557806319b815291461048d5780631c3db16d146104bd5780631f5a0dd2146104fa57806327e6ec8a146105515780632922d6041461057e5780632d29a47b1461059e5780632ea7b4d0146105be57806334d5fb31146105d457600080fd5b8062f5822c146103525780630b274f2e146103745780630b7414bc146103895780630c340a24146103a95780630d1b9d1a146103e65780630d83b940146104345780630e083ec914610457578063115d53761461046d575b600080fd5b34801561035e57600080fd5b5061037261036d3660046153bc565b610cce565b005b34801561038057600080fd5b50610372610d23565b34801561039557600080fd5b506103726103a43660046154cf565b6112ab565b3480156103b557600080fd5b506000546103c9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f257600080fd5b50610406610401366004615530565b611481565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016103dd565b34801561044057600080fd5b50610449600181565b6040519081526020016103dd565b34801561046357600080fd5b50610449600e5481565b34801561047957600080fd5b50610372610488366004615530565b6114ca565b34801561049957600080fd5b506104ad6104a8366004615530565b611b24565b60405190151581526020016103dd565b3480156104c957600080fd5b506104dd6104d8366004615530565b611c1b565b6040805193845291151560208401521515908201526060016103dd565b34801561050657600080fd5b5061051a610515366004615530565b611d30565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016103dd565b34801561055d57600080fd5b50610566600081565b6040516001600160601b0390911681526020016103dd565b34801561058a57600080fd5b50610449610599366004615549565b611d87565b3480156105aa57600080fd5b506103726105b936600461556b565b611dbe565b3480156105ca57600080fd5b5061044961271081565b3480156105e057600080fd5b50610566600181565b3480156105f557600080fd5b50610372610604366004615530565b612601565b34801561061557600080fd5b5061044960065481565b34801561062b57600080fd5b5061063f61063a366004615597565b61273e565b6040516103dd91906155d5565b34801561065857600080fd5b5061066c610667366004615530565b6127af565b6040516103dd919061561e565b34801561068557600080fd5b50610372610694366004615631565b61282b565b3480156106a557600080fd5b506106b96106b43660046153bc565b6128eb565b6040516103dd9190615668565b3480156106d257600080fd5b506106e66106e1366004615530565b612987565b6040516103dd9594939291906156df565b34801561070357600080fd5b50610449600f5481565b34801561071957600080fd5b50610449610728366004615530565b6129e3565b34801561073957600080fd5b50610449600081565b34801561074e57600080fd5b5061037261075d36600461571e565b612b36565b34801561076e57600080fd5b50610449600a81565b34801561078357600080fd5b5061037261079236600461571e565b612bd7565b3480156107a357600080fd5b506103726107b23660046157b7565b612ddd565b3480156107c357600080fd5b506103726107d236600461571e565b612eaf565b3480156107e357600080fd5b506103726107f2366004615530565b612efd565b34801561080357600080fd5b506104496001600160ff1b0381565b34801561081e57600080fd5b5061037261082d36600461587c565b612f2c565b34801561083e57600080fd5b5061085261084d366004615549565b6132c4565b6040516103dd9695949392919061591f565b34801561087057600080fd5b5061037261087f366004615530565b6133a4565b34801561089057600080fd5b5061044961089f366004615530565b613530565b3480156108b057600080fd5b506103726108bf36600461571e565b613551565b3480156108d057600080fd5b506103726108df36600461571e565b6135ec565b3480156108f057600080fd5b506109046108ff366004615530565b613694565b604080519283526020830191909152016103dd565b34801561092557600080fd5b5060025461093a90600160a01b900460ff1681565b6040516103dd9190615994565b34801561095357600080fd5b50610372610962366004615530565b613741565b34801561097357600080fd5b5061044960045481565b34801561098957600080fd5b506103726109983660046159ae565b613770565b3480156109a957600080fd5b50610449600481565b3480156109be57600080fd5b506104ad61381f565b3480156109d357600080fd5b5061044960055481565b3480156109e957600080fd5b50610a266109f8366004615549565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b604080519384526020840192909252908201526060016103dd565b348015610a4d57600080fd5b5061044960035481565b610449610a653660046159e2565b613861565b348015610a7657600080fd5b50610372610a853660046153bc565b613bdd565b610372610a98366004615a28565b613c29565b348015610aa957600080fd5b50610449610ab8366004615530565b6142a7565b348015610ac957600080fd5b506002546103c9906001600160a01b031681565b348015610ae957600080fd5b50610904610af8366004615a61565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b4757600080fd5b50610372610b56366004615549565b61430f565b348015610b6757600080fd5b5061066c614610565b348015610b7c57600080fd5b50610372610b8b3660046153bc565b614668565b348015610b9c57600080fd5b50610449600381565b348015610bb157600080fd5b50610372610bc0366004615a8d565b6146b4565b348015610bd157600080fd5b50610c1c610be0366004615530565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016103dd565b348015610c5a57600080fd5b50610449610c69366004615aab565b61490d565b348015610c7a57600080fd5b506001546103c9906001600160a01b031681565b348015610c9a57600080fd5b50610449610ca9366004615530565b614961565b348015610cba57600080fd5b506104ad610cc936600461571e565b614990565b6000546001600160a01b03163314610d015760405162461bcd60e51b8152600401610cf890615adf565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610d4357610d436156b5565b1415610e0557600354600554610d599042615b1c565b1015610da35760405162461bcd60e51b8152602060048201526019602482015278135a5b94dd185ada5b99d51a5b59481b9bdd081c185cdcd959603a1b6044820152606401610cf8565b600954610de95760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610cf8565b6002805460ff60a01b1916600160a01b17905543600655611260565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190615b33565b600954909150600090610e8d90600190615b50565b90505b6000811261125057600060098281548110610ead57610ead615b8f565b906000526020600020015490506000600860098481548110610ed157610ed1615b8f565b906000526020600020015481548110610eec57610eec615b8f565b60009182526020909120600260049092020101546001600160a01b03169050838015610f865750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4c57600080fd5b505afa158015610f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f849190615b33565b155b1561107057806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc657600080fd5b505af1158015610fda573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561101757600080fd5b505afa15801561102b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104f9190615b33565b61106b5760405162461bcd60e51b8152600401610cf890615ba5565b61123d565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e19190615b33565b6110fd5760405162461bcd60e51b8152600401610cf890615ba5565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561113657600080fd5b505afa15801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190615bdc565b61123d5760006008838154811061118757611187615b8f565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b199092169190911790556009546111c390600190615b50565b83121561121557600980546111da90600190615b1c565b815481106111ea576111ea615b8f565b90600052602060002001546009848154811061120857611208615b8f565b6000918252602090912001555b600980548061122657611226615bf5565b600190038181906000526020600020016000905590555b50508061124990615c0b565b9050610e90565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b93916112a191600160a01b90910460ff1690615994565b60405180910390a1565b6000546001600160a01b031633146112d55760405162461bcd60e51b8152600401610cf890615adf565b60006007846001600160601b0316815481106112f3576112f3615b8f565b90600052602060002090600b0201905060005b835181101561147a5782156113a057600084828151811061132957611329615b8f565b602002602001015111801561135a5750600854845185908390811061135057611350615b8f565b6020026020010151105b6113765760405162461bcd60e51b8152600401610cf890615c29565b61139b8585838151811061138c5761138c615b8f565b602002602001015160016149d8565b611468565b6001600160601b03851660011480156113f65750600060088583815181106113ca576113ca615b8f565b6020026020010151815481106113e2576113e2615b8f565b906000526020600020906004020160000154145b156114435760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610cf8565b6114688585838151811061145957611459615b8f565b602002602001015160006149d8565b8061147281615c51565b915050611306565b5050505050565b6008818154811061149157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106114df576114df615b8f565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061151257611512615b8f565b6000918252602082206003850154600b90920201925061153490600190615b1c565b9050600083600301828154811061154d5761154d615b8f565b6000918252602082206007909102019150600185015460ff166004811115611577576115776156b5565b14156116aa5760008211806115c957506001840154600684019060ff1660048111156115a5576115a56156b5565b600481106115b5576115b5615b8f565b015460028501546115c69042615b1c565b10155b6116155760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610cf8565b60038101546006820154146116645760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610cf8565b8254600160601b900460ff1661167b57600261167e565b60015b60018086018054909160ff19909116908360048111156116a0576116a06156b5565b0217905550611ad6565b60018085015460ff1660048111156116c4576116c46156b5565b1415611810576001840154600684019060ff1660048111156116e8576116e86156b5565b600481106116f8576116f8615b8f565b015460028501546117099042615b1c565b1015806117b25750600881600001548154811061172857611728615b8f565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b29190615b33565b6117f95760405162461bcd60e51b815260206004820152601860248201527710dbdb5b5a5d081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460029260ff1990911690836116a0565b6002600185015460ff16600481111561182b5761182b6156b5565b14156119b3576001840154600684019060ff16600481111561184f5761184f6156b5565b6004811061185f5761185f615b8f565b015460028501546118709042615b1c565b1015806119195750600881600001548154811061188f5761188f615b8f565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156118e157600080fd5b505afa1580156118f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119199190615b33565b61195e5760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610cf8565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611ad6565b6003600185015460ff1660048111156119ce576119ce6156b5565b1415611a73576001840154600684019060ff1660048111156119f2576119f26156b5565b60048110611a0257611a02615b8f565b01546002850154611a139042615b1c565b1015611a5c5760405162461bcd60e51b8152602060048201526018602482015277105c1c19585b081c195c9a5bd9081b9bdd081c185cdcd95960421b6044820152606401610cf8565b6001808501805460049260ff1990911690836116a0565b6004600185015460ff166004811115611a8e57611a8e6156b5565b1415611ad65760405162461bcd60e51b8152602060048201526017602482015276111a5cdc1d5d19481c195c9a5bd9081a5cc8199a5b985b604a1b6044820152606401610cf8565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611b159160ff1690615c6c565b60405180910390a25050505050565b600080600a8381548110611b3a57611b3a615b8f565b6000918252602082206003600490920201908101805491935090611b6090600190615b1c565b81548110611b7057611b70615b8f565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ba357611ba3615b8f565b90600052602060002090600b02019050806005015482600301541015611bce57506000949350505050565b80546007805490916001600160601b0316908110611bee57611bee615b8f565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600080600a8581548110611c3457611c34615b8f565b6000918252602082206003600490920201908101805491935090611c5a90600190615b1c565b81548110611c6a57611c6a615b8f565b9060005260206000209060070201905060006008826000015481548110611c9357611c93615b8f565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018990526001600160a01b031691508190631c3db16d9060240160606040518083038186803b158015611ce857600080fd5b505afa158015611cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d209190615c7a565b9199909850909650945050505050565b60078181548110611d4057600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611daa57611daa615b8f565b906000526020600020015490505b92915050565b6000600a8481548110611dd357611dd3615b8f565b600091825260209091206004918202019150600182015460ff166004811115611dfe57611dfe6156b5565b14611e1b5760405162461bcd60e51b8152600401610cf890615cb2565b6000816003018481548110611e3257611e32615b8f565b9060005260206000209060070201905060006008826000015481548110611e5b57611e5b615b8f565b60009182526020822060049182020160020154908401546001600160a01b039091169250611e8a908690615cdd565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b158015611ee357600080fd5b505afa158015611ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1b9190615bdc565b905060008082611f365783861115611f31578395505b611f56565b611f41846002615cf5565b861115611f5657611f53846002615cf5565b95505b60048801545b868110156125db578481101561235057604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b158015611fba57600080fd5b505afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190615bdc565b91506127108211156120045761271091505b60006127106120138482615b1c565b8b600101546120229190615cf5565b61202c9190615d2a565b90506120388188615cdd565b965089600601828154811061204f5761204f615b8f565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b0316855260020190925290822080549196508392909161209c908490615b1c565b90915550508a546007805483926001600160601b03169081106120c1576120c1615b8f565b90600052602060002090600b0201600201546120dd9190615cdd565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612171576001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915281205461214f908390615b1c565b8c5490915061216a9086906001600160601b03168385614a60565b50506121c2565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152902054156121c2578a546121c09085906001600160601b0316600084614a60565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b15801561221057600080fd5b505afa158015612224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122489190615b33565b6122a1576000612257856128eb565b905060005b815181101561229e5761228b8683838151811061227b5761227b615b8f565b6020026020010151600080614a60565b508061229681615c51565b91505061225c565b50505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196122d684615d3e565b60408051918252600060208301520160405180910390a36122f8600187615b1c565b82141561234a578461234a576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461234893506001600160a01b0316915089905061507a565b505b506125c9565b6001600160a01b038816634fe264fb8e8e61236b8986615d5b565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156123af57600080fd5b505afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190615bdc565b91506127108211156123f95761271091505b600689016124078683615d5b565b8154811061241757612417615b8f565b60009182526020909120015460018a01546001600160a01b03909116935061271090612444908490615cf5565b61244e9190615d2a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526002019091528120805490919061248e908490615b1c565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b031684526001019091529020546124f6576000612710838b600101546124dd9190615cf5565b6124e79190615d2a565b90506124f3848261507a565b50505b600061271083612506878a615d2a565b6125109190615cf5565b61251a9190615d2a565b9050600061271084878d600201546125329190615d2a565b61253c9190615cf5565b6125469190615d2a565b9050612552858361507a565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e1984846040516125be929190918252602082015260400190565b60405180910390a350505b806125d381615c51565b915050611f5c565b50848860050154146125ef57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612621576126216156b5565b146126605760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610cf8565b6000600e54600183600f546126759190615cdd565b61267f9190615b1c565b1161268a57816126a5565b600f54600e5461269a9190615b1c565b6126a5906001615cdd565b9050600081600f546126b79190615cdd565b600f549091505b81811015612736576000818152600d60205260409020805460018201546002830154612706926001600160a01b03811692600160a01b9091046001600160601b031691614a60565b50506000818152600d6020526040812081815560018101829055600201558061272e81615c51565b9150506126be565b50600f555050565b6127466152f9565b60006007836001600160601b03168154811061276457612764615b8f565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b81548152602001906001019080831161278f575050505050915050919050565b6060600882815481106127c4576127c4615b8f565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561281f57602002820191906000526020600020905b81548152602001906001019080831161280b575b50505050509050919050565b6000546001600160a01b031633146128555760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061287257612872615b8f565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b60405180910390a25050565b6001600160a01b0381166000908152600b602090815260409182902080548351818402810184019094528084526060939283018282801561281f57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b0104928301926001038202915080841161293a575094979650505050505050565b600a818154811061299757600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b600080600a83815481106129f9576129f9615b8f565b6000918252602082206003600490920201908101805491935090612a1f90600190615b1c565b81548110612a2f57612a2f615b8f565b600091825260208220845460078054938102909201945090916001600160601b03909116908110612a6257612a62615b8f565b90600052602060002090600b020190508060050154826003015410612b015782546001600160601b031660011415612aa3576001600160ff1b039350612b2e565b6003820154612ab3906002615cf5565b612abe906001615cdd565b81546007805490916001600160601b0316908110612ade57612ade615b8f565b90600052602060002090600b020160040154612afa9190615cf5565b9350612b2e565b6003820154612b11906002615cf5565b612b1c906001615cdd565b8160040154612b2b9190615cf5565b93505b505050919050565b6000546001600160a01b03163314612b605760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b031681548110612b7d57612b7d615b8f565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b6000546001600160a01b03163314612c015760405162461bcd60e51b8152600401610cf890615adf565b6001600160601b03821660011480612c74575080600780846001600160601b031681548110612c3257612c32615b8f565b60009182526020909120600b909102015481546001600160601b03909116908110612c5f57612c5f615b8f565b90600052602060002090600b02016002015411155b612c905760405162461bcd60e51b8152600401610cf890615d6f565b60005b6007836001600160601b031681548110612caf57612caf615b8f565b90600052602060002090600b020160010180549050811015612d685781600780856001600160601b031681548110612ce957612ce9615b8f565b90600052602060002090600b02016001018381548110612d0b57612d0b615b8f565b906000526020600020015481548110612d2657612d26615b8f565b90600052602060002090600b0201600201541015612d565760405162461bcd60e51b8152600401610cf890615d6f565b80612d6081615c51565b915050612c93565b50806007836001600160601b031681548110612d8657612d86615b8f565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615eab8339815191526040516128df906020808252600890820152676d696e5374616b6560c01b604082015260600190565b6000546001600160a01b03163314612e075760405162461bcd60e51b8152600401610cf890615adf565b6000836001600160a01b03168383604051612e229190615dd0565b60006040518083038185875af1925050503d8060008114612e5f576040519150601f19603f3d011682016040523d82523d6000602084013e612e64565b606091505b5050905080612ea95760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cf8565b50505050565b612ebc3383836000614a60565b612ef95760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610cf8565b5050565b6000546001600160a01b03163314612f275760405162461bcd60e51b8152600401610cf890615adf565b600355565b6000546001600160a01b03163314612f565760405162461bcd60e51b8152600401610cf890615adf565b8660078a6001600160601b031681548110612f7357612f73615b8f565b90600052602060002090600b0201600201541115612fa35760405162461bcd60e51b8152600401610cf890615d6f565b6000815111612fe45760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610cf8565b6001600160601b03891661303a5760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610cf8565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561313657600084828151811061308f5761308f615b8f565b60200260200101511180156130c0575060085484518590839081106130b6576130b6615b8f565b6020026020010151105b6130dc5760405162461bcd60e51b8152600401610cf890615c29565b600182600a0160008684815181106130f6576130f6615b8f565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550808061312e90615c51565b915050613072565b5080546001600160601b0319166001600160601b038c16178155604080516000815260208101918290525161316f916001840191615317565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556131b29060068301908790615362565b5060405163de0fe69d60e01b8152600c6004820152602481018390526044810185905273__$e61a6600819b973e3ecb2d058aa03f20a8$__9063de0fe69d9060640160006040518083038186803b15801561320c57600080fd5b505af4158015613220573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061324057613240615b8f565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907fc580509bcead0c8c5066804fbadb737e0b19c8860c518df0883469001effab10906132af908e908e908e908e908e908e908e908e90615dec565b60405180910390a35050505050505050505050565b6000806000806060600080600a89815481106132e2576132e2615b8f565b9060005260206000209060040201600301888154811061330457613304615b8f565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561338657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613368575b50505050509150965096509650965096509650509295509295509295565b6000600a82815481106133b9576133b9615b8f565b600091825260209091206004918202019150600182015460ff1660048111156133e4576133e46156b5565b146134015760405162461bcd60e51b8152600401610cf890615cb2565b6001810154610100900460ff16156134555760405162461bcd60e51b8152602060048201526017602482015276149d5b1a5b99c8185b1c9958591e48195e1958dd5d1959604a1b6044820152606401610cf8565b600061346083611c1b565b505060018301805461010061ff001990911617905582546040518281529192508491600160601b9091046001600160a01b0316907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3815460405163188d362b60e11b81526004810185905260248101839052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b15801561351357600080fd5b505af1158015613527573d6000803e3d6000fd5b50505050505050565b6009818154811061354057600080fd5b600091825260209091200154905081565b6000546001600160a01b0316331461357b5760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061359857613598615b8f565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615eab8339815191526040516128df90602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146136165760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b03168154811061363357613633615b8f565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615eab8339815191526040516128df9060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a84815481106136ac576136ac615b8f565b6000918252602090912060049091020190506003600182015460ff1660048111156136d9576136d96156b5565b1415613732576002810154815460078054929550916001600160601b0390911690811061370857613708615b8f565b600091825260209091206009600b909202010154600282015461372b9190615cdd565b915061373b565b60009250600091505b50915091565b6000546001600160a01b0316331461376b5760405162461bcd60e51b8152600401610cf890615adf565b600455565b6000546001600160a01b0316331461379a5760405162461bcd60e51b8152600401610cf890615adf565b806007836001600160601b0316815481106137b7576137b7615b8f565b90600052602060002090600b02016006019060046137d6929190615362565b50816001600160601b0316600080516020615eab8339815191526040516128df906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b60006001600254600160a01b900460ff166001811115613841576138416156b5565b14801561385c57506004546005546138599042615b1c565b10155b905090565b600061386c8261490d565b3410156138bb5760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610cf8565b6000806138c78461514f565b92505091506007826001600160601b0316815481106138e8576138e8615b8f565b60009182526020808320848452600a600b90930201919091019052604090205460ff166139515760405162461bcd60e51b81526020600482015260176024820152761112c81d5b9cdd5c1c1bdc9d195908189e4818dbdd5c9d604a1b6044820152606401610cf8565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa9091015560088054929650909291849081106139dc576139dc615b8f565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613a1d57613a1d615b8f565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613a5c9034615d2a565b600380830191909155858255820154600283015461271091613a7d91615cf5565b613a879190615d2a565b60018201553460028201556008805486908110613aa657613aa6615b8f565b906000526020600020906004020160020160149054906101000a900460ff16613b3d57600160088681548110613ade57613ade615b8f565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613b72918b918e918e91600401615e44565b600060405180830381600087803b158015613b8c57600080fd5b505af1158015613ba0573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613c075760405162461bcd60e51b8152600401610cf890615adf565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613c32836129e3565b341015613c815760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610cf8565b6000600a8481548110613c9657613c96615b8f565b6000918252602090912060049091020190506003600182015460ff166004811115613cc357613cc36156b5565b14613d095760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610cf8565b60038101805460009190613d1f90600190615b1c565b81548110613d2f57613d2f615b8f565b906000526020600020906007020190506008816000015481548110613d5657613d56615b8f565b60009182526020909120600490910201600201546001600160a01b03163314613db45760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610cf8565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019184908110613df557613df5615b8f565b90600052602060002090600b020160050154846003015410613ff9576007836001600160601b031681548110613e2d57613e2d615b8f565b600091825260208220600b90910201546001600160601b031693505b600a811015613f3e576007846001600160601b031681548110613e6e57613e6e615b8f565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613e9b57613f3e565b600060088481548110613eb057613eb0615b8f565b90600052602060002090600402016000015414613ef35760088381548110613eda57613eda615b8f565b9060005260206000209060040201600001549250613f2c565b6007846001600160601b031681548110613f0f57613f0f615b8f565b60009182526020909120600b90910201546001600160601b031693505b80613f3681615c51565b915050613e49565b506007836001600160601b031681548110613f5b57613f5b615b8f565b60009182526020808320858452600a600b90930201919091019052604090205460ff16613f8757600192505b84546001600160601b03848116911614613ff957845460038601546001600160601b0390911690613fba90600190615b1c565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546001600160601b0319166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061403c5761403c615b8f565b90600052602060002090600b0201905080600401543461405c9190615d2a565b82600301819055506127108160030154826002015461407b9190615cf5565b6140859190615d2a565b600183015534600283015582825560088054849081106140a7576140a7615b8f565b906000526020600020906004020160020160149054906101000a900460ff1661413e576001600884815481106140df576140df615b8f565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614224578454600387015461415a90600190615b1c565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106141a8576141a8615b8f565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede540926141f1928e928e928e929101615e44565b600060405180830381600087803b15801561420b57600080fd5b505af115801561421f573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516142949190615c6c565b60405180910390a2505050505050505050565b600080600a83815481106142bd576142bd615b8f565b9060005260206000209060040201905080600301600182600301805490506142e59190615b1c565b815481106142f5576142f5615b8f565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561432f5761432f6156b5565b1461436a5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610cf8565b6000600a838154811061437f5761437f615b8f565b906000526020600020906004020190506000600182600301805490506143a59190615b1c565b905060008260030182815481106143be576143be615b8f565b6000918252602082206007909102019150600184015460ff1660048111156143e8576143e86156b5565b146144285760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610cf8565b6000600882600001548154811061444157614441615b8f565b60009182526020822060026004909202010154600684015460038501546001600160a01b03909216935091906144778884615cdd565b1115614487578360030154614491565b6144918783615cdd565b9050815b8181101561460557604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b1580156144e257600080fd5b505af11580156144f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061451a9190615e8d565b90506001600160a01b038116156145f25760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614570908490615cdd565b909155505060068601546040805189815260208101929092528b916001600160a01b038416917f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a3600686018054600181018255600091825260209091200180546001600160a01b0319166001600160a01b0383161790555b50806145fd81615c51565b915050614495565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561465e57602002820191906000526020600020905b81548152602001906001019080831161464a575b5050505050905090565b6000546001600160a01b031633146146925760405162461bcd60e51b8152600401610cf890615adf565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146146de5760405162461bcd60e51b8152600401610cf890615adf565b60085480821061471a5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610cf8565b60008215614797576008838154811061473557614735615b8f565b90600052602060002090600402016003015460016147539190615cdd565b9050600a81106147975760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610cf8565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381019182559151805193949193614849937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee401929190910190615317565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106148a3576148a3615b8f565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a482612ea957612ea960018360016149d8565b600080600061491b8461514f565b5091509150806007836001600160601b03168154811061493d5761493d615b8f565b90600052602060002090600b0201600401546149599190615cf5565b949350505050565b6000600a828154811061497657614976615b8f565b600091825260209091206003600490920201015492915050565b60006007836001600160601b0316815481106149ae576149ae615b8f565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b0316815481106149f5576149f5615b8f565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614a8257506007546001600160601b038516115b15614a8f57506000614959565b6001600160a01b0385166000908152600b6020526040812090614ab287876151d3565b604051630b8ea8ad60e41b8152600c60048201526001600160601b03881660248201526044810182905290915060009073__$e61a6600819b973e3ecb2d058aa03f20a8$__9063b8ea8ad09060640160206040518083038186803b158015614b1957600080fd5b505af4158015614b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b519190615bdc565b90508515614bdf576007876001600160601b031681548110614b7557614b75615b8f565b90600052602060002090600b020160020154861080614bad57506001600160601b038716600090815260028401602052604090205486105b15614bbe5760009350505050614959565b80158015614bce57508254600411155b15614bdf5760009350505050614959565b6000600254600160a01b900460ff166001811115614bff57614bff6156b5565b14614cab576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614c4a90615c51565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061495992505050565b6000818710614d2857614cbe8288615b1c565b90508015614d1657614cd189308361521b565b15614d1b5781614d16578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b614efd565b6000945050505050614959565b86614ec5576001600160601b03881660009081526002850160205260409020548690614d549084615b1c565b614d5e9190615b1c565b90508015614d1657614d70898261507a565b15614d1b5760005b8454811015614ebf57886001600160601b0316856000018281548110614da057614da0615b8f565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415614ead5784548590614ddd90600190615b1c565b81548110614ded57614ded615b8f565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614e2b57614e2b615b8f565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480614e7757614e77615bf5565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055614ebf565b80614eb781615c51565b915050614d78565b50614efd565b85614ed08884615b1c565b614eda9190615b1c565b90508015614efd57614eec898261507a565b614efd576000945050505050614959565b6001600160601b03881660009081526001850160205260408120548890614f25908590615b1c565b614f2f9190615cdd565b6001600160601b038a16600081815260018801602052604081208390559192505b81615013576040516314955f6d60e21b8152600c600482015260248101829052604481018b90526064810187905273__$e61a6600819b973e3ecb2d058aa03f20a8$__906352557db49060840160006040518083038186803b158015614fb557600080fd5b505af4158015614fc9573d6000803e3d6000fd5b505050506001811415614fdf5760019150614f50565b60078181548110614ff257614ff2615b8f565b60009182526020909120600b90910201546001600160601b03169050614f50565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916150da9190615dd0565b6000604051808303816000865af19150503d8060008114615117576040519150601f19603f3d011682016040523d82523d6000602084013e61511c565b606091505b50915091508180156151465750805115806151465750808060200190518101906151469190615b33565b95945050505050565b600080600060408451106151c1575050506020810151604082015160608301516001600160601b038316158061519057506007546001600160601b03841610155b1561519a57600192505b816151a457600391505b8015806151b357506008548110155b156151bc575060015b6151cc565b506001915060039050815b9193909250565b600060405160005b60148110156151f6578481600c011a818301536001016151db565b5060145b60208110156152125783811a818301536001016151fa565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916152839190615dd0565b6000604051808303816000865af19150503d80600081146152c0576040519150601f19603f3d011682016040523d82523d6000602084013e6152c5565b606091505b50915091508180156152ef5750805115806152ef5750808060200190518101906152ef9190615b33565b9695505050505050565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215615352579160200282015b82811115615352578251825591602001919060010190615337565b5061535e92915061538f565b5090565b82600481019282156153525791602002820182811115615352578251825591602001919060010190615337565b5b8082111561535e5760008155600101615390565b6001600160a01b03811681146153b957600080fd5b50565b6000602082840312156153ce57600080fd5b81356153d9816153a4565b9392505050565b80356001600160601b03811681146153f757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561543a5761543a6153fc565b604052919050565b600082601f83011261545357600080fd5b813560206001600160401b0382111561546e5761546e6153fc565b8160051b61547d828201615412565b928352848101820192828101908785111561549757600080fd5b83870192505b848310156154b65782358252918301919083019061549d565b979650505050505050565b80151581146153b957600080fd5b6000806000606084860312156154e457600080fd5b6154ed846153e0565b925060208401356001600160401b0381111561550857600080fd5b61551486828701615442565b9250506040840135615525816154c1565b809150509250925092565b60006020828403121561554257600080fd5b5035919050565b6000806040838503121561555c57600080fd5b50508035926020909101359150565b60008060006060848603121561558057600080fd5b505081359360208301359350604090920135919050565b6000602082840312156155a957600080fd5b6153d9826153e0565b8060005b6004811015612ea95781518452602093840193909101906001016155b6565b60808101611db882846155b2565b600081518084526020808501945080840160005b83811015615613578151875295820195908201906001016155f7565b509495945050505050565b6020815260006153d960208301846155e3565b6000806040838503121561564457600080fd5b61564d836153e0565b9150602083013561565d816154c1565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156156a95783516001600160601b031683529284019291840191600101615684565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b600581106156db576156db6156b5565b9052565b6001600160601b03861681526001600160a01b038516602082015260a0810161570b60408301866156cb565b9215156060820152608001529392505050565b6000806040838503121561573157600080fd5b61573a836153e0565b946020939093013593505050565b600082601f83011261575957600080fd5b81356001600160401b03811115615772576157726153fc565b615785601f8201601f1916602001615412565b81815284602083860101111561579a57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156157cc57600080fd5b83356157d7816153a4565b92506020840135915060408401356001600160401b038111156157f957600080fd5b61580586828701615748565b9150509250925092565b600082601f83011261582057600080fd5b604051608081018181106001600160401b0382111715615842576158426153fc565b60405280608084018581111561585757600080fd5b845b81811015615871578035835260209283019201615859565b509195945050505050565b60008060008060008060008060006101808a8c03121561589b57600080fd5b6158a48a6153e0565b985060208a01356158b4816154c1565b975060408a0135965060608a0135955060808a0135945060a08a013593506158df8b60c08c0161580f565b92506101408a013591506101608a01356001600160401b0381111561590357600080fd5b61590f8c828d01615442565b9150509295985092959850929598565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b8181101561597b5784516001600160a01b031683529383019391830191600101615956565b50508093505050508260a0830152979650505050505050565b60208101600283106159a8576159a86156b5565b91905290565b60008060a083850312156159c157600080fd5b6159ca836153e0565b91506159d9846020850161580f565b90509250929050565b600080604083850312156159f557600080fd5b8235915060208301356001600160401b03811115615a1257600080fd5b615a1e85828601615748565b9150509250929050565b600080600060608486031215615a3d57600080fd5b833592506020840135915060408401356001600160401b038111156157f957600080fd5b60008060408385031215615a7457600080fd5b8235615a7f816153a4565b91506159d9602084016153e0565b60008060408385031215615aa057600080fd5b823561573a816153a4565b600060208284031215615abd57600080fd5b81356001600160401b03811115615ad357600080fd5b61495984828501615748565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615b2e57615b2e615b06565b500390565b600060208284031215615b4557600080fd5b81516153d9816154c1565b60008083128015600160ff1b850184121615615b6e57615b6e615b06565b6001600160ff1b0384018313811615615b8957615b89615b06565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252601e908201527f536f6d6520444b206e6f7420696e205265736f6c76696e672070686173650000604082015260600190565b600060208284031215615bee57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615c2157615c21615b06565b506000190190565b6020808252600e908201526d0aee4dedcce40889640d2dcc8caf60931b604082015260600190565b6000600019821415615c6557615c65615b06565b5060010190565b60208101611db882846156cb565b600080600060608486031215615c8f57600080fd5b835192506020840151615ca1816154c1565b6040850151909250615525816154c1565b60208082526011908201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b604082015260600190565b60008219821115615cf057615cf0615b06565b500190565b6000816000190483118215151615615d0f57615d0f615b06565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615d3957615d39615d14565b500490565b6000600160ff1b821415615d5457615d54615b06565b5060000390565b600082615d6a57615d6a615d14565b500690565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60005b83811015615dbf578181015183820152602001615da7565b83811115612ea95750506000910152565b60008251615de2818460208701615da4565b9190910192915050565b60006101608a15158352896020840152886040840152876060840152866080840152615e1b60a08401876155b2565b8461012084015280610140840152615e35818401856155e3565b9b9a5050505050505050505050565b8481528360208201526080604082015260008351806080840152615e6f8160a0850160208801615da4565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615e9f57600080fd5b81516153d9816153a456fee83e0a05baa75e68db64db7387055029be50c8d8de00a3e3e56978509b9bc2dea2646970667358221220222902153881fcc32a573ebff21d26b0f46dab0fc92553713dac75545ed01ae964736f6c63430008090033", "libraries": { - "SortitionSumTreeFactory": "0x40a78989317B953e427B3BD87C59eA003fcC2296" + "SortitionSumTreeFactoryV2": "0x678E676fd0048da8c35d5B03fabB53a7beBf73A6" }, "devdoc": { "kind": "dev", @@ -2041,7 +2066,7 @@ "storageLayout": { "storage": [ { - "astId": 2312, + "astId": 1079, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "governor", "offset": 0, @@ -2049,15 +2074,15 @@ "type": "t_address" }, { - "astId": 2315, + "astId": 1082, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "pinakion", "offset": 0, "slot": "1", - "type": "t_contract(IERC20)903" + "type": "t_contract(IERC20)383" }, { - "astId": 2317, + "astId": 1084, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "jurorProsecutionModule", "offset": 0, @@ -2065,15 +2090,15 @@ "type": "t_address" }, { - "astId": 2320, + "astId": 1087, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "phase", "offset": 20, "slot": "2", - "type": "t_enum(Phase)2179" + "type": "t_enum(Phase)946" }, { - "astId": 2322, + "astId": 1089, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "minStakingTime", "offset": 0, @@ -2081,7 +2106,7 @@ "type": "t_uint256" }, { - "astId": 2324, + "astId": 1091, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "maxFreezingTime", "offset": 0, @@ -2089,7 +2114,7 @@ "type": "t_uint256" }, { - "astId": 2326, + "astId": 1093, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "lastPhaseChange", "offset": 0, @@ -2097,7 +2122,7 @@ "type": "t_uint256" }, { - "astId": 2328, + "astId": 1095, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "freezeBlock", "offset": 0, @@ -2105,23 +2130,23 @@ "type": "t_uint256" }, { - "astId": 2332, + "astId": 1099, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "courts", "offset": 0, "slot": "7", - "type": "t_array(t_struct(Court)2209_storage)dyn_storage" + "type": "t_array(t_struct(Court)976_storage)dyn_storage" }, { - "astId": 2336, + "astId": 1103, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "disputeKitNodes", "offset": 0, "slot": "8", - "type": "t_array(t_struct(DisputeKitNode)2267_storage)dyn_storage" + "type": "t_array(t_struct(DisputeKitNode)1034_storage)dyn_storage" }, { - "astId": 2339, + "astId": 1106, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "disputesKitIDsThatNeedFreezing", "offset": 0, @@ -2129,39 +2154,39 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 2343, + "astId": 1110, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "disputes", "offset": 0, "slot": "10", - "type": "t_array(t_struct(Dispute)2226_storage)dyn_storage" + "type": "t_array(t_struct(Dispute)993_storage)dyn_storage" }, { - "astId": 2348, + "astId": 1115, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "jurors", "offset": 0, "slot": "11", - "type": "t_mapping(t_address,t_struct(Juror)2254_storage)" + "type": "t_mapping(t_address,t_struct(Juror)1021_storage)" }, { - "astId": 2351, + "astId": 1118, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "sortitionSumTrees", "offset": 0, "slot": "12", - "type": "t_struct(SortitionSumTrees)12407_storage" + "type": "t_struct(SortitionSumTrees)19483_storage" }, { - "astId": 2356, + "astId": 1123, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "delayedStakes", "offset": 0, "slot": "13", - "type": "t_mapping(t_uint256,t_struct(DelayedStake)2276_storage)" + "type": "t_mapping(t_uint256,t_struct(DelayedStake)1043_storage)" }, { - "astId": 2358, + "astId": 1125, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "delayedStakeWriteIndex", "offset": 0, @@ -2169,7 +2194,7 @@ "type": "t_uint256" }, { - "astId": 2361, + "astId": 1128, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "delayedStakeReadIndex", "offset": 0, @@ -2189,26 +2214,26 @@ "label": "address[]", "numberOfBytes": "32" }, - "t_array(t_struct(Court)2209_storage)dyn_storage": { - "base": "t_struct(Court)2209_storage", + "t_array(t_struct(Court)976_storage)dyn_storage": { + "base": "t_struct(Court)976_storage", "encoding": "dynamic_array", "label": "struct KlerosCore.Court[]", "numberOfBytes": "32" }, - "t_array(t_struct(Dispute)2226_storage)dyn_storage": { - "base": "t_struct(Dispute)2226_storage", + "t_array(t_struct(Dispute)993_storage)dyn_storage": { + "base": "t_struct(Dispute)993_storage", "encoding": "dynamic_array", "label": "struct KlerosCore.Dispute[]", "numberOfBytes": "32" }, - "t_array(t_struct(DisputeKitNode)2267_storage)dyn_storage": { - "base": "t_struct(DisputeKitNode)2267_storage", + "t_array(t_struct(DisputeKitNode)1034_storage)dyn_storage": { + "base": "t_struct(DisputeKitNode)1034_storage", "encoding": "dynamic_array", "label": "struct KlerosCore.DisputeKitNode[]", "numberOfBytes": "32" }, - "t_array(t_struct(Round)2242_storage)dyn_storage": { - "base": "t_struct(Round)2242_storage", + "t_array(t_struct(Round)1009_storage)dyn_storage": { + "base": "t_struct(Round)1009_storage", "encoding": "dynamic_array", "label": "struct KlerosCore.Round[]", "numberOfBytes": "32" @@ -2241,44 +2266,44 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IArbitrable)1979": { + "t_contract(IArbitrable)736": { "encoding": "inplace", "label": "contract IArbitrable", "numberOfBytes": "20" }, - "t_contract(IDisputeKit)2162": { + "t_contract(IDisputeKit)929": { "encoding": "inplace", "label": "contract IDisputeKit", "numberOfBytes": "20" }, - "t_contract(IERC20)903": { + "t_contract(IERC20)383": { "encoding": "inplace", "label": "contract IERC20", "numberOfBytes": "20" }, - "t_enum(Period)2185": { + "t_enum(Period)952": { "encoding": "inplace", "label": "enum KlerosCore.Period", "numberOfBytes": "1" }, - "t_enum(Phase)2179": { + "t_enum(Phase)946": { "encoding": "inplace", "label": "enum KlerosCore.Phase", "numberOfBytes": "1" }, - "t_mapping(t_address,t_struct(Juror)2254_storage)": { + "t_mapping(t_address,t_struct(Juror)1021_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct KlerosCore.Juror)", "numberOfBytes": "32", - "value": "t_struct(Juror)2254_storage" + "value": "t_struct(Juror)1021_storage" }, - "t_mapping(t_bytes32,t_struct(SortitionSumTree)12401_storage)": { + "t_mapping(t_bytes32,t_struct(SortitionSumTree)19477_storage)": { "encoding": "mapping", "key": "t_bytes32", - "label": "mapping(bytes32 => struct SortitionSumTreeFactory.SortitionSumTree)", + "label": "mapping(bytes32 => struct SortitionSumTreeFactoryV2.SortitionSumTree)", "numberOfBytes": "32", - "value": "t_struct(SortitionSumTree)12401_storage" + "value": "t_struct(SortitionSumTree)19477_storage" }, "t_mapping(t_bytes32,t_uint256)": { "encoding": "mapping", @@ -2301,12 +2326,12 @@ "numberOfBytes": "32", "value": "t_bytes32" }, - "t_mapping(t_uint256,t_struct(DelayedStake)2276_storage)": { + "t_mapping(t_uint256,t_struct(DelayedStake)1043_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct KlerosCore.DelayedStake)", "numberOfBytes": "32", - "value": "t_struct(DelayedStake)2276_storage" + "value": "t_struct(DelayedStake)1043_storage" }, "t_mapping(t_uint96,t_uint256)": { "encoding": "mapping", @@ -2315,12 +2340,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(Court)2209_storage": { + "t_struct(Court)976_storage": { "encoding": "inplace", "label": "struct KlerosCore.Court", "members": [ { - "astId": 2187, + "astId": 954, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "parent", "offset": 0, @@ -2328,7 +2353,7 @@ "type": "t_uint96" }, { - "astId": 2189, + "astId": 956, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "hiddenVotes", "offset": 12, @@ -2336,7 +2361,7 @@ "type": "t_bool" }, { - "astId": 2192, + "astId": 959, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "children", "offset": 0, @@ -2344,7 +2369,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 2194, + "astId": 961, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "minStake", "offset": 0, @@ -2352,7 +2377,7 @@ "type": "t_uint256" }, { - "astId": 2196, + "astId": 963, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "alpha", "offset": 0, @@ -2360,7 +2385,7 @@ "type": "t_uint256" }, { - "astId": 2198, + "astId": 965, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "feeForJuror", "offset": 0, @@ -2368,7 +2393,7 @@ "type": "t_uint256" }, { - "astId": 2200, + "astId": 967, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "jurorsForCourtJump", "offset": 0, @@ -2376,7 +2401,7 @@ "type": "t_uint256" }, { - "astId": 2204, + "astId": 971, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "timesPerPeriod", "offset": 0, @@ -2384,7 +2409,7 @@ "type": "t_array(t_uint256)4_storage" }, { - "astId": 2208, + "astId": 975, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "supportedDisputeKits", "offset": 0, @@ -2394,12 +2419,12 @@ ], "numberOfBytes": "352" }, - "t_struct(DelayedStake)2276_storage": { + "t_struct(DelayedStake)1043_storage": { "encoding": "inplace", "label": "struct KlerosCore.DelayedStake", "members": [ { - "astId": 2269, + "astId": 1036, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "account", "offset": 0, @@ -2407,7 +2432,7 @@ "type": "t_address" }, { - "astId": 2271, + "astId": 1038, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "courtID", "offset": 20, @@ -2415,7 +2440,7 @@ "type": "t_uint96" }, { - "astId": 2273, + "astId": 1040, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "stake", "offset": 0, @@ -2423,7 +2448,7 @@ "type": "t_uint256" }, { - "astId": 2275, + "astId": 1042, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "penalty", "offset": 0, @@ -2433,12 +2458,12 @@ ], "numberOfBytes": "96" }, - "t_struct(Dispute)2226_storage": { + "t_struct(Dispute)993_storage": { "encoding": "inplace", "label": "struct KlerosCore.Dispute", "members": [ { - "astId": 2211, + "astId": 978, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "courtID", "offset": 0, @@ -2446,23 +2471,23 @@ "type": "t_uint96" }, { - "astId": 2214, + "astId": 981, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "arbitrated", "offset": 12, "slot": "0", - "type": "t_contract(IArbitrable)1979" + "type": "t_contract(IArbitrable)736" }, { - "astId": 2217, + "astId": 984, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "period", "offset": 0, "slot": "1", - "type": "t_enum(Period)2185" + "type": "t_enum(Period)952" }, { - "astId": 2219, + "astId": 986, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "ruled", "offset": 1, @@ -2470,7 +2495,7 @@ "type": "t_bool" }, { - "astId": 2221, + "astId": 988, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "lastPeriodChange", "offset": 0, @@ -2478,22 +2503,22 @@ "type": "t_uint256" }, { - "astId": 2225, + "astId": 992, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "rounds", "offset": 0, "slot": "3", - "type": "t_array(t_struct(Round)2242_storage)dyn_storage" + "type": "t_array(t_struct(Round)1009_storage)dyn_storage" } ], "numberOfBytes": "128" }, - "t_struct(DisputeKitNode)2267_storage": { + "t_struct(DisputeKitNode)1034_storage": { "encoding": "inplace", "label": "struct KlerosCore.DisputeKitNode", "members": [ { - "astId": 2256, + "astId": 1023, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "parent", "offset": 0, @@ -2501,7 +2526,7 @@ "type": "t_uint256" }, { - "astId": 2259, + "astId": 1026, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "children", "offset": 0, @@ -2509,15 +2534,15 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 2262, + "astId": 1029, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "disputeKit", "offset": 0, "slot": "2", - "type": "t_contract(IDisputeKit)2162" + "type": "t_contract(IDisputeKit)929" }, { - "astId": 2264, + "astId": 1031, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "needsFreezing", "offset": 20, @@ -2525,7 +2550,7 @@ "type": "t_bool" }, { - "astId": 2266, + "astId": 1033, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "depthLevel", "offset": 0, @@ -2535,12 +2560,12 @@ ], "numberOfBytes": "128" }, - "t_struct(Juror)2254_storage": { + "t_struct(Juror)1021_storage": { "encoding": "inplace", "label": "struct KlerosCore.Juror", "members": [ { - "astId": 2245, + "astId": 1012, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "courtIDs", "offset": 0, @@ -2548,7 +2573,7 @@ "type": "t_array(t_uint96)dyn_storage" }, { - "astId": 2249, + "astId": 1016, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "stakedTokens", "offset": 0, @@ -2556,7 +2581,7 @@ "type": "t_mapping(t_uint96,t_uint256)" }, { - "astId": 2253, + "astId": 1020, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "lockedTokens", "offset": 0, @@ -2566,12 +2591,12 @@ ], "numberOfBytes": "96" }, - "t_struct(Round)2242_storage": { + "t_struct(Round)1009_storage": { "encoding": "inplace", "label": "struct KlerosCore.Round", "members": [ { - "astId": 2228, + "astId": 995, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "disputeKitID", "offset": 0, @@ -2579,7 +2604,7 @@ "type": "t_uint256" }, { - "astId": 2230, + "astId": 997, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "tokensAtStakePerJuror", "offset": 0, @@ -2587,7 +2612,7 @@ "type": "t_uint256" }, { - "astId": 2232, + "astId": 999, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "totalFeesForJurors", "offset": 0, @@ -2595,7 +2620,7 @@ "type": "t_uint256" }, { - "astId": 2234, + "astId": 1001, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "nbVotes", "offset": 0, @@ -2603,7 +2628,7 @@ "type": "t_uint256" }, { - "astId": 2236, + "astId": 1003, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "repartitions", "offset": 0, @@ -2611,7 +2636,7 @@ "type": "t_uint256" }, { - "astId": 2238, + "astId": 1005, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "penalties", "offset": 0, @@ -2619,7 +2644,7 @@ "type": "t_uint256" }, { - "astId": 2241, + "astId": 1008, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "drawnJurors", "offset": 0, @@ -2629,12 +2654,12 @@ ], "numberOfBytes": "224" }, - "t_struct(SortitionSumTree)12401_storage": { + "t_struct(SortitionSumTree)19477_storage": { "encoding": "inplace", - "label": "struct SortitionSumTreeFactory.SortitionSumTree", + "label": "struct SortitionSumTreeFactoryV2.SortitionSumTree", "members": [ { - "astId": 12386, + "astId": 19462, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "K", "offset": 0, @@ -2642,7 +2667,7 @@ "type": "t_uint256" }, { - "astId": 12389, + "astId": 19465, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "stack", "offset": 0, @@ -2650,7 +2675,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 12392, + "astId": 19468, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "nodes", "offset": 0, @@ -2658,7 +2683,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 12396, + "astId": 19472, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "IDsToNodeIndexes", "offset": 0, @@ -2666,7 +2691,7 @@ "type": "t_mapping(t_bytes32,t_uint256)" }, { - "astId": 12400, + "astId": 19476, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "nodeIndexesToIDs", "offset": 0, @@ -2676,17 +2701,17 @@ ], "numberOfBytes": "160" }, - "t_struct(SortitionSumTrees)12407_storage": { + "t_struct(SortitionSumTrees)19483_storage": { "encoding": "inplace", - "label": "struct SortitionSumTreeFactory.SortitionSumTrees", + "label": "struct SortitionSumTreeFactoryV2.SortitionSumTrees", "members": [ { - "astId": 12406, + "astId": 19482, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "sortitionSumTrees", "offset": 0, "slot": "0", - "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)12401_storage)" + "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)19477_storage)" } ], "numberOfBytes": "32" diff --git a/contracts/deployments/arbitrumGoerli/PolicyRegistry.json b/contracts/deployments/arbitrumGoerli/PolicyRegistry.json index f937fb92b..4ebe4f897 100644 --- a/contracts/deployments/arbitrumGoerli/PolicyRegistry.json +++ b/contracts/deployments/arbitrumGoerli/PolicyRegistry.json @@ -1,5 +1,5 @@ { - "address": "0xAF0F49Fe110b48bd512F00d51D141F023c9a9106", + "address": "0xC5655728387Ce5E2aAA22138114E5777370aBDae", "abi": [ { "inputs": [ @@ -106,27 +106,27 @@ "type": "function" } ], - "transactionHash": "0xa41e224e83e5c1e17e649caed26e280c8250a740cd65cd6d8ae0f76043fb8186", + "transactionHash": "0x24abcff43c9cf135c11f7e1023e3db8b4b77a279d1db481462453ecbecca9c54", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xAF0F49Fe110b48bd512F00d51D141F023c9a9106", + "contractAddress": "0xC5655728387Ce5E2aAA22138114E5777370aBDae", "transactionIndex": 1, - "gasUsed": "2847520", + "gasUsed": "396958", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xbebb1da749776542ebaaee1c78f8092c913436e3e5f1028e87553e069d60cf86", - "transactionHash": "0xa41e224e83e5c1e17e649caed26e280c8250a740cd65cd6d8ae0f76043fb8186", + "blockHash": "0x2434db72d4dee1e05e4e397a9629937c2f0f513fe1299cc0960267c6d78258a1", + "transactionHash": "0x24abcff43c9cf135c11f7e1023e3db8b4b77a279d1db481462453ecbecca9c54", "logs": [], - "blockNumber": 4027973, - "cumulativeGasUsed": "2847520", + "blockNumber": 6456907, + "cumulativeGasUsed": "396958", "status": 1, "byzantium": true }, "args": [ "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" ], - "numDeployments": 4, - "solcInputHash": "8e4e08d76a7f02df476a9f91ae4ef934", + "numDeployments": 1, + "solcInputHash": "86ef3911afc4fb1dc9daa46f19a1d3ba", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"PolicyUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"policies\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_courtID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_courtName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"setPolicy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Enrique Piqueras - \",\"details\":\"A contract to maintain a policy for each court.\",\"events\":{\"PolicyUpdate(uint256,string,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_courtID\":\"The ID of the policy's court.\",\"_courtName\":\"The name of the policy's court.\",\"_policy\":\"The URI of the policy JSON.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructs the `PolicyRegistry` contract.\",\"params\":{\"_governor\":\"The governor's address.\"}},\"setPolicy(uint256,string,string)\":{\"details\":\"Sets the policy for the specified court.\",\"params\":{\"_courtID\":\"The ID of the specified court.\",\"_courtName\":\"The name of the specified court.\",\"_policy\":\"The URI of the policy JSON.\"}}},\"title\":\"PolicyRegistry\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/PolicyRegistry.sol\":\"PolicyRegistry\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/arbitration/PolicyRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8;\\n\\n/**\\n * @title PolicyRegistry\\n * @author Enrique Piqueras - \\n * @dev A contract to maintain a policy for each court.\\n */\\ncontract PolicyRegistry {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /**\\n * @dev Emitted when a policy is updated.\\n * @param _courtID The ID of the policy's court.\\n * @param _courtName The name of the policy's court.\\n * @param _policy The URI of the policy JSON.\\n */\\n event PolicyUpdate(uint256 indexed _courtID, string _courtName, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint256 => string) public policies;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Requires that the sender is the governor.\\n */\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"No allowed: governor only\\\");\\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /** @dev Constructs the `PolicyRegistry` contract.\\n * @param _governor The governor's address.\\n */\\n constructor(address _governor) {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Changes the `governor` storage variable.\\n * @param _governor The new value for the `governor` storage variable.\\n */\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Sets the policy for the specified court.\\n * @param _courtID The ID of the specified court.\\n * @param _courtName The name of the specified court.\\n * @param _policy The URI of the policy JSON.\\n */\\n function setPolicy(uint256 _courtID, string calldata _courtName, string calldata _policy) external onlyByGovernor {\\n policies[_courtID] = _policy;\\n emit PolicyUpdate(_courtID, _courtName, policies[_courtID]);\\n }\\n}\\n\",\"keccak256\":\"0xdc8205d9103d2e4d3f98721691ddbe8f999226cdc78d88ddcd9718f403fff960\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5060405161065a38038061065a83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6105c7806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063bdf7378014610081578063d3e8948314610096578063e4c0aaf4146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610333565b6100c9565b005b6100a96100a43660046103ad565b61016b565b60405161007891906103c6565b6100946100c436600461041b565b610205565b6000546001600160a01b031633146100fc5760405162461bcd60e51b81526004016100f39061044b565b60405180910390fd5b6000858152600160205260409020610115908383610251565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161015c939291906104b9565b60405180910390a25050505050565b600160205260009081526040902080546101849061047e565b80601f01602080910402602001604051908101604052809291908181526020018280546101b09061047e565b80156101fd5780601f106101d2576101008083540402835291602001916101fd565b820191906000526020600020905b8154815290600101906020018083116101e057829003601f168201915b505050505081565b6000546001600160a01b0316331461022f5760405162461bcd60e51b81526004016100f39061044b565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b82805461025d9061047e565b90600052602060002090601f01602090048101928261027f57600085556102c5565b82601f106102985782800160ff198235161785556102c5565b828001600101855582156102c5579182015b828111156102c55782358255916020019190600101906102aa565b506102d19291506102d5565b5090565b5b808211156102d157600081556001016102d6565b60008083601f8401126102fc57600080fd5b50813567ffffffffffffffff81111561031457600080fd5b60208301915083602082850101111561032c57600080fd5b9250929050565b60008060008060006060868803121561034b57600080fd5b85359450602086013567ffffffffffffffff8082111561036a57600080fd5b61037689838a016102ea565b9096509450604088013591508082111561038f57600080fd5b5061039c888289016102ea565b969995985093965092949392505050565b6000602082840312156103bf57600080fd5b5035919050565b600060208083528351808285015260005b818110156103f3578581018301518582016040015282016103d7565b81811115610405576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561042d57600080fd5b81356001600160a01b038116811461044457600080fd5b9392505050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b600181811c9082168061049257607f821691505b602082108114156104b357634e487b7160e01b600052602260045260246000fd5b50919050565b60408152826040820152828460608301376000808060608685010152601f19601f860116830160206060858303018186015282865484600182811c91508083168061050557607f831692505b85831081141561052357634e487b7160e01b88526022600452602488fd5b6060870183905260808701965080801561054457600181146105555761057f565b60ff1985168852868801955061057f565b60008c815260209020895b858110156105795781548a820152908401908801610560565b89019650505b50939c9b50505050505050505050505056fea264697066735822122060e39a877421ec3f435184c5bf619159738ca216935c7caabe5aa60b00a9043464736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063bdf7378014610081578063d3e8948314610096578063e4c0aaf4146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610333565b6100c9565b005b6100a96100a43660046103ad565b61016b565b60405161007891906103c6565b6100946100c436600461041b565b610205565b6000546001600160a01b031633146100fc5760405162461bcd60e51b81526004016100f39061044b565b60405180910390fd5b6000858152600160205260409020610115908383610251565b50847f61f7110245e82eddd3b134d1e1607420d4a4dcdab30f5abdbbc9c3485b5dd2a48585600160008a815260200190815260200160002060405161015c939291906104b9565b60405180910390a25050505050565b600160205260009081526040902080546101849061047e565b80601f01602080910402602001604051908101604052809291908181526020018280546101b09061047e565b80156101fd5780601f106101d2576101008083540402835291602001916101fd565b820191906000526020600020905b8154815290600101906020018083116101e057829003601f168201915b505050505081565b6000546001600160a01b0316331461022f5760405162461bcd60e51b81526004016100f39061044b565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b82805461025d9061047e565b90600052602060002090601f01602090048101928261027f57600085556102c5565b82601f106102985782800160ff198235161785556102c5565b828001600101855582156102c5579182015b828111156102c55782358255916020019190600101906102aa565b506102d19291506102d5565b5090565b5b808211156102d157600081556001016102d6565b60008083601f8401126102fc57600080fd5b50813567ffffffffffffffff81111561031457600080fd5b60208301915083602082850101111561032c57600080fd5b9250929050565b60008060008060006060868803121561034b57600080fd5b85359450602086013567ffffffffffffffff8082111561036a57600080fd5b61037689838a016102ea565b9096509450604088013591508082111561038f57600080fd5b5061039c888289016102ea565b969995985093965092949392505050565b6000602082840312156103bf57600080fd5b5035919050565b600060208083528351808285015260005b818110156103f3578581018301518582016040015282016103d7565b81811115610405576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561042d57600080fd5b81356001600160a01b038116811461044457600080fd5b9392505050565b6020808252601990820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b604082015260600190565b600181811c9082168061049257607f821691505b602082108114156104b357634e487b7160e01b600052602260045260246000fd5b50919050565b60408152826040820152828460608301376000808060608685010152601f19601f860116830160206060858303018186015282865484600182811c91508083168061050557607f831692505b85831081141561052357634e487b7160e01b88526022600452602488fd5b6060870183905260808701965080801561054457600181146105555761057f565b60ff1985168852868801955061057f565b60008c815260209020895b858110156105795781548a820152908401908801610560565b89019650505b50939c9b50505050505050505050505056fea264697066735822122060e39a877421ec3f435184c5bf619159738ca216935c7caabe5aa60b00a9043464736f6c63430008090033", @@ -177,7 +177,7 @@ "storageLayout": { "storage": [ { - "astId": 7415, + "astId": 7931, "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", "label": "governor", "offset": 0, @@ -185,7 +185,7 @@ "type": "t_address" }, { - "astId": 7419, + "astId": 7935, "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", "label": "policies", "offset": 0, diff --git a/contracts/deployments/arbitrumGoerli/RandomizerRNG.json b/contracts/deployments/arbitrumGoerli/RandomizerRNG.json index 3bf93097b..5c809c130 100644 --- a/contracts/deployments/arbitrumGoerli/RandomizerRNG.json +++ b/contracts/deployments/arbitrumGoerli/RandomizerRNG.json @@ -1,5 +1,5 @@ { - "address": "0xb82D1eAD813C3a2E729F288276cc402343423Bad", + "address": "0xa2d1A3CDF0becEdb724e5A34De7022B6FF5e4787", "abi": [ { "inputs": [ @@ -19,7 +19,7 @@ }, { "inputs": [], - "name": "CALLBACK_GAS_LIMIT", + "name": "callbackGasLimit", "outputs": [ { "internalType": "uint256", @@ -59,9 +59,9 @@ { "inputs": [ { - "internalType": "uint128", + "internalType": "uint256", "name": "", - "type": "uint128" + "type": "uint256" } ], "name": "randomNumbers", @@ -91,9 +91,9 @@ { "inputs": [ { - "internalType": "uint128", + "internalType": "uint256", "name": "_id", - "type": "uint128" + "type": "uint256" }, { "internalType": "bytes32", @@ -162,40 +162,66 @@ "name": "requesterToID", "outputs": [ { - "internalType": "uint128", + "internalType": "uint256", "name": "", - "type": "uint128" + "type": "uint256" } ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_callbackGasLimit", + "type": "uint256" + } + ], + "name": "setCallbackGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_randomizer", + "type": "address" + } + ], + "name": "setRandomizer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } ], - "transactionHash": "0xa181a21cd4a0f43618c9bafd33f75eb5081a899621653772493c8f43b55736d0", + "transactionHash": "0x0f493fba00e47f23390427dcb97571f50c5b167e5668f38f57525f6b10221274", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xb82D1eAD813C3a2E729F288276cc402343423Bad", + "contractAddress": "0xa2d1A3CDF0becEdb724e5A34De7022B6FF5e4787", "transactionIndex": 1, - "gasUsed": "2513664", + "gasUsed": "409376", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x28d1d380c32cb02551206f07079570881cbbb82e68917bff0bc78868ff15dc5c", - "transactionHash": "0xa181a21cd4a0f43618c9bafd33f75eb5081a899621653772493c8f43b55736d0", + "blockHash": "0xbcb74c94ab416ff89bdbeb6f7c3001f824891adede77a567bcc3aef07a7e5b60", + "transactionHash": "0x0f493fba00e47f23390427dcb97571f50c5b167e5668f38f57525f6b10221274", "logs": [], - "blockNumber": 4027975, - "cumulativeGasUsed": "2513664", + "blockNumber": 6456820, + "cumulativeGasUsed": "409376", "status": 1, "byzantium": true }, "args": [ - "0xE1B6CcAc0BB0355C01A049e78909231Bfa13620B", + "0x57F7a8aA8291A04B325F3f0d2c4d03353d3Ef25f", "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" ], - "numDeployments": 2, - "solcInputHash": "8e4e08d76a7f02df476a9f91ae4ef934", - "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"_randomizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CALLBACK_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"name\":\"randomNumbers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomizer\",\"outputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_id\",\"type\":\"uint128\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"randomizerCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"randomizerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receiveRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"randomNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"requesterToID\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor of the contract.\",\"params\":{\"_governor\":\"The new governor.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_governor\":\"Governor of the contract.\",\"_randomizer\":\"Randomizer contract.\"}},\"randomizerCallback(uint128,bytes32)\":{\"details\":\"Callback function called by the randomizer contract when the random value is generated.\"},\"randomizerWithdraw(uint256)\":{\"details\":\"Allows the governor to withdraw randomizer funds.\",\"params\":{\"_amount\":\"Amount to withdraw in wei.\"}},\"receiveRandomness(uint256)\":{\"details\":\"Return the random number.\",\"returns\":{\"randomNumber\":\"The random number or 0 if it is not ready or has not been requested.\"}},\"requestRandomness(uint256)\":{\"details\":\"Request a random number. The id of the request is tied to the sender.\"}},\"title\":\"Random Number Generator that uses Randomizer.ai https://randomizer.ai/\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/RandomizerRNG.sol\":\"RandomizerRNG\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/rng/IRandomizer.sol\":{\"content\":\"// Randomizer protocol interface\\ninterface IRandomizer {\\n function request(uint256 callbackGasLimit) external returns (uint256);\\n\\n function clientWithdrawTo(address _to, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x4bf30691fbfcf344ea0dabfdfe60841ba9982c5f81ee7b8f4313de005df456f9\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface RNG {\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRandomness(uint256 _block) external;\\n\\n /**\\n * @dev Receive the random number.\\n * @param _block Block the random number is linked to.\\n * @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x0075973344648673365c5a895e4315101e6ce896208a71eb7767f5a61bbf0fe1\",\"license\":\"MIT\"},\"src/rng/RandomizerRNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./RNG.sol\\\";\\nimport \\\"./IRandomizer.sol\\\";\\n\\n/**\\n * @title Random Number Generator that uses Randomizer.ai\\n * https://randomizer.ai/\\n */\\ncontract RandomizerRNG is RNG {\\n uint256 public constant CALLBACK_GAS_LIMIT = 50000;\\n address public governor; // The address that can withdraw funds.\\n\\n IRandomizer public randomizer; // Randomizer address.\\n mapping(uint128 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise.\\n mapping(address => uint128) public requesterToID; // Maps the requester to his latest request ID.\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _randomizer Randomizer contract.\\n * @param _governor Governor of the contract.\\n */\\n constructor(IRandomizer _randomizer, address _governor) {\\n randomizer = _randomizer;\\n governor = _governor;\\n }\\n\\n /** @dev Changes the governor of the contract.\\n * @param _governor The new governor.\\n */\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /**\\n * @dev Request a random number. The id of the request is tied to the sender.\\n */\\n function requestRandomness(uint256 /*_block*/) external override {\\n uint128 id = uint128(randomizer.request(CALLBACK_GAS_LIMIT));\\n requesterToID[msg.sender] = id;\\n }\\n\\n /**\\n * @dev Return the random number.\\n * @return randomNumber The random number or 0 if it is not ready or has not been requested.\\n */\\n function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) {\\n // Get the latest request ID for this requester.\\n uint128 id = requesterToID[msg.sender];\\n randomNumber = randomNumbers[id];\\n }\\n\\n /**\\n * @dev Callback function called by the randomizer contract when the random value is generated.\\n */\\n function randomizerCallback(uint128 _id, bytes32 _value) external {\\n require(msg.sender == address(randomizer), \\\"Caller not Randomizer\\\");\\n randomNumbers[_id] = uint256(_value);\\n }\\n\\n /**\\n * @dev Allows the governor to withdraw randomizer funds.\\n * @param _amount Amount to withdraw in wei.\\n */\\n function randomizerWithdraw(uint256 _amount) external onlyByGovernor {\\n randomizer.clientWithdrawTo(msg.sender, _amount);\\n }\\n}\\n\",\"keccak256\":\"0xfce1c19809663a056cdf5c7082e8ba8d808fb40103bfdb0c1a3b1b9047a5108e\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516105c63803806105c683398101604081905261002f91610078565b600180546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556100b2565b6001600160a01b038116811461007557600080fd5b50565b6000806040838503121561008b57600080fd5b825161009681610060565b60208401519092506100a781610060565b809150509250929050565b610505806100c16000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80634e07c939116100665780634e07c9391461015757806371d4b00b1461016a5780637363ae1f146101ab578063e4c0aaf4146101be578063f10fb584146101d157600080fd5b80630c340a24146100a357806313cf9054146100d35780631dfcc23f1461011957806321e46a1a1461012e57806333d608f11461014e575b600080fd5b6000546100b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61010b6100e13660046103e5565b50336000908152600360209081526040808320546001600160801b03168352600290915290205490565b6040519081526020016100ca565b61012c61012736600461041a565b6101e4565b005b61010b61013c366004610444565b60026020526000908152604090205481565b61010b61c35081565b61012c6101653660046103e5565b610257565b610193610178366004610466565b6003602052600090815260409020546001600160801b031681565b6040516001600160801b0390911681526020016100ca565b61012c6101b93660046103e5565b6102e8565b61012c6101cc366004610466565b610399565b6001546100b6906001600160a01b031681565b6001546001600160a01b0316331461023b5760405162461bcd60e51b815260206004820152601560248201527421b0b63632b9103737ba102930b73237b6b4bd32b960591b60448201526064015b60405180910390fd5b6001600160801b03909116600090815260026020526040902055565b6000546001600160a01b031633146102815760405162461bcd60e51b81526004016102329061048f565b600154604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b5050505050565b60015460405163d845a4b360e01b815261c35060048201526000916001600160a01b03169063d845a4b390602401602060405180830381600087803b15801561033057600080fd5b505af1158015610344573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036891906104b6565b33600090815260036020526040902080546001600160801b0319166001600160801b03929092169190911790555050565b6000546001600160a01b031633146103c35760405162461bcd60e51b81526004016102329061048f565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000602082840312156103f757600080fd5b5035919050565b80356001600160801b038116811461041557600080fd5b919050565b6000806040838503121561042d57600080fd5b610436836103fe565b946020939093013593505050565b60006020828403121561045657600080fd5b61045f826103fe565b9392505050565b60006020828403121561047857600080fd5b81356001600160a01b038116811461045f57600080fd5b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104c857600080fd5b505191905056fea2646970667358221220dcda61f0eb0832fc83fecdd1784ace5a85912df421259d09350ee75d641047b964736f6c63430008090033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80634e07c939116100665780634e07c9391461015757806371d4b00b1461016a5780637363ae1f146101ab578063e4c0aaf4146101be578063f10fb584146101d157600080fd5b80630c340a24146100a357806313cf9054146100d35780631dfcc23f1461011957806321e46a1a1461012e57806333d608f11461014e575b600080fd5b6000546100b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61010b6100e13660046103e5565b50336000908152600360209081526040808320546001600160801b03168352600290915290205490565b6040519081526020016100ca565b61012c61012736600461041a565b6101e4565b005b61010b61013c366004610444565b60026020526000908152604090205481565b61010b61c35081565b61012c6101653660046103e5565b610257565b610193610178366004610466565b6003602052600090815260409020546001600160801b031681565b6040516001600160801b0390911681526020016100ca565b61012c6101b93660046103e5565b6102e8565b61012c6101cc366004610466565b610399565b6001546100b6906001600160a01b031681565b6001546001600160a01b0316331461023b5760405162461bcd60e51b815260206004820152601560248201527421b0b63632b9103737ba102930b73237b6b4bd32b960591b60448201526064015b60405180910390fd5b6001600160801b03909116600090815260026020526040902055565b6000546001600160a01b031633146102815760405162461bcd60e51b81526004016102329061048f565b600154604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b5050505050565b60015460405163d845a4b360e01b815261c35060048201526000916001600160a01b03169063d845a4b390602401602060405180830381600087803b15801561033057600080fd5b505af1158015610344573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036891906104b6565b33600090815260036020526040902080546001600160801b0319166001600160801b03929092169190911790555050565b6000546001600160a01b031633146103c35760405162461bcd60e51b81526004016102329061048f565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000602082840312156103f757600080fd5b5035919050565b80356001600160801b038116811461041557600080fd5b919050565b6000806040838503121561042d57600080fd5b610436836103fe565b946020939093013593505050565b60006020828403121561045657600080fd5b61045f826103fe565b9392505050565b60006020828403121561047857600080fd5b81356001600160a01b038116811461045f57600080fd5b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104c857600080fd5b505191905056fea2646970667358221220dcda61f0eb0832fc83fecdd1784ace5a85912df421259d09350ee75d641047b964736f6c63430008090033", + "numDeployments": 5, + "solcInputHash": "86ef3911afc4fb1dc9daa46f19a1d3ba", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"_randomizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"callbackGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"randomNumbers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomizer\",\"outputs\":[{\"internalType\":\"contract IRandomizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"randomizerCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"randomizerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"receiveRandomness\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"randomNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"requestRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"requesterToID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_callbackGasLimit\",\"type\":\"uint256\"}],\"name\":\"setCallbackGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_randomizer\",\"type\":\"address\"}],\"name\":\"setRandomizer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the governor of the contract.\",\"params\":{\"_governor\":\"The new governor.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_governor\":\"Governor of the contract.\",\"_randomizer\":\"Randomizer contract.\"}},\"randomizerCallback(uint256,bytes32)\":{\"details\":\"Callback function called by the randomizer contract when the random value is generated.\"},\"randomizerWithdraw(uint256)\":{\"details\":\"Allows the governor to withdraw randomizer funds.\",\"params\":{\"_amount\":\"Amount to withdraw in wei.\"}},\"receiveRandomness(uint256)\":{\"details\":\"Return the random number.\",\"returns\":{\"randomNumber\":\"The random number or 0 if it is not ready or has not been requested.\"}},\"requestRandomness(uint256)\":{\"details\":\"Request a random number. The id of the request is tied to the sender.\"},\"setCallbackGasLimit(uint256)\":{\"details\":\"Change the Randomizer callback gas limit.\",\"params\":{\"_callbackGasLimit\":\"the new limit.\"}},\"setRandomizer(address)\":{\"details\":\"Change the Randomizer address.\",\"params\":{\"_randomizer\":\"the new Randomizer address.\"}}},\"title\":\"Random Number Generator that uses Randomizer.ai https://randomizer.ai/\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/RandomizerRNG.sol\":\"RandomizerRNG\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/rng/IRandomizer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\n// Randomizer protocol interface\\ninterface IRandomizer {\\n function request(uint256 callbackGasLimit) external returns (uint256);\\n\\n function clientWithdrawTo(address _to, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x8b21dab12f712e8e9a7b8e68e6d350833d13e95f425544dd4977a1490aa02d5b\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface RNG {\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRandomness(uint256 _block) external;\\n\\n /**\\n * @dev Receive the random number.\\n * @param _block Block the random number is linked to.\\n * @return randomNumber Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function receiveRandomness(uint256 _block) external returns (uint256 randomNumber);\\n}\\n\",\"keccak256\":\"0x0075973344648673365c5a895e4315101e6ce896208a71eb7767f5a61bbf0fe1\",\"license\":\"MIT\"},\"src/rng/RandomizerRNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./RNG.sol\\\";\\nimport \\\"./IRandomizer.sol\\\";\\n\\n/**\\n * @title Random Number Generator that uses Randomizer.ai\\n * https://randomizer.ai/\\n */\\ncontract RandomizerRNG is RNG {\\n address public governor; // The address that can withdraw funds.\\n uint256 public callbackGasLimit = 50000; // Gas limit for the randomizer callback\\n\\n IRandomizer public randomizer; // Randomizer address.\\n mapping(uint256 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise.\\n mapping(address => uint256) public requesterToID; // Maps the requester to his latest request ID.\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Governor only\\\");\\n _;\\n }\\n\\n /** @dev Constructor.\\n * @param _randomizer Randomizer contract.\\n * @param _governor Governor of the contract.\\n */\\n constructor(IRandomizer _randomizer, address _governor) {\\n randomizer = _randomizer;\\n governor = _governor;\\n }\\n\\n // ************************ //\\n // * Governance * //\\n // ************************ //\\n\\n /** @dev Changes the governor of the contract.\\n * @param _governor The new governor.\\n */\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Change the Randomizer callback gas limit.\\n * @param _callbackGasLimit the new limit.\\n */\\n function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyByGovernor {\\n callbackGasLimit = _callbackGasLimit;\\n }\\n\\n /** @dev Change the Randomizer address.\\n * @param _randomizer the new Randomizer address.\\n */\\n function setRandomizer(address _randomizer) external onlyByGovernor {\\n randomizer = IRandomizer(_randomizer);\\n }\\n\\n /**\\n * @dev Allows the governor to withdraw randomizer funds.\\n * @param _amount Amount to withdraw in wei.\\n */\\n function randomizerWithdraw(uint256 _amount) external onlyByGovernor {\\n randomizer.clientWithdrawTo(msg.sender, _amount);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Request a random number. The id of the request is tied to the sender.\\n */\\n function requestRandomness(uint256 /*_block*/) external override {\\n uint256 id = randomizer.request(callbackGasLimit);\\n requesterToID[msg.sender] = id;\\n }\\n\\n /**\\n * @dev Callback function called by the randomizer contract when the random value is generated.\\n */\\n function randomizerCallback(uint256 _id, bytes32 _value) external {\\n require(msg.sender == address(randomizer), \\\"Randomizer only\\\");\\n randomNumbers[_id] = uint256(_value);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Return the random number.\\n * @return randomNumber The random number or 0 if it is not ready or has not been requested.\\n */\\n function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) {\\n // Get the latest request ID for this requester.\\n uint256 id = requesterToID[msg.sender];\\n randomNumber = randomNumbers[id];\\n }\\n}\\n\",\"keccak256\":\"0x44df43aee56688f68ff7934777b6ae9f86ed253067d2a42555bc6291f220ed34\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405261c35060015534801561001657600080fd5b506040516105f43803806105f48339810160408190526100359161007e565b600280546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556100b8565b6001600160a01b038116811461007b57600080fd5b50565b6000806040838503121561009157600080fd5b825161009c81610066565b60208401519092506100ad81610066565b809150509250929050565b61052d806100c76000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80637363ae1f116100715780637363ae1f14610184578063767bcab5146101975780638a54942f146101aa578063e4c0aaf4146101bd578063ebe93caf146101d0578063f10fb584146101e357600080fd5b80630c340a24146100b957806313cf9054146100e957806324f74697146101265780634e07c9391461012f5780635257cd901461014457806371d4b00b14610164575b600080fd5b6000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101186100f736600461044c565b50336000908152600460209081526040808320548352600390915290205490565b6040519081526020016100e0565b61011860015481565b61014261013d36600461044c565b6101f6565b005b61011861015236600461044c565b60036020526000908152604090205481565b610118610172366004610465565b60046020526000908152604090205481565b61014261019236600461044c565b610290565b6101426101a5366004610465565b610327565b6101426101b836600461044c565b610373565b6101426101cb366004610465565b6103a2565b6101426101de366004610495565b6103ee565b6002546100cc906001600160a01b031681565b6000546001600160a01b031633146102295760405162461bcd60e51b8152600401610220906104b7565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b5050505050565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b390602401602060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031391906104de565b336000908152600460205260409020555050565b6000546001600160a01b031633146103515760405162461bcd60e51b8152600401610220906104b7565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461039d5760405162461bcd60e51b8152600401610220906104b7565b600155565b6000546001600160a01b031633146103cc5760405162461bcd60e51b8152600401610220906104b7565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461043a5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b6044820152606401610220565b60009182526003602052604090912055565b60006020828403121561045e57600080fd5b5035919050565b60006020828403121561047757600080fd5b81356001600160a01b038116811461048e57600080fd5b9392505050565b600080604083850312156104a857600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104f057600080fd5b505191905056fea2646970667358221220239569f93492563147dac9c5bfcbcc6043df703346a964aed4ee07545ad93c2964736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80637363ae1f116100715780637363ae1f14610184578063767bcab5146101975780638a54942f146101aa578063e4c0aaf4146101bd578063ebe93caf146101d0578063f10fb584146101e357600080fd5b80630c340a24146100b957806313cf9054146100e957806324f74697146101265780634e07c9391461012f5780635257cd901461014457806371d4b00b14610164575b600080fd5b6000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101186100f736600461044c565b50336000908152600460209081526040808320548352600390915290205490565b6040519081526020016100e0565b61011860015481565b61014261013d36600461044c565b6101f6565b005b61011861015236600461044c565b60036020526000908152604090205481565b610118610172366004610465565b60046020526000908152604090205481565b61014261019236600461044c565b610290565b6101426101a5366004610465565b610327565b6101426101b836600461044c565b610373565b6101426101cb366004610465565b6103a2565b6101426101de366004610495565b6103ee565b6002546100cc906001600160a01b031681565b6000546001600160a01b031633146102295760405162461bcd60e51b8152600401610220906104b7565b60405180910390fd5b600254604051632465f8f560e01b8152336004820152602481018390526001600160a01b0390911690632465f8f590604401600060405180830381600087803b15801561027557600080fd5b505af1158015610289573d6000803e3d6000fd5b5050505050565b60025460015460405163d845a4b360e01b815260048101919091526000916001600160a01b03169063d845a4b390602401602060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031391906104de565b336000908152600460205260409020555050565b6000546001600160a01b031633146103515760405162461bcd60e51b8152600401610220906104b7565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461039d5760405162461bcd60e51b8152600401610220906104b7565b600155565b6000546001600160a01b031633146103cc5760405162461bcd60e51b8152600401610220906104b7565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461043a5760405162461bcd60e51b815260206004820152600f60248201526e52616e646f6d697a6572206f6e6c7960881b6044820152606401610220565b60009182526003602052604090912055565b60006020828403121561045e57600080fd5b5035919050565b60006020828403121561047757600080fd5b81356001600160a01b038116811461048e57600080fd5b9392505050565b600080604083850312156104a857600080fd5b50508035926020909101359150565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b6000602082840312156104f057600080fd5b505191905056fea2646970667358221220239569f93492563147dac9c5bfcbcc6043df703346a964aed4ee07545ad93c2964736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { @@ -212,7 +238,7 @@ "_randomizer": "Randomizer contract." } }, - "randomizerCallback(uint128,bytes32)": { + "randomizerCallback(uint256,bytes32)": { "details": "Callback function called by the randomizer contract when the random value is generated." }, "randomizerWithdraw(uint256)": { @@ -229,6 +255,18 @@ }, "requestRandomness(uint256)": { "details": "Request a random number. The id of the request is tied to the sender." + }, + "setCallbackGasLimit(uint256)": { + "details": "Change the Randomizer callback gas limit.", + "params": { + "_callbackGasLimit": "the new limit." + } + }, + "setRandomizer(address)": { + "details": "Change the Randomizer address.", + "params": { + "_randomizer": "the new Randomizer address." + } } }, "title": "Random Number Generator that uses Randomizer.ai https://randomizer.ai/", @@ -242,7 +280,7 @@ "storageLayout": { "storage": [ { - "astId": 17220, + "astId": 23750, "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", "label": "governor", "offset": 0, @@ -250,28 +288,36 @@ "type": "t_address" }, { - "astId": 17223, + "astId": 23753, "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "randomizer", + "label": "callbackGasLimit", "offset": 0, "slot": "1", - "type": "t_contract(IRandomizer)17151" + "type": "t_uint256" }, { - "astId": 17227, + "astId": 23756, "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "randomNumbers", + "label": "randomizer", "offset": 0, "slot": "2", - "type": "t_mapping(t_uint128,t_uint256)" + "type": "t_contract(IRandomizer)23684" }, { - "astId": 17231, + "astId": 23760, "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", - "label": "requesterToID", + "label": "randomNumbers", "offset": 0, "slot": "3", - "type": "t_mapping(t_address,t_uint128)" + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 23764, + "contract": "src/rng/RandomizerRNG.sol:RandomizerRNG", + "label": "requesterToID", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_uint256)" } ], "types": { @@ -280,30 +326,25 @@ "label": "address", "numberOfBytes": "20" }, - "t_contract(IRandomizer)17151": { + "t_contract(IRandomizer)23684": { "encoding": "inplace", "label": "contract IRandomizer", "numberOfBytes": "20" }, - "t_mapping(t_address,t_uint128)": { + "t_mapping(t_address,t_uint256)": { "encoding": "mapping", "key": "t_address", - "label": "mapping(address => uint128)", + "label": "mapping(address => uint256)", "numberOfBytes": "32", - "value": "t_uint128" + "value": "t_uint256" }, - "t_mapping(t_uint128,t_uint256)": { + "t_mapping(t_uint256,t_uint256)": { "encoding": "mapping", - "key": "t_uint128", - "label": "mapping(uint128 => uint256)", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", "numberOfBytes": "32", "value": "t_uint256" }, - "t_uint128": { - "encoding": "inplace", - "label": "uint128", - "numberOfBytes": "16" - }, "t_uint256": { "encoding": "inplace", "label": "uint256", diff --git a/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json b/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json deleted file mode 100644 index cb977e8a1..000000000 --- a/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "address": "0x40a78989317B953e427B3BD87C59eA003fcC2296", - "abi": [], - "transactionHash": "0xd9e4db9675bdc3d1934b43fafec871592d7d37952920460b4d11f1d66cf810bd", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x40a78989317B953e427B3BD87C59eA003fcC2296", - "transactionIndex": 1, - "gasUsed": "9962334", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd0140bbbd3cf04ab840c816b050231f2ffe1da508010c9e14cc7c53656e1008e", - "transactionHash": "0xd9e4db9675bdc3d1934b43fafec871592d7d37952920460b4d11f1d66cf810bd", - "logs": [], - "blockNumber": 997974, - "cumulativeGasUsed": "9962334", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 2, - "solcInputHash": "f57208d12ea18de1e79aa93372bf0e19", - "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\",\"kind\":\"dev\",\"methods\":{\"createTree(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)\":{\"details\":\"Create a sortition sum tree at the specified key.\",\"params\":{\"_K\":\"The number of children each node in the tree should have.\",\"_key\":\"The key of the new tree.\"}},\"queryLeafs(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,uint256)\":{\"details\":\"Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\",\"params\":{\"_count\":\"The number of items to return.\",\"_cursor\":\"The pagination cursor.\",\"_key\":\"The key of the tree to get the leaves from.\"},\"returns\":{\"hasMore\":\"Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.\",\"startIndex\":\"The index at which leaves start.\",\"values\":\"The values of the returned leaves.\"}},\"set(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,bytes32)\":{\"details\":\"Set a value of a tree.\",\"params\":{\"_ID\":\"The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.\",\"_key\":\"The key of the tree.\",\"_value\":\"The new value.\"}},\"stakeOf(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,bytes32)\":{\"details\":\"Gets a specified ID's associated value.\",\"params\":{\"_ID\":\"The ID of the value.\",\"_key\":\"The key of the tree.\"},\"returns\":{\"value\":\"The associated value.\"}}},\"title\":\"SortitionSumTreeFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/data-structures/SortitionSumTreeFactory.sol\":\"SortitionSumTreeFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/data-structures/SortitionSumTreeFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactory\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactory {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _K\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _value,\\n bytes32 _ID\\n ) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n )\\n external\\n view\\n returns (\\n uint256 startIndex,\\n uint256[] memory values,\\n bool hasMore\\n )\\n {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n bytes32 _ID\\n ) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x158abfe345fecd93d3d6de008c01f4f72ffb03af5c6fbdf0208c7228fc978114\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x61096861003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632e25c38a1461005b57806365b81f4f1461007d5780637521ccb1146100a85780639075789e146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220e3ce267a72dce977fefce2bfaf8b7d2ad737e92e31686d6dfbcf38d6aa6b9e9664736f6c63430008090033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632e25c38a1461005b57806365b81f4f1461007d5780637521ccb1146100a85780639075789e146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220e3ce267a72dce977fefce2bfaf8b7d2ad737e92e31686d6dfbcf38d6aa6b9e9664736f6c63430008090033", - "devdoc": { - "details": "A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.", - "kind": "dev", - "methods": { - "createTree(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)": { - "details": "Create a sortition sum tree at the specified key.", - "params": { - "_K": "The number of children each node in the tree should have.", - "_key": "The key of the new tree." - } - }, - "queryLeafs(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,uint256)": { - "details": "Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.", - "params": { - "_count": "The number of items to return.", - "_cursor": "The pagination cursor.", - "_key": "The key of the tree to get the leaves from." - }, - "returns": { - "hasMore": "Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.", - "startIndex": "The index at which leaves start.", - "values": "The values of the returned leaves." - } - }, - "set(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,bytes32)": { - "details": "Set a value of a tree.", - "params": { - "_ID": "The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.", - "_key": "The key of the tree.", - "_value": "The new value." - } - }, - "stakeOf(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,bytes32)": { - "details": "Gets a specified ID's associated value.", - "params": { - "_ID": "The ID of the value.", - "_key": "The key of the tree." - }, - "returns": { - "value": "The associated value." - } - } - }, - "title": "SortitionSumTreeFactory", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} diff --git a/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactoryV2.json b/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactoryV2.json new file mode 100644 index 000000000..334479dba --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactoryV2.json @@ -0,0 +1,81 @@ +{ + "address": "0x678E676fd0048da8c35d5B03fabB53a7beBf73A6", + "abi": [], + "transactionHash": "0xd45c32c251bbdb23999a730410a5b1eb3a2cc8acf5d7d6e05d8b2270fb8c5091", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x678E676fd0048da8c35d5B03fabB53a7beBf73A6", + "transactionIndex": 1, + "gasUsed": "573063", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb09d0289f4f2c5e5250d41a425c10458d98997ec793904708db0a83b0dc9e362", + "transactionHash": "0xd45c32c251bbdb23999a730410a5b1eb3a2cc8acf5d7d6e05d8b2270fb8c5091", + "logs": [], + "blockNumber": 6456827, + "cumulativeGasUsed": "573063", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "385558cd8f2e0323787dead6b7cecab9", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\",\"kind\":\"dev\",\"methods\":{\"createTree(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256)\":{\"details\":\"Create a sortition sum tree at the specified key.\",\"params\":{\"_K\":\"The number of children each node in the tree should have.\",\"_key\":\"The key of the new tree.\"}},\"queryLeafs(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256,uint256)\":{\"details\":\"Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\",\"params\":{\"_count\":\"The number of items to return.\",\"_cursor\":\"The pagination cursor.\",\"_key\":\"The key of the tree to get the leaves from.\"},\"returns\":{\"hasMore\":\"Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.\",\"startIndex\":\"The index at which leaves start.\",\"values\":\"The values of the returned leaves.\"}},\"set(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256,bytes32)\":{\"details\":\"Set a value of a tree.\",\"params\":{\"_ID\":\"The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.\",\"_key\":\"The key of the tree.\",\"_value\":\"The new value.\"}},\"stakeOf(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,bytes32)\":{\"details\":\"Gets a specified ID's associated value.\",\"params\":{\"_ID\":\"The ID of the value.\",\"_key\":\"The key of the tree.\"},\"returns\":{\"value\":\"The associated value.\"}}},\"title\":\"SortitionSumTreeFactoryV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/libraries/SortitionSumTreeFactoryV2.sol\":\"SortitionSumTreeFactoryV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/libraries/SortitionSumTreeFactoryV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactoryV2\\n * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.\\n */\\nlibrary SortitionSumTreeFactoryV2 {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint256 K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint256[] stack;\\n uint256[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint256) IDsToNodeIndexes;\\n mapping(uint256 => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(SortitionSumTrees storage self, bytes32 _key, uint256 _K) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(SortitionSumTrees storage self, bytes32 _key, uint256 _value, bytes32 _ID) external {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint256 parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint256 newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint256 value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint256 plusOrMinusValue = plusOrMinus\\n ? _value - tree.nodes[treeIndex]\\n : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _cursor,\\n uint256 _count\\n ) external view returns (uint256 startIndex, uint256[] memory values, bool hasMore) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint256 i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint256 loopStartIndex = startIndex + _cursor;\\n values = new uint256[](\\n loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count\\n );\\n uint256 valuesIndex = 0;\\n for (uint256 j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) external view returns (uint256 value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint256 treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Whether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint256 _treeIndex,\\n bool _plusOrMinus,\\n uint256 _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint256 parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x68d9aee384a067204cd8b1b68641fb50e28e38b6d8137877d7052011108f9c6b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x61096861003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c806352557db41461005b578063574dd4321461007d578063b8ea8ad0146100a8578063de0fe69d146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220c1b72654851c3881bad46855d6d8ace36dde5b71b0a7eceb69eaa7a6e0276d2164736f6c63430008090033", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c806352557db41461005b578063574dd4321461007d578063b8ea8ad0146100a8578063de0fe69d146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220c1b72654851c3881bad46855d6d8ace36dde5b71b0a7eceb69eaa7a6e0276d2164736f6c63430008090033", + "devdoc": { + "details": "A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler.", + "kind": "dev", + "methods": { + "createTree(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256)": { + "details": "Create a sortition sum tree at the specified key.", + "params": { + "_K": "The number of children each node in the tree should have.", + "_key": "The key of the new tree." + } + }, + "queryLeafs(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256,uint256)": { + "details": "Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.", + "params": { + "_count": "The number of items to return.", + "_cursor": "The pagination cursor.", + "_key": "The key of the tree to get the leaves from." + }, + "returns": { + "hasMore": "Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.", + "startIndex": "The index at which leaves start.", + "values": "The values of the returned leaves." + } + }, + "set(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,uint256,bytes32)": { + "details": "Set a value of a tree.", + "params": { + "_ID": "The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.", + "_key": "The key of the tree.", + "_value": "The new value." + } + }, + "stakeOf(SortitionSumTreeFactoryV2.SortitionSumTrees storage,bytes32,bytes32)": { + "details": "Gets a specified ID's associated value.", + "params": { + "_ID": "The ID of the value.", + "_key": "The key of the tree." + }, + "returns": { + "value": "The associated value." + } + } + }, + "title": "SortitionSumTreeFactoryV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/chiado/.chainId b/contracts/deployments/chiado/.chainId new file mode 100644 index 000000000..6cd35a3ed --- /dev/null +++ b/contracts/deployments/chiado/.chainId @@ -0,0 +1 @@ +10200 \ No newline at end of file diff --git a/contracts/deployments/chiado/ArbitrableExample.json b/contracts/deployments/chiado/ArbitrableExample.json new file mode 100644 index 000000000..1b0af8142 --- /dev/null +++ b/contracts/deployments/chiado/ArbitrableExample.json @@ -0,0 +1,451 @@ +{ + "address": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_metaEvidence", + "type": "string" + }, + { + "internalType": "contract ERC20", + "name": "_weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_evidenceGroupID", + "type": "uint256" + } + ], + "name": "Dispute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "_evidence", + "type": "string" + } + ], + "name": "MetaEvidence", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "inputs": [], + "name": "arbitrator", + "outputs": [ + { + "internalType": "contract IArbitrator", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + } + ], + "name": "changeArbitrator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_metaEvidence", + "type": "string" + } + ], + "name": "changeMetaEvidence", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numberOfRulingOptions", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_arbitratorExtraData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_metaEvidenceID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_evidenceGroupID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeInWeth", + "type": "uint256" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "bool", + "name": "isRuled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "numberOfRulingOptions", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "externalIDtoLocalID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_externalDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "rule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xf2d0c797180c8a2d584c028d976b74ce173ce7ad0d596cad759b4a056424696b", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + "transactionIndex": 0, + "gasUsed": "720021", + "logsBloom": "0x00000000002000000000000000000000000000000000000001000004000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000800000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x02e428fc734e5034ff6abf8133f61f6ab116750329a695cd2da8b49a43be841f", + "transactionHash": "0xf2d0c797180c8a2d584c028d976b74ce173ce7ad0d596cad759b4a056424696b", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 2322269, + "transactionHash": "0xf2d0c797180c8a2d584c028d976b74ce173ce7ad0d596cad759b4a056424696b", + "address": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + "topics": [ + "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000412f697066732f6261666b7265696674656d65367475736e6a77797a616a6b37356679767a646d747979637863746637796866696a6236726669677a336e346c767100000000000000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0x02e428fc734e5034ff6abf8133f61f6ab116750329a695cd2da8b49a43be841f" + } + ], + "blockNumber": 2322269, + "cumulativeGasUsed": "720021", + "status": 1, + "byzantium": true + }, + "args": [ + "0x34E520dc1d2Db660113b64724e14CEdCD01Ee879", + 0, + "/ipfs/bafkreifteme6tusnjwyzajk75fyvzdmtyycxctf7yhfijb6rfigz3n4lvq", + "0x014A442480DbAD767b7615E55E271799889FA1a7" + ], + "numDeployments": 1, + "solcInputHash": "4b623c26d5aed7e40200b7f423c318df", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_metaEvidence\",\"type\":\"string\"},{\"internalType\":\"contract ERC20\",\"name\":\"_weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_evidence\",\"type\":\"string\"}],\"name\":\"MetaEvidence\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"arbitrator\",\"outputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"}],\"name\":\"changeArbitrator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_metaEvidence\",\"type\":\"string\"}],\"name\":\"changeMetaEvidence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_metaEvidenceID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeInWeth\",\"type\":\"uint256\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isRuled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numberOfRulingOptions\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"externalIDtoLocalID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_externalDisputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor\",\"params\":{\"_arbitrator\":\"The arbitrator to rule on created disputes.\",\"_metaEvidence\":\"The URI of the meta evidence object for evidence submissions requests.\",\"_metaEvidenceID\":\"Unique identifier of meta-evidence.\"}},\"createDispute(uint256,bytes,uint256,uint256,uint256)\":{\"details\":\"TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\",\"params\":{\"_arbitratorExtraData\":\"Extra data for the arbitrator.\",\"_evidenceGroupID\":\"Unique identifier of the evidence group that is linked to this dispute.\",\"_feeInWeth\":\"Amount of fees in WETH for the arbitrator.\",\"_metaEvidenceID\":\"Unique identifier of meta-evidence.\",\"_numberOfRulingOptions\":\"Number of ruling options. Must be greater than 1, otherwise there is nothing to choose from.\"},\"returns\":{\"disputeID\":\"Dispute id (on arbitrator side) of the dispute created.\"}},\"rule(uint256,uint256)\":{\"details\":\"To be called by the arbitrator of the dispute, to declare the winning ruling.\",\"params\":{\"_externalDisputeID\":\"ID of the dispute in arbitrator contract.\",\"_ruling\":\"The ruling choice of the arbitration.\"}}},\"title\":\"ArbitrableExample An example of an arbitrable contract which connects to the arbitator that implements the updated interface.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/arbitrables/ArbitrableExample.sol\":\"ArbitrableExample\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0x4ffc0547c02ad22925310c585c0f166f8759e2648a09e9b489100c42f15dd98d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/arbitration/arbitrables/ArbitrableExample.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"../IArbitrable.sol\\\";\\nimport \\\"../../evidence/IMetaEvidence.sol\\\";\\n\\n/**\\n * @title ArbitrableExample\\n * An example of an arbitrable contract which connects to the arbitator that implements the updated interface.\\n */\\ncontract ArbitrableExample is IArbitrable, IMetaEvidence {\\n struct DisputeStruct {\\n bool isRuled; // Whether the dispute has been ruled or not.\\n uint256 ruling; // Ruling given by the arbitrator.\\n uint256 numberOfRulingOptions; // The number of choices the arbitrator can give.\\n }\\n\\n address public immutable governor;\\n IArbitrator public arbitrator; // Arbitrator is set in constructor and never changed.\\n ERC20 public immutable weth; // The WETH token.\\n mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs.\\n DisputeStruct[] public disputes; // Stores the disputes' info. disputes[disputeID].\\n\\n /** @dev Constructor\\n * @param _arbitrator The arbitrator to rule on created disputes.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _metaEvidence The URI of the meta evidence object for evidence submissions requests.\\n */\\n constructor(IArbitrator _arbitrator, uint256 _metaEvidenceID,string memory _metaEvidence, ERC20 _weth) {\\n governor = msg.sender;\\n arbitrator = _arbitrator;\\n weth = _weth;\\n emit MetaEvidence(_metaEvidenceID, _metaEvidence);\\n }\\n\\n /** @dev TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute.\\n Note that we don\\u2019t need to check that msg.value is enough to pay arbitration fees as it\\u2019s the responsibility of the arbitrator contract.\\n * @param _numberOfRulingOptions Number of ruling options. Must be greater than 1, otherwise there is nothing to choose from.\\n * @param _arbitratorExtraData Extra data for the arbitrator.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n * @param _feeInWeth Amount of fees in WETH for the arbitrator.\\n * @return disputeID Dispute id (on arbitrator side) of the dispute created.\\n */\\n function createDispute(\\n uint256 _numberOfRulingOptions,\\n bytes calldata _arbitratorExtraData,\\n uint256 _metaEvidenceID,\\n uint256 _evidenceGroupID,\\n uint256 _feeInWeth\\n ) external payable returns (uint256 disputeID) {\\n require(_numberOfRulingOptions > 1, \\\"Incorrect number of choices\\\");\\n\\n uint256 localDisputeID = disputes.length;\\n disputes.push(DisputeStruct({isRuled: false, ruling: 0, numberOfRulingOptions: _numberOfRulingOptions}));\\n\\n require(weth.transferFrom(msg.sender, address(this), _feeInWeth), \\\"Not enough WETH for arbitration\\\");\\n weth.increaseAllowance(address(arbitrator), _feeInWeth);\\n disputeID = arbitrator.createDispute(_numberOfRulingOptions, _arbitratorExtraData);\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit Dispute(arbitrator, disputeID, _metaEvidenceID, _evidenceGroupID);\\n }\\n\\n /** @dev To be called by the arbitrator of the dispute, to declare the winning ruling.\\n * @param _externalDisputeID ID of the dispute in arbitrator contract.\\n * @param _ruling The ruling choice of the arbitration.\\n */\\n function rule(uint256 _externalDisputeID, uint256 _ruling) external override {\\n uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID];\\n DisputeStruct storage dispute = disputes[localDisputeID];\\n require(msg.sender == address(arbitrator), \\\"Only the arbitrator can execute this.\\\");\\n require(_ruling <= dispute.numberOfRulingOptions, \\\"Invalid ruling.\\\");\\n require(dispute.isRuled == false, \\\"This dispute has been ruled already.\\\");\\n\\n dispute.isRuled = true;\\n dispute.ruling = _ruling;\\n\\n emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling);\\n }\\n\\n function changeMetaEvidence(uint256 _metaEvidenceID, string memory _metaEvidence) external {\\n require(msg.sender == governor, \\\"Not authorized: governor only.\\\");\\n emit MetaEvidence(_metaEvidenceID, _metaEvidence);\\n }\\n\\n function changeArbitrator(IArbitrator _arbitrator) external {\\n require(msg.sender == governor, \\\"Not authorized: governor only.\\\");\\n arbitrator = _arbitrator;\\n }\\n}\\n\",\"keccak256\":\"0x4959a805fe137ef2bf74e49c343d4ecfd89129d7437e90e1b02f28461bed385c\",\"license\":\"MIT\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\n\\n/** @title IMetaEvidence\\n * ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator.\\n */\\ninterface IMetaEvidence {\\n /**\\n * @dev To be emitted when meta-evidence is submitted.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json'\\n */\\n event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);\\n\\n /**\\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 _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _metaEvidenceID Unique identifier of meta-evidence.\\n * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n */\\n event Dispute(\\n IArbitrator indexed _arbitrator,\\n uint256 indexed _disputeID,\\n uint256 _metaEvidenceID,\\n uint256 _evidenceGroupID\\n );\\n}\\n\",\"keccak256\":\"0xb87dec548b7c41bb2e2bd25ef3b2159d014c14cdd1e47ca4bec7894817cb8998\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162000de738038062000de7833981016040819052620000349162000117565b33608052600080546001600160a01b0319166001600160a01b0386811691909117909155811660a05260405183907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906200009190859062000203565b60405180910390a25050505062000238565b6001600160a01b0381168114620000b957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620000ef578181015183820152602001620000d5565b83811115620000ff576000848401525b50505050565b80516200011281620000a3565b919050565b600080600080608085870312156200012e57600080fd5b84516200013b81620000a3565b6020860151604087015191955093506001600160401b03808211156200016057600080fd5b818701915087601f8301126200017557600080fd5b8151818111156200018a576200018a620000bc565b604051601f8201601f19908116603f01168101908382118183101715620001b557620001b5620000bc565b816040528281528a6020848701011115620001cf57600080fd5b620001e2836020830160208801620000d2565b8096505050505050620001f86060860162000105565b905092959194509250565b602081526000825180602084015262000224816040850160208701620000d2565b601f01601f19169190910160400192915050565b60805160a051610b6e62000279600039600081816101000152818161050401526105fd015260008181608d0152818161077301526107f70152610b6e6000f3fe6080604052600436106100765760003560e01c80630c340a241461007b578063311a6c56146100cc5780633fc8cef3146100ee578063564a565d146101225780635b13a8a01461015f5780636cc6cde114610180578063c21ae061146101a0578063e98e3a64146101cd578063fc548f08146101ed575b600080fd5b34801561008757600080fd5b506100af7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d857600080fd5b506100ec6100e7366004610856565b61020d565b005b3480156100fa57600080fd5b506100af7f000000000000000000000000000000000000000000000000000000000000000081565b34801561012e57600080fd5b5061014261013d366004610878565b6103a6565b6040805193151584526020840192909252908201526060016100c3565b61017261016d366004610891565b6103dd565b6040519081526020016100c3565b34801561018c57600080fd5b506000546100af906001600160a01b031681565b3480156101ac57600080fd5b506101726101bb366004610878565b60016020526000908152604090205481565b3480156101d957600080fd5b506100ec6101e836600461093a565b610768565b3480156101f957600080fd5b506100ec6102083660046109f5565b6107ec565b600082815260016020526040812054600280549192918390811061023357610233610a25565b600091825260208220915460039190910290910191506001600160a01b031633146102b35760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600201548311156102f95760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b60448201526064016102aa565b805460ff16156103575760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b60648201526084016102aa565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b600281815481106103b657600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b60006001871161042f5760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f69636573000000000060448201526064016102aa565b60028054604080516060810182526000808252602082018181528284018d81526001860187559590915290517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace60038502908101805460ff19169215159290921790915590517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf82015592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad09093019290925590516323b872dd60e01b8152336004820152306024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90606401602060405180830381600087803b15801561055057600080fd5b505af1158015610564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105889190610a3b565b6105d45760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f756768205745544820666f72206172626974726174696f6e0060448201526064016102aa565b600054604051633950935160e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000090911690633950935190604401602060405180830381600087803b15801561064357600080fd5b505af1158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b9190610a3b565b5060005460405163c13517e160e01b81526001600160a01b039091169063c13517e1906106b0908b908b908b90600401610a5d565b602060405180830381600087803b1580156106ca57600080fd5b505af11580156106de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107029190610a93565b60008181526001602090815260408083208590559154825189815291820188905292945084926001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a3509695505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107b05760405162461bcd60e51b81526004016102aa90610aac565b817f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d826040516107e09190610ae3565b60405180910390a25050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108345760405162461bcd60e51b81526004016102aa90610aac565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000806040838503121561086957600080fd5b50508035926020909101359150565b60006020828403121561088a57600080fd5b5035919050565b60008060008060008060a087890312156108aa57600080fd5b86359550602087013567ffffffffffffffff808211156108c957600080fd5b818901915089601f8301126108dd57600080fd5b8135818111156108ec57600080fd5b8a60208285010111156108fe57600080fd5b979a60209290920199509697604081013597506060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561094d57600080fd5b82359150602083013567ffffffffffffffff8082111561096c57600080fd5b818501915085601f83011261098057600080fd5b81358181111561099257610992610924565b604051601f8201601f19908116603f011681019083821181831017156109ba576109ba610924565b816040528281528860208487010111156109d357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215610a0757600080fd5b81356001600160a01b0381168114610a1e57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a4d57600080fd5b81518015158114610a1e57600080fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060208284031215610aa557600080fd5b5051919050565b6020808252601e908201527f4e6f7420617574686f72697a65643a20676f7665726e6f72206f6e6c792e0000604082015260600190565b600060208083528351808285015260005b81811015610b1057858101830151858201604001528201610af4565b81811115610b22576000604083870101525b50601f01601f191692909201604001939250505056fea2646970667358221220ce8d35b0c825ffb680b17cdb56af41b1d0187ceb066d7adeca526f2f5682e8dd64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100765760003560e01c80630c340a241461007b578063311a6c56146100cc5780633fc8cef3146100ee578063564a565d146101225780635b13a8a01461015f5780636cc6cde114610180578063c21ae061146101a0578063e98e3a64146101cd578063fc548f08146101ed575b600080fd5b34801561008757600080fd5b506100af7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d857600080fd5b506100ec6100e7366004610856565b61020d565b005b3480156100fa57600080fd5b506100af7f000000000000000000000000000000000000000000000000000000000000000081565b34801561012e57600080fd5b5061014261013d366004610878565b6103a6565b6040805193151584526020840192909252908201526060016100c3565b61017261016d366004610891565b6103dd565b6040519081526020016100c3565b34801561018c57600080fd5b506000546100af906001600160a01b031681565b3480156101ac57600080fd5b506101726101bb366004610878565b60016020526000908152604090205481565b3480156101d957600080fd5b506100ec6101e836600461093a565b610768565b3480156101f957600080fd5b506100ec6102083660046109f5565b6107ec565b600082815260016020526040812054600280549192918390811061023357610233610a25565b600091825260208220915460039190910290910191506001600160a01b031633146102b35760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600201548311156102f95760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b60448201526064016102aa565b805460ff16156103575760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b60648201526084016102aa565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b600281815481106103b657600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b60006001871161042f5760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f69636573000000000060448201526064016102aa565b60028054604080516060810182526000808252602082018181528284018d81526001860187559590915290517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace60038502908101805460ff19169215159290921790915590517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf82015592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad09093019290925590516323b872dd60e01b8152336004820152306024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90606401602060405180830381600087803b15801561055057600080fd5b505af1158015610564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105889190610a3b565b6105d45760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f756768205745544820666f72206172626974726174696f6e0060448201526064016102aa565b600054604051633950935160e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000090911690633950935190604401602060405180830381600087803b15801561064357600080fd5b505af1158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b9190610a3b565b5060005460405163c13517e160e01b81526001600160a01b039091169063c13517e1906106b0908b908b908b90600401610a5d565b602060405180830381600087803b1580156106ca57600080fd5b505af11580156106de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107029190610a93565b60008181526001602090815260408083208590559154825189815291820188905292945084926001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a3509695505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107b05760405162461bcd60e51b81526004016102aa90610aac565b817f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d826040516107e09190610ae3565b60405180910390a25050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108345760405162461bcd60e51b81526004016102aa90610aac565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000806040838503121561086957600080fd5b50508035926020909101359150565b60006020828403121561088a57600080fd5b5035919050565b60008060008060008060a087890312156108aa57600080fd5b86359550602087013567ffffffffffffffff808211156108c957600080fd5b818901915089601f8301126108dd57600080fd5b8135818111156108ec57600080fd5b8a60208285010111156108fe57600080fd5b979a60209290920199509697604081013597506060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561094d57600080fd5b82359150602083013567ffffffffffffffff8082111561096c57600080fd5b818501915085601f83011261098057600080fd5b81358181111561099257610992610924565b604051601f8201601f19908116603f011681019083821181831017156109ba576109ba610924565b816040528281528860208487010111156109d357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215610a0757600080fd5b81356001600160a01b0381168114610a1e57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a4d57600080fd5b81518015158114610a1e57600080fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060208284031215610aa557600080fd5b5051919050565b6020808252601e908201527f4e6f7420617574686f72697a65643a20676f7665726e6f72206f6e6c792e0000604082015260600190565b600060208083528351808285015260005b81811015610b1057858101830151858201604001528201610af4565b81811115610b22576000604083870101525b50601f01601f191692909201604001939250505056fea2646970667358221220ce8d35b0c825ffb680b17cdb56af41b1d0187ceb066d7adeca526f2f5682e8dd64736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor", + "params": { + "_arbitrator": "The arbitrator to rule on created disputes.", + "_metaEvidence": "The URI of the meta evidence object for evidence submissions requests.", + "_metaEvidenceID": "Unique identifier of meta-evidence." + } + }, + "createDispute(uint256,bytes,uint256,uint256,uint256)": { + "details": "TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract.", + "params": { + "_arbitratorExtraData": "Extra data for the arbitrator.", + "_evidenceGroupID": "Unique identifier of the evidence group that is linked to this dispute.", + "_feeInWeth": "Amount of fees in WETH for the arbitrator.", + "_metaEvidenceID": "Unique identifier of meta-evidence.", + "_numberOfRulingOptions": "Number of ruling options. Must be greater than 1, otherwise there is nothing to choose from." + }, + "returns": { + "disputeID": "Dispute id (on arbitrator side) of the dispute created." + } + }, + "rule(uint256,uint256)": { + "details": "To be called by the arbitrator of the dispute, to declare the winning ruling.", + "params": { + "_externalDisputeID": "ID of the dispute in arbitrator contract.", + "_ruling": "The ruling choice of the arbitration." + } + } + }, + "title": "ArbitrableExample An example of an arbitrable contract which connects to the arbitator that implements the updated interface.", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 797, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "arbitrator", + "offset": 0, + "slot": "0", + "type": "t_contract(IArbitrator)775" + }, + { + "astId": 804, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "externalIDtoLocalID", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 808, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "disputes", + "offset": 0, + "slot": "2", + "type": "t_array(t_struct(DisputeStruct)792_storage)dyn_storage" + } + ], + "types": { + "t_array(t_struct(DisputeStruct)792_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)792_storage", + "encoding": "dynamic_array", + "label": "struct ArbitrableExample.DisputeStruct[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IArbitrator)775": { + "encoding": "inplace", + "label": "contract IArbitrator", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(DisputeStruct)792_storage": { + "encoding": "inplace", + "label": "struct ArbitrableExample.DisputeStruct", + "members": [ + { + "astId": 787, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "isRuled", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 789, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "ruling", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 791, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "numberOfRulingOptions", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/chiado/ForeignGatewayOnGnosis.json b/contracts/deployments/chiado/ForeignGatewayOnGnosis.json new file mode 100644 index 000000000..bf0573fc3 --- /dev/null +++ b/contracts/deployments/chiado/ForeignGatewayOnGnosis.json @@ -0,0 +1,697 @@ +{ + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_senderGateway", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_senderChainID", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "_weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "ArbitrationCostModified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrable", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "disputeHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockhash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "localDisputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "arbitrable", + "type": "address" + } + ], + "name": "OutgoingDispute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrable", + "name": "_arbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_JURORS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_courtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "changeCourtJurorFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gracePeriod", + "type": "uint256" + } + ], + "name": "changeFastbridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "createDisputeERC20", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depreciatedFastBridgeExpiration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "depreciatedFastbridge", + "outputs": [ + { + "internalType": "contract IFastBridgeReceiver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "disputeHashToForeignID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "disputeHashtoDisputeData", + "outputs": [ + { + "internalType": "uint248", + "name": "id", + "type": "uint248" + }, + { + "internalType": "bool", + "name": "ruled", + "type": "bool" + }, + { + "internalType": "address", + "name": "arbitrable", + "type": "address" + }, + { + "internalType": "uint256", + "name": "paid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fastBridgeReceiver", + "outputs": [ + { + "internalType": "contract IFastBridgeReceiver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "name": "feeForJuror", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_messageSender", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_relayer", + "type": "address" + } + ], + "name": "relayRule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "senderChainID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "senderGateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xc66218d80b9f21642728c230fb9f6bb598207929c32d12e48a8c92d717a06614", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x87142b7E9C7D026776499120D902AF8896C07894", + "transactionIndex": 0, + "gasUsed": "1015185", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0f263a2a8b5b01c5d70f461fd940c0b6f12ca66b408d5bbaaffd50989cf76547", + "transactionHash": "0xc66218d80b9f21642728c230fb9f6bb598207929c32d12e48a8c92d717a06614", + "logs": [], + "blockNumber": 2251353, + "cumulativeGasUsed": "1015185", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x26858D60FE92b50b34e236B46874e02724344275", + "0x247AC8F775B77075D9eA5a895Dee0739a46fA589", + "0x0000000000000000000000000000000000000000000000000000000000066eed", + "0x014A442480DbAD767b7615E55E271799889FA1a7" + ], + "numDeployments": 2, + "solcInputHash": "274a15cfb06cddd0a2be7e47f1a3d37a", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"_fastBridgeReceiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_senderGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_senderChainID\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"_weth\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"ArbitrationCostModified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"disputeHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockhash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"localDisputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"arbitrable\",\"type\":\"address\"}],\"name\":\"OutgoingDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_courtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeCourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"_fastBridgeReceiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gracePeriod\",\"type\":\"uint256\"}],\"name\":\"changeFastbridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"createDisputeERC20\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depreciatedFastBridgeExpiration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"depreciatedFastbridge\",\"outputs\":[{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"disputeHashToForeignID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"disputeHashtoDisputeData\",\"outputs\":[{\"internalType\":\"uint248\",\"name\":\"id\",\"type\":\"uint248\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"arbitrable\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fastBridgeReceiver\",\"outputs\":[{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"name\":\"feeForJuror\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_messageSender\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_relayer\",\"type\":\"address\"}],\"name\":\"relayRule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"senderChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"senderGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_disputeHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"arbitrationCost(bytes)\":{\"details\":\"Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.\",\"params\":{\"_extraData\":\"Can be used to give additional info on the dispute to be created.\"},\"returns\":{\"cost\":\"Required cost of arbitration.\"}},\"changeCourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified court.\",\"params\":{\"_courtID\":\"The ID of the court.\",\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}},\"changeFastbridge(address,uint256)\":{\"details\":\"Changes the fastBridge, useful to increase the claim deposit.\",\"params\":{\"_fastBridgeReceiver\":\"The address of the new fastBridge.\",\"_gracePeriod\":\"The duration to accept messages from the deprecated bridge (if at all).\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayRule(address,bytes32,uint256,address)\":{\"notice\":\"Relay the rule call from the home gateway to the arbitrable.\"}},\"notice\":\"Foreign Gateway Counterpart of `HomeGateway`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/ForeignGatewayOnGnosis.sol\":\"ForeignGatewayOnGnosis\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /**\\n * @dev The Fast Bridge participants watch for these events to decide if a challenge should be submitted.\\n * @param _epoch The epoch for which the the claim was made.\\n * @param _batchMerkleRoot The timestamp of the claim creation.\\n */\\n event ClaimReceived(uint256 indexed _epoch, bytes32 indexed _batchMerkleRoot);\\n\\n /**\\n * @dev This event indicates that `sendSafeFallback()` should be called on the sending side.\\n * @param _epoch The epoch associated with the challenged claim.\\n */\\n event ClaimChallenged(uint256 indexed _epoch);\\n\\n /**\\n * @dev This events indicates that optimistic verification has succeeded. The messages are ready to be relayed.\\n * @param _epoch The epoch associated with the batch.\\n * @param _success The success of the optimistic verification.\\n */\\n event BatchVerified(uint256 indexed _epoch, bool _success);\\n\\n /**\\n * @dev This event indicates that the batch has been received via the Safe Bridge.\\n * @param _epoch The epoch associated with the batch.\\n * @param _isBridgerHonest Whether the bridger made an honest claim.\\n * @param _isChallengerHonest Whether the bridger made an honest challenge.\\n */\\n event BatchSafeVerified(uint256 indexed _epoch, bool _isBridgerHonest, bool _isChallengerHonest);\\n\\n /**\\n * @dev This event indicates that the claim deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _bridger The recipient of the claim deposit.\\n */\\n event ClaimDepositWithdrawn(uint256 indexed _epoch, address indexed _bridger);\\n\\n /**\\n * @dev This event indicates that the challenge deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _challenger The recipient of the challenge deposit.\\n */\\n event ChallengeDepositWithdrawn(uint256 indexed _epoch, address indexed _challenger);\\n\\n /**\\n * @dev This event indicates that a message has been relayed for the batch in this `_epoch`.\\n * @param _epoch The epoch associated with the batch.\\n * @param _nonce The nonce of the message that was relayed.\\n */\\n event MessageRelayed(uint256 indexed _epoch, uint256 indexed _nonce);\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Submit a claim about the `_batchMerkleRoot` for the latests completed Fast bridge epoch and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to claim.\\n * @param _batchMerkleRoot The hash claimed for the ticket.\\n */\\n function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable;\\n\\n /**\\n * @dev Submit a challenge for the claim of the current epoch's Fast Bridge batch merkleroot state and submit a deposit. The `batchMerkleRoot` in the claim already made for the last finalized epoch should be different from the one on the sending side, otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to challenge.\\n */\\n function challenge(uint256 _epoch) external payable;\\n\\n /**\\n * @dev Resolves the optimistic claim for '_epoch'.\\n * @param _epoch The epoch of the optimistic claim.\\n */\\n function verifyBatch(uint256 _epoch) external;\\n\\n /**\\n * @dev Verifies merkle proof for the given message and associated nonce for the most recent possible epoch and relays the message.\\n * @param _epoch The epoch in which the message was batched by the bridge.\\n * @param _proof The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch.\\n * @param _message The data on the cross-domain chain for the message.\\n */\\n function verifyAndRelayMessage(\\n uint256 _epoch,\\n bytes32[] calldata _proof,\\n bytes calldata _message\\n ) external;\\n\\n /**\\n * @dev Sends the deposit back to the Bridger if their claim is not successfully challenged. Includes a portion of the Challenger's deposit if unsuccessfully challenged.\\n * @param _epoch The epoch associated with the claim deposit to withraw.\\n */\\n function withdrawClaimDeposit(uint256 _epoch) external;\\n\\n /**\\n * @dev Sends the deposit back to the Challenger if his challenge is successful. Includes a portion of the Bridger's deposit.\\n * @param _epoch The epoch associated with the challenge deposit to withraw.\\n */\\n function withdrawChallengeDeposit(uint256 _epoch) external;\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Returns the `start` and `end` time of challenge period for this `epoch`.\\n * @param _epoch The epoch of the claim to request the challenge period.\\n * @return start The start time of the challenge period.\\n * @return end The end time of the challenge period.\\n */\\n function claimChallengePeriod(uint256 _epoch) external view returns (uint256 start, uint256 end);\\n\\n /**\\n * @dev Returns the epoch period.\\n */\\n function epochPeriod() external view returns (uint256 epochPeriod);\\n\\n /**\\n * @dev Returns the challenge period.\\n */\\n function challengePeriod() external view returns (uint256 challengePeriod);\\n}\\n\",\"keccak256\":\"0xff909a62e9a08540dafcd08c779a64917ed1e44be52d5a225ff9149ff95909e8\",\"license\":\"MIT\"},\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IFastBridgeReceiver.sol\\\";\\n\\ninterface IReceiverGateway {\\n function fastBridgeReceiver() external view returns (IFastBridgeReceiver);\\n\\n function senderChainID() external view returns (uint256);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xfa82fbd575c462ad6dffa18c67eb097a4c5088715ae956a836726aafa4be0f90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/gateway/ForeignGatewayOnGnosis.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrable.sol\\\";\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n * Foreign Gateway\\n * Counterpart of `HomeGateway`\\n */\\ncontract ForeignGatewayOnGnosis is IForeignGateway {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event OutgoingDispute(\\n bytes32 disputeHash,\\n bytes32 blockhash,\\n uint256 localDisputeID,\\n uint256 _choices,\\n bytes _extraData,\\n address arbitrable\\n );\\n\\n event ArbitrationCostModified(uint96 indexed _courtID, uint256 _feeForJuror);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public immutable override senderChainID;\\n address public immutable override senderGateway;\\n IERC20 public immutable weth; // WETH token on xDai.\\n uint256 internal localDisputeID = 1; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero.\\n mapping(uint96 => uint256) public feeForJuror; // feeForJuror[courtID], it mirrors the value on KlerosCore.\\n address public governor;\\n IFastBridgeReceiver public fastBridgeReceiver;\\n IFastBridgeReceiver public depreciatedFastbridge;\\n uint256 public depreciatedFastBridgeExpiration;\\n mapping(bytes32 => DisputeData) public disputeHashtoDisputeData;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n modifier onlyFromFastBridge() {\\n require(\\n address(fastBridgeReceiver) == msg.sender ||\\n ((block.timestamp < depreciatedFastBridgeExpiration) && address(depreciatedFastbridge) == msg.sender),\\n \\\"Access not allowed: Fast Bridge only.\\\"\\n );\\n _;\\n }\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n constructor(\\n address _governor,\\n IFastBridgeReceiver _fastBridgeReceiver,\\n address _senderGateway,\\n uint256 _senderChainID,\\n IERC20 _weth\\n ) {\\n governor = _governor;\\n fastBridgeReceiver = _fastBridgeReceiver;\\n senderGateway = _senderGateway;\\n senderChainID = _senderChainID;\\n weth = _weth;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Changes the fastBridge, useful to increase the claim deposit.\\n * @param _fastBridgeReceiver The address of the new fastBridge.\\n * @param _gracePeriod The duration to accept messages from the deprecated bridge (if at all).\\n */\\n function changeFastbridge(IFastBridgeReceiver _fastBridgeReceiver, uint256 _gracePeriod) external onlyByGovernor {\\n // grace period to relay remaining messages in the relay / bridging process\\n depreciatedFastBridgeExpiration = block.timestamp + _fastBridgeReceiver.epochPeriod() + _gracePeriod; // 2 weeks\\n depreciatedFastbridge = fastBridgeReceiver;\\n fastBridgeReceiver = _fastBridgeReceiver;\\n }\\n\\n /**\\n * @dev Changes the `feeForJuror` property value of a specified court.\\n * @param _courtID The ID of the court.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor {\\n feeForJuror[_courtID] = _feeForJuror;\\n emit ArbitrationCostModified(_courtID, _feeForJuror);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function createDispute(\\n uint256 /*_choices*/,\\n bytes calldata /*_extraData*/\\n ) external payable override returns (uint256 disputeID) {\\n revert(\\\"Fees should be paid in WETH\\\");\\n }\\n\\n function createDisputeERC20(\\n uint256 _choices,\\n bytes calldata _extraData,\\n uint256 _amount\\n ) external override returns (uint256 disputeID) {\\n // This check is duplicated in xKlerosLiquid and transferred is done there as well.\\n require(_amount >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n disputeID = localDisputeID++;\\n uint256 chainID;\\n assembly {\\n chainID := chainid()\\n }\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n chainID,\\n blockhash(block.number - 1),\\n \\\"createDispute\\\",\\n disputeID,\\n _choices,\\n _extraData,\\n msg.sender\\n )\\n );\\n\\n disputeHashtoDisputeData[disputeHash] = DisputeData({\\n id: uint248(disputeID),\\n arbitrable: msg.sender,\\n paid: _amount,\\n relayer: address(0),\\n ruled: false\\n });\\n\\n emit OutgoingDispute(disputeHash, blockhash(block.number - 1), disputeID, _choices, _extraData, msg.sender);\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n function arbitrationCost(bytes calldata _extraData) public view override returns (uint256 cost) {\\n (uint96 courtID, uint256 minJurors) = extraDataToCourtIDMinJurors(_extraData);\\n cost = feeForJuror[courtID] * minJurors;\\n }\\n\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _relayer\\n ) external override onlyFromFastBridge {\\n require(_messageSender == senderGateway, \\\"Only the homegateway is allowed.\\\");\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(!dispute.ruled, \\\"Cannot rule twice\\\");\\n\\n dispute.ruled = true;\\n dispute.relayer = _relayer;\\n\\n IArbitrable arbitrable = IArbitrable(dispute.arbitrable);\\n arbitrable.rule(dispute.id, _ruling);\\n }\\n\\n function withdrawFees(bytes32 _disputeHash) external override {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(dispute.ruled, \\\"Not ruled yet\\\");\\n\\n uint256 amount = dispute.paid;\\n dispute.paid = 0;\\n weth.transfer(dispute.relayer, amount);\\n }\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n function disputeHashToForeignID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoDisputeData[_disputeHash].id;\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function extraDataToCourtIDMinJurors(\\n bytes memory _extraData\\n ) internal view returns (uint96 courtID, uint256 minJurors) {\\n // Note that here we ignore DisputeKitID\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n courtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n }\\n if (feeForJuror[courtID] == 0) courtID = 0;\\n if (minJurors == 0) minJurors = MIN_JURORS;\\n } else {\\n courtID = 0;\\n minJurors = MIN_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2b08ac831644a9328a387c3ae529c5d999e9ce9ff5468a15215cd50af6a2eb16\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrator.sol\\\";\\nimport \\\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitrator, IReceiverGateway {\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n // For cross-chain Evidence standard\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function createDisputeERC20(\\n uint256 _choices,\\n bytes calldata _extraData,\\n uint256 _amount\\n ) external returns (uint256 disputeID);\\n}\\n\",\"keccak256\":\"0x4cfc88d2d7cf211ce9a1f3c991f093baefa026784185da2319d566051d0c8c43\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60e0604052600160005534801561001557600080fd5b50604051620011573803806200115783398101604081905261003691610090565b600280546001600160a01b03199081166001600160a01b0397881617909155600380549091169486169490941790935590831660a0526080521660c0526100fb565b6001600160a01b038116811461008d57600080fd5b50565b600080600080600060a086880312156100a857600080fd5b85516100b381610078565b60208701519095506100c481610078565b60408701519094506100d581610078565b6060870151608088015191945092506100ed81610078565b809150509295509295909350565b60805160a05160c05161101e62000139600039600081816101a30152610a820152600081816102c101526107e301526000610204015261101e6000f3fe6080604052600436106100e95760003560e01c8063a60a4db511610085578063a60a4db51461027c578063c13517e11461029c578063ce0aaf95146102af578063d3c617ff146102e3578063d96a36ca14610385578063eaff425a146103a5578063ebb71194146103ba578063f7434ea9146103da578063f7f56752146103fa57600080fd5b80630c340a24146100ee5780632d5db96d1461012b5780632e1db8901461014d5780633fc8cef31461019157806345c90441146101c55780634def5455146101f257806367c5194714610226578063979f8e65146102465780639ff66f6414610266575b600080fd5b3480156100fa57600080fd5b5060025461010e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561013757600080fd5b5061014b610146366004610beb565b61041a565b005b34801561015957600080fd5b50610183610168366004610c17565b6000908152600660205260409020546001600160f81b031690565b604051908152602001610122565b34801561019d57600080fd5b5061010e7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d157600080fd5b506101836101e0366004610c4c565b60016020526000908152604090205481565b3480156101fe57600080fd5b506101837f000000000000000000000000000000000000000000000000000000000000000081565b34801561023257600080fd5b5061014b610241366004610c6e565b610507565b34801561025257600080fd5b50610183610261366004610cd3565b61058a565b34801561027257600080fd5b5061018360055481565b34801561028857600080fd5b5061014b610297366004610d26565b610758565b6101836102aa366004610d70565b610984565b3480156102bb57600080fd5b5061010e7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102ef57600080fd5b506103476102fe366004610c17565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a001610122565b34801561039157600080fd5b5060035461010e906001600160a01b031681565b3480156103b157600080fd5b50610183600381565b3480156103c657600080fd5b5061014b6103d5366004610c17565b6109cf565b3480156103e657600080fd5b506101836103f5366004610dbc565b610b06565b34801561040657600080fd5b5060045461010e906001600160a01b031681565b6002546001600160a01b0316331461044d5760405162461bcd60e51b815260040161044490610dfe565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561048757600080fd5b505afa15801561049b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190610e40565b6104c99042610e6f565b6104d39190610e6f565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146105315760405162461bcd60e51b815260040161044490610dfe565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c5969061057e9084815260200190565b60405180910390a25050565b60006105968484610b06565b8210156105e55760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e006044820152606401610444565b6000805490806105f483610e87565b90915550905046600081610609600143610ea2565b4084898989336040516020016106259796959493929190610eb9565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152606088018c815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906107009043610ea2565b40858a8a8a336040516107199796959493929190610f19565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a35050949350505050565b6003546001600160a01b031633148061078757506005544210801561078757506004546001600160a01b031633145b6107e15760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b6064820152608401610444565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146108625760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e6044820152606401610444565b600083815260066020526040902080546001600160f81b03166108975760405162461bcd60e51b815260040161044490610f77565b8054600160f81b900460ff16156108e45760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b6044820152606401610444565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b50505050505050505050565b60405162461bcd60e51b815260206004820152601b60248201527f466565732073686f756c64206265207061696420696e205745544800000000006044820152600090606401610444565b600081815260066020526040902080546001600160f81b0316610a045760405162461bcd60e51b815260040161044490610f77565b8054600160f81b900460ff16610a4c5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b6044820152606401610444565b6002810180546000909155600382015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb90604401602060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b009190610fa7565b50505050565b6000806000610b4a85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b7c92505050565b6001600160601b0382166000908152600160205260409020549193509150610b73908290610fc9565b95945050505050565b6000806040835110610bc75750506020818101516040808401516001600160601b03831660009081526001909452922054909190610bb957600091505b80610bc2575060035b915091565b50600090506003915091565b6001600160a01b0381168114610be857600080fd5b50565b60008060408385031215610bfe57600080fd5b8235610c0981610bd3565b946020939093013593505050565b600060208284031215610c2957600080fd5b5035919050565b80356001600160601b0381168114610c4757600080fd5b919050565b600060208284031215610c5e57600080fd5b610c6782610c30565b9392505050565b60008060408385031215610c8157600080fd5b610c0983610c30565b60008083601f840112610c9c57600080fd5b50813567ffffffffffffffff811115610cb457600080fd5b602083019150836020828501011115610ccc57600080fd5b9250929050565b60008060008060608587031215610ce957600080fd5b84359350602085013567ffffffffffffffff811115610d0757600080fd5b610d1387828801610c8a565b9598909750949560400135949350505050565b60008060008060808587031215610d3c57600080fd5b8435610d4781610bd3565b935060208501359250604085013591506060850135610d6581610bd3565b939692955090935050565b600080600060408486031215610d8557600080fd5b83359250602084013567ffffffffffffffff811115610da357600080fd5b610daf86828701610c8a565b9497909650939450505050565b60008060208385031215610dcf57600080fd5b823567ffffffffffffffff811115610de657600080fd5b610df285828601610c8a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610e5257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610e8257610e82610e59565b500190565b6000600019821415610e9b57610e9b610e59565b5060010190565b600082821015610eb457610eb4610e59565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b600060208284031215610fb957600080fd5b81518015158114610c6757600080fd5b6000816000190483118215151615610fe357610fe3610e59565b50029056fea2646970667358221220dd71b48d89896f779000e464425d5a23f5dc452fd7622b881f1c4c2ccb429c0864736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100e95760003560e01c8063a60a4db511610085578063a60a4db51461027c578063c13517e11461029c578063ce0aaf95146102af578063d3c617ff146102e3578063d96a36ca14610385578063eaff425a146103a5578063ebb71194146103ba578063f7434ea9146103da578063f7f56752146103fa57600080fd5b80630c340a24146100ee5780632d5db96d1461012b5780632e1db8901461014d5780633fc8cef31461019157806345c90441146101c55780634def5455146101f257806367c5194714610226578063979f8e65146102465780639ff66f6414610266575b600080fd5b3480156100fa57600080fd5b5060025461010e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561013757600080fd5b5061014b610146366004610beb565b61041a565b005b34801561015957600080fd5b50610183610168366004610c17565b6000908152600660205260409020546001600160f81b031690565b604051908152602001610122565b34801561019d57600080fd5b5061010e7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d157600080fd5b506101836101e0366004610c4c565b60016020526000908152604090205481565b3480156101fe57600080fd5b506101837f000000000000000000000000000000000000000000000000000000000000000081565b34801561023257600080fd5b5061014b610241366004610c6e565b610507565b34801561025257600080fd5b50610183610261366004610cd3565b61058a565b34801561027257600080fd5b5061018360055481565b34801561028857600080fd5b5061014b610297366004610d26565b610758565b6101836102aa366004610d70565b610984565b3480156102bb57600080fd5b5061010e7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102ef57600080fd5b506103476102fe366004610c17565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a001610122565b34801561039157600080fd5b5060035461010e906001600160a01b031681565b3480156103b157600080fd5b50610183600381565b3480156103c657600080fd5b5061014b6103d5366004610c17565b6109cf565b3480156103e657600080fd5b506101836103f5366004610dbc565b610b06565b34801561040657600080fd5b5060045461010e906001600160a01b031681565b6002546001600160a01b0316331461044d5760405162461bcd60e51b815260040161044490610dfe565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561048757600080fd5b505afa15801561049b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190610e40565b6104c99042610e6f565b6104d39190610e6f565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146105315760405162461bcd60e51b815260040161044490610dfe565b6001600160601b03821660008181526001602052604090819020839055517f20a6ef9c48f3a1ae927e70bc34e82d974c53d3c98c8fd9e731c4bacd5842c5969061057e9084815260200190565b60405180910390a25050565b60006105968484610b06565b8210156105e55760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e006044820152606401610444565b6000805490806105f483610e87565b90915550905046600081610609600143610ea2565b4084898989336040516020016106259796959493929190610eb9565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152606088018c815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906107009043610ea2565b40858a8a8a336040516107199796959493929190610f19565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a35050949350505050565b6003546001600160a01b031633148061078757506005544210801561078757506004546001600160a01b031633145b6107e15760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b6064820152608401610444565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146108625760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e6044820152606401610444565b600083815260066020526040902080546001600160f81b03166108975760405162461bcd60e51b815260040161044490610f77565b8054600160f81b900460ff16156108e45760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b6044820152606401610444565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b50505050505050505050565b60405162461bcd60e51b815260206004820152601b60248201527f466565732073686f756c64206265207061696420696e205745544800000000006044820152600090606401610444565b600081815260066020526040902080546001600160f81b0316610a045760405162461bcd60e51b815260040161044490610f77565b8054600160f81b900460ff16610a4c5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b6044820152606401610444565b6002810180546000909155600382015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb90604401602060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b009190610fa7565b50505050565b6000806000610b4a85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b7c92505050565b6001600160601b0382166000908152600160205260409020549193509150610b73908290610fc9565b95945050505050565b6000806040835110610bc75750506020818101516040808401516001600160601b03831660009081526001909452922054909190610bb957600091505b80610bc2575060035b915091565b50600090506003915091565b6001600160a01b0381168114610be857600080fd5b50565b60008060408385031215610bfe57600080fd5b8235610c0981610bd3565b946020939093013593505050565b600060208284031215610c2957600080fd5b5035919050565b80356001600160601b0381168114610c4757600080fd5b919050565b600060208284031215610c5e57600080fd5b610c6782610c30565b9392505050565b60008060408385031215610c8157600080fd5b610c0983610c30565b60008083601f840112610c9c57600080fd5b50813567ffffffffffffffff811115610cb457600080fd5b602083019150836020828501011115610ccc57600080fd5b9250929050565b60008060008060608587031215610ce957600080fd5b84359350602085013567ffffffffffffffff811115610d0757600080fd5b610d1387828801610c8a565b9598909750949560400135949350505050565b60008060008060808587031215610d3c57600080fd5b8435610d4781610bd3565b935060208501359250604085013591506060850135610d6581610bd3565b939692955090935050565b600080600060408486031215610d8557600080fd5b83359250602084013567ffffffffffffffff811115610da357600080fd5b610daf86828701610c8a565b9497909650939450505050565b60008060208385031215610dcf57600080fd5b823567ffffffffffffffff811115610de657600080fd5b610df285828601610c8a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610e5257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610e8257610e82610e59565b500190565b6000600019821415610e9b57610e9b610e59565b5060010190565b600082821015610eb457610eb4610e59565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b602080825260169082015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b604082015260600190565b600060208284031215610fb957600080fd5b81518015158114610c6757600080fd5b6000816000190483118215151615610fe357610fe3610e59565b50029056fea2646970667358221220dd71b48d89896f779000e464425d5a23f5dc452fd7622b881f1c4c2ccb429c0864736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "arbitrationCost(bytes)": { + "details": "Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.", + "params": { + "_extraData": "Can be used to give additional info on the dispute to be created." + }, + "returns": { + "cost": "Required cost of arbitration." + } + }, + "changeCourtJurorFee(uint96,uint256)": { + "details": "Changes the `feeForJuror` property value of a specified court.", + "params": { + "_courtID": "The ID of the court.", + "_feeForJuror": "The new value for the `feeForJuror` property value." + } + }, + "changeFastbridge(address,uint256)": { + "details": "Changes the fastBridge, useful to increase the claim deposit.", + "params": { + "_fastBridgeReceiver": "The address of the new fastBridge.", + "_gracePeriod": "The duration to accept messages from the deprecated bridge (if at all)." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "relayRule(address,bytes32,uint256,address)": { + "notice": "Relay the rule call from the home gateway to the arbitrable." + } + }, + "notice": "Foreign Gateway Counterpart of `HomeGateway`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15102, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "localDisputeID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 15106, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "feeForJuror", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint96,t_uint256)" + }, + { + "astId": 15108, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "governor", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 15111, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "fastBridgeReceiver", + "offset": 0, + "slot": "3", + "type": "t_contract(IFastBridgeReceiver)116" + }, + { + "astId": 15114, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "depreciatedFastbridge", + "offset": 0, + "slot": "4", + "type": "t_contract(IFastBridgeReceiver)116" + }, + { + "astId": 15116, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "depreciatedFastBridgeExpiration", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 15121, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "disputeHashtoDisputeData", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_struct(DisputeData)15067_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeReceiver)116": { + "encoding": "inplace", + "label": "contract IFastBridgeReceiver", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(DisputeData)15067_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct ForeignGatewayOnGnosis.DisputeData)", + "numberOfBytes": "32", + "value": "t_struct(DisputeData)15067_storage" + }, + "t_mapping(t_uint96,t_uint256)": { + "encoding": "mapping", + "key": "t_uint96", + "label": "mapping(uint96 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(DisputeData)15067_storage": { + "encoding": "inplace", + "label": "struct ForeignGatewayOnGnosis.DisputeData", + "members": [ + { + "astId": 15058, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "id", + "offset": 0, + "slot": "0", + "type": "t_uint248" + }, + { + "astId": 15060, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "ruled", + "offset": 31, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 15062, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "arbitrable", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 15064, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "paid", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 15066, + "contract": "src/gateway/ForeignGatewayOnGnosis.sol:ForeignGatewayOnGnosis", + "label": "relayer", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "numberOfBytes": "128" + }, + "t_uint248": { + "encoding": "inplace", + "label": "uint248", + "numberOfBytes": "31" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/chiado/MetaEvidence_ArbitrableExample.json b/contracts/deployments/chiado/MetaEvidence_ArbitrableExample.json new file mode 100644 index 000000000..9872a5f71 --- /dev/null +++ b/contracts/deployments/chiado/MetaEvidence_ArbitrableExample.json @@ -0,0 +1,27 @@ +{ + "type": "single-select", + "titles": [ + "Alice", + "Bob", + "Charlie" + ], + "descriptions": [ + "Alice is right.", + "Bob is right.", + "Charlie is right" + ], + "arbitratorChainID": 421613, + "arbitrableChainID": 10200, + "arbitrableInterfaceURI": "https://my-awesomme.dapp.io/item/1234", + "dynamicScriptRequiredParams": [ + "arbitrableChainID", + "arbitrableContractAddress" + ], + "evidenceDisplayInterfaceRequiredParams": [ + "disputeID", + "arbitrableContractAddress", + "arbitratorContractAddress", + "arbitratorChainID" + ], + "_v": "1.0.0" +} diff --git a/contracts/deployments/chiado/SortitionSumTreeFactory.json b/contracts/deployments/chiado/SortitionSumTreeFactory.json new file mode 100644 index 000000000..4c58b9303 --- /dev/null +++ b/contracts/deployments/chiado/SortitionSumTreeFactory.json @@ -0,0 +1,92 @@ +{ + "address": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "abi": [], + "transactionHash": "0x405e9f06449c4d61948ed7f0c9c6cf3f6a9bab4fd8b42db9c1232d41f07ee7d9", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "transactionIndex": 0, + "gasUsed": "636060", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xced975b8d1ee04c3fb122c9d467d1d6bc3ea17b087b9b223c84ecbcfe267e271", + "transactionHash": "0x405e9f06449c4d61948ed7f0c9c6cf3f6a9bab4fd8b42db9c1232d41f07ee7d9", + "logs": [], + "blockNumber": 2252213, + "cumulativeGasUsed": "636060", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "c9b600ff9291ca791c04d618ea467929", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Enrique Piqueras - \",\"details\":\"A factory of trees that keep track of staked values for sortition.\",\"kind\":\"dev\",\"methods\":{\"createTree(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)\":{\"details\":\"Create a sortition sum tree at the specified key.\",\"params\":{\"_K\":\"The number of children each node in the tree should have.\",\"_key\":\"The key of the new tree.\"}},\"draw(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)\":{\"details\":\"Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.\",\"params\":{\"_drawnNumber\":\"The drawn number.\",\"_key\":\"The key of the tree.\"},\"returns\":{\"ID\":\"The drawn ID. `O(k * log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.\"}},\"queryLeafs(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,uint256)\":{\"details\":\"Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\",\"params\":{\"_count\":\"The number of items to return.\",\"_cursor\":\"The pagination cursor.\",\"_key\":\"The key of the tree to get the leaves from.\"},\"returns\":{\"hasMore\":\"Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.\",\"startIndex\":\"The index at which leaves start.\",\"values\":\"The values of the returned leaves.\"}},\"set(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,bytes32)\":{\"details\":\"Set a value of a tree.\",\"params\":{\"_ID\":\"The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.\",\"_key\":\"The key of the tree.\",\"_value\":\"The new value.\"}},\"stakeOf(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,bytes32)\":{\"details\":\"Gets a specified ID's associated value.\",\"params\":{\"_ID\":\"The ID of the value.\",\"_key\":\"The key of the tree.\"},\"returns\":{\"value\":\"The associated value.\"}}},\"title\":\"SortitionSumTreeFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/libraries/SortitionSumTreeFactory.sol\":\"SortitionSumTreeFactory\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"src/libraries/SortitionSumTreeFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactory\\n * @author Enrique Piqueras - \\n * @dev A factory of trees that keep track of staked values for sortition.\\n */\\nlibrary SortitionSumTreeFactory {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint[] stack;\\n uint[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint) IDsToNodeIndexes;\\n mapping(uint => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(SortitionSumTrees storage self, bytes32 _key, uint _K) public {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(SortitionSumTrees storage self, bytes32 _key, uint _value, bytes32 _ID) public {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint plusOrMinusValue = plusOrMinus ? _value - tree.nodes[treeIndex] : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint _cursor,\\n uint _count\\n ) public view returns (uint startIndex, uint[] memory values, bool hasMore) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint loopStartIndex = startIndex + _cursor;\\n values = new uint[](loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count);\\n uint valuesIndex = 0;\\n for (uint j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @dev Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.\\n * @param _key The key of the tree.\\n * @param _drawnNumber The drawn number.\\n * @return ID The drawn ID.\\n * `O(k * log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) public view returns (bytes32 ID) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = 0;\\n uint currentDrawnNumber = _drawnNumber % tree.nodes[0];\\n\\n while (\\n (tree.K * treeIndex) + 1 < tree.nodes.length // While it still has children.\\n )\\n for (uint i = 1; i <= tree.K; i++) {\\n // Loop over children.\\n uint nodeIndex = (tree.K * treeIndex) + i;\\n uint nodeValue = tree.nodes[nodeIndex];\\n\\n if (currentDrawnNumber >= nodeValue)\\n currentDrawnNumber -= nodeValue; // Go to the next child.\\n else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n\\n ID = tree.nodeIndexesToIDs[treeIndex];\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) public view returns (uint value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Wether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint _treeIndex,\\n bool _plusOrMinus,\\n uint _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x053af9495cb8382dfc1e1503d8f3dab3d356d664efdbdf534f146ab8f3834e95\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x610a8c61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80632e25c38a1461006657806365b81f4f146100885780637521ccb1146100b357806388c1d467146100d45780639075789e146100e7575b600080fd5b81801561007257600080fd5b506100866100813660046108a0565b610107565b005b61009b6100963660046108a0565b610455565b6040516100aa939291906108d2565b60405180910390f35b6100c66100c136600461092b565b6105c0565b6040519081526020016100aa565b6100c66100e236600461092b565b610616565b8180156100f357600080fd5b5061008661010236600461092b565b61071c565b6000838152602085815260408083208484526003810190925290912054806102cd5783156102c857600182015461021a5750600281018054600180820183556000928352602090922081018590559081148015906101795750815461016d60018361096d565b610177919061099a565b155b1561021557815460009061018d90836109ae565b60008181526004850160205260408120549192506101ac8460016109c2565b9050846002018560020184815481106101c7576101c76109da565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610295565b60018083018054909161022c9161096d565b8154811061023c5761023c6109da565b906000526020600020015490508160010180548061025c5761025c6109f0565b6001900381819060005260206000200160009055905583826002018281548110610288576102886109da565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102c88686836001886107e2565b61044d565b8361036a5760008260020182815481106102e9576102e96109da565b90600052602060002001549050600083600201838154811061030d5761030d6109da565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561036490889088908590856107e2565b5061044d565b81600201818154811061037f5761037f6109da565b9060005260206000200154841461044d576000848360020183815481106103a8576103a86109da565b9060005260206000200154111590506000816103ee57858460020184815481106103d4576103d46109da565b90600052602060002001546103e9919061096d565b610419565b836002018381548110610403576104036109da565b906000526020600020015486610419919061096d565b905085846002018481548110610431576104316109da565b60009182526020909120015561044a88888585856107e2565b50505b505050505050565b60008381526020859052604081206060908290815b60028201548110156104b25760028201548254610488908390610a06565b6104939060016109c2565b106104a0578094506104b2565b806104aa81610a25565b91505061046a565b5060006104bf87866109c2565b60028301549091506104d187836109c2565b116104dc57856104ec565b60028201546104ec90829061096d565b67ffffffffffffffff81111561050457610504610a40565b60405190808252806020026020018201604052801561052d578160200160208202803683370190505b5093506000815b60028401548110156105b257878210156105975783600201818154811061055d5761055d6109da565b906000526020600020015486838151811061057a5761057a6109da565b60209081029190910101528161058f81610a25565b9250506105a0565b600194506105b2565b806105aa81610a25565b915050610534565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105ea576000925061060d565b8160020181815481106105ff576105ff6109da565b906000526020600020015492505b50509392505050565b600082815260208490526040812060028101805483918291829061063c5761063c6109da565b906000526020600020015485610652919061099a565b90505b60028301548354610667908490610a06565b6106729060016109c2565b10156107015760015b835481116106fb576000818486600001546106969190610a06565b6106a091906109c2565b905060008560020182815481106106b9576106b96109da565b906000526020600020015490508084106106de576106d7818561096d565b93506106e6565b5092506106fb565b505080806106f390610a25565b91505061067b565b50610655565b50600090815260049091016020526040902054949350505050565b60008281526020849052604090208054156107755760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116107c55760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e0000000000604482015260640161076c565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b801561089757815461080560018361096d565b61080f91906109ae565b905083610846578282600201828154811061082c5761082c6109da565b9060005260206000200154610841919061096d565b610871565b8282600201828154811061085c5761085c6109da565b906000526020600020015461087191906109c2565b826002018281548110610886576108866109da565b6000918252602090912001556107f2565b50505050505050565b600080600080608085870312156108b657600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b81811015610913578451835293830193918301916001016108f7565b50508093505050508215156040830152949350505050565b60008060006060848603121561094057600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561097f5761097f610957565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826109a9576109a9610984565b500690565b6000826109bd576109bd610984565b500490565b600082198211156109d5576109d5610957565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000816000190483118215151615610a2057610a20610957565b500290565b6000600019821415610a3957610a39610957565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220ed612533fe19900f6f7bcb3715e15197fada76852ddc384bf142ca0012dbbcf664736f6c63430008090033", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80632e25c38a1461006657806365b81f4f146100885780637521ccb1146100b357806388c1d467146100d45780639075789e146100e7575b600080fd5b81801561007257600080fd5b506100866100813660046108a0565b610107565b005b61009b6100963660046108a0565b610455565b6040516100aa939291906108d2565b60405180910390f35b6100c66100c136600461092b565b6105c0565b6040519081526020016100aa565b6100c66100e236600461092b565b610616565b8180156100f357600080fd5b5061008661010236600461092b565b61071c565b6000838152602085815260408083208484526003810190925290912054806102cd5783156102c857600182015461021a5750600281018054600180820183556000928352602090922081018590559081148015906101795750815461016d60018361096d565b610177919061099a565b155b1561021557815460009061018d90836109ae565b60008181526004850160205260408120549192506101ac8460016109c2565b9050846002018560020184815481106101c7576101c76109da565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610295565b60018083018054909161022c9161096d565b8154811061023c5761023c6109da565b906000526020600020015490508160010180548061025c5761025c6109f0565b6001900381819060005260206000200160009055905583826002018281548110610288576102886109da565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102c88686836001886107e2565b61044d565b8361036a5760008260020182815481106102e9576102e96109da565b90600052602060002001549050600083600201838154811061030d5761030d6109da565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561036490889088908590856107e2565b5061044d565b81600201818154811061037f5761037f6109da565b9060005260206000200154841461044d576000848360020183815481106103a8576103a86109da565b9060005260206000200154111590506000816103ee57858460020184815481106103d4576103d46109da565b90600052602060002001546103e9919061096d565b610419565b836002018381548110610403576104036109da565b906000526020600020015486610419919061096d565b905085846002018481548110610431576104316109da565b60009182526020909120015561044a88888585856107e2565b50505b505050505050565b60008381526020859052604081206060908290815b60028201548110156104b25760028201548254610488908390610a06565b6104939060016109c2565b106104a0578094506104b2565b806104aa81610a25565b91505061046a565b5060006104bf87866109c2565b60028301549091506104d187836109c2565b116104dc57856104ec565b60028201546104ec90829061096d565b67ffffffffffffffff81111561050457610504610a40565b60405190808252806020026020018201604052801561052d578160200160208202803683370190505b5093506000815b60028401548110156105b257878210156105975783600201818154811061055d5761055d6109da565b906000526020600020015486838151811061057a5761057a6109da565b60209081029190910101528161058f81610a25565b9250506105a0565b600194506105b2565b806105aa81610a25565b915050610534565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105ea576000925061060d565b8160020181815481106105ff576105ff6109da565b906000526020600020015492505b50509392505050565b600082815260208490526040812060028101805483918291829061063c5761063c6109da565b906000526020600020015485610652919061099a565b90505b60028301548354610667908490610a06565b6106729060016109c2565b10156107015760015b835481116106fb576000818486600001546106969190610a06565b6106a091906109c2565b905060008560020182815481106106b9576106b96109da565b906000526020600020015490508084106106de576106d7818561096d565b93506106e6565b5092506106fb565b505080806106f390610a25565b91505061067b565b50610655565b50600090815260049091016020526040902054949350505050565b60008281526020849052604090208054156107755760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116107c55760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e0000000000604482015260640161076c565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b801561089757815461080560018361096d565b61080f91906109ae565b905083610846578282600201828154811061082c5761082c6109da565b9060005260206000200154610841919061096d565b610871565b8282600201828154811061085c5761085c6109da565b906000526020600020015461087191906109c2565b826002018281548110610886576108866109da565b6000918252602090912001556107f2565b50505050505050565b600080600080608085870312156108b657600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b81811015610913578451835293830193918301916001016108f7565b50508093505050508215156040830152949350505050565b60008060006060848603121561094057600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561097f5761097f610957565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826109a9576109a9610984565b500690565b6000826109bd576109bd610984565b500490565b600082198211156109d5576109d5610957565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000816000190483118215151615610a2057610a20610957565b500290565b6000600019821415610a3957610a39610957565b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220ed612533fe19900f6f7bcb3715e15197fada76852ddc384bf142ca0012dbbcf664736f6c63430008090033", + "devdoc": { + "author": "Enrique Piqueras - ", + "details": "A factory of trees that keep track of staked values for sortition.", + "kind": "dev", + "methods": { + "createTree(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)": { + "details": "Create a sortition sum tree at the specified key.", + "params": { + "_K": "The number of children each node in the tree should have.", + "_key": "The key of the new tree." + } + }, + "draw(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256)": { + "details": "Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.", + "params": { + "_drawnNumber": "The drawn number.", + "_key": "The key of the tree." + }, + "returns": { + "ID": "The drawn ID. `O(k * log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended." + } + }, + "queryLeafs(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,uint256)": { + "details": "Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.", + "params": { + "_count": "The number of items to return.", + "_cursor": "The pagination cursor.", + "_key": "The key of the tree to get the leaves from." + }, + "returns": { + "hasMore": "Whether there are more for pagination. `O(n)` where `n` is the maximum number of nodes ever appended.", + "startIndex": "The index at which leaves start.", + "values": "The values of the returned leaves." + } + }, + "set(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,uint256,bytes32)": { + "details": "Set a value of a tree.", + "params": { + "_ID": "The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended.", + "_key": "The key of the tree.", + "_value": "The new value." + } + }, + "stakeOf(SortitionSumTreeFactory.SortitionSumTrees storage,bytes32,bytes32)": { + "details": "Gets a specified ID's associated value.", + "params": { + "_ID": "The ID of the value.", + "_key": "The key of the tree." + }, + "returns": { + "value": "The associated value." + } + } + }, + "title": "SortitionSumTreeFactory", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} diff --git a/contracts/deployments/chiado/TokenBridge.json b/contracts/deployments/chiado/TokenBridge.json new file mode 100644 index 000000000..b948fcc54 --- /dev/null +++ b/contracts/deployments/chiado/TokenBridge.json @@ -0,0 +1,4 @@ +{ + "address": "0xbb3c86f9918C3C1d83668fA84e79E876d147fFf2", + "abi": [] +} diff --git a/contracts/deployments/chiado/WETH.json b/contracts/deployments/chiado/WETH.json new file mode 100644 index 000000000..ef76efc40 --- /dev/null +++ b/contracts/deployments/chiado/WETH.json @@ -0,0 +1,436 @@ +{ + "address": "0x014A442480DbAD767b7615E55E271799889FA1a7", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3ffdb2b0a8bf89839c9112a30bae6afd506c74ccd494df33aebf5cf669b4f92f", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x014A442480DbAD767b7615E55E271799889FA1a7", + "transactionIndex": 0, + "gasUsed": "616033", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000200000000010000000000200000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000002000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb118d798b6b5b3728f0301b72fe978f411d86c85d358d13220f5d18d74991b6d", + "transactionHash": "0x3ffdb2b0a8bf89839c9112a30bae6afd506c74ccd494df33aebf5cf669b4f92f", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 2249665, + "transactionHash": "0x3ffdb2b0a8bf89839c9112a30bae6afd506c74ccd494df33aebf5cf669b4f92f", + "address": "0x014A442480DbAD767b7615E55E271799889FA1a7", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], + "data": "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000", + "logIndex": 0, + "blockHash": "0xb118d798b6b5b3728f0301b72fe978f411d86c85d358d13220f5d18d74991b6d" + } + ], + "blockNumber": 2249665, + "cumulativeGasUsed": "616033", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a007c0c32fbf14d3b8d9e895ad7ca280", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/token/WETH.sol\":\"WETH\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0x4ffc0547c02ad22925310c585c0f166f8759e2648a09e9b489100c42f15dd98d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"src/token/WETH.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract WETH is ERC20 {\\n constructor() ERC20(\\\"Wrapped ETH\\\", \\\"WETH\\\") {\\n _mint(msg.sender, 1000000 ether);\\n }\\n}\\n\",\"keccak256\":\"0x14f3140078f6009f9a77ee35209325f84280c497830ac74affdedde7249eb3df\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604080518082018252600b81526a0aee4c2e0e0cac8408aa8960ab1b6020808301918252835180850190945260048452630ae8aa8960e31b90840152815191929161005e91600391610157565b508051610072906004906020840190610157565b50505061008f3369d3c21bcecceda100000061009460201b60201c565b610251565b6001600160a01b0382166100ee5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b806002600082825461010091906101f0565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b82805461016390610216565b90600052602060002090601f01602090048101928261018557600085556101cb565b82601f1061019e57805160ff19168380011785556101cb565b828001600101855582156101cb579182015b828111156101cb5782518255916020019190600101906101b0565b506101d79291506101db565b5090565b5b808211156101d757600081556001016101dc565b6000821982111561021157634e487b7160e01b600052601160045260246000fd5b500190565b600181811c9082168061022a57607f821691505b6020821081141561024b57634e487b7160e01b600052602260045260246000fd5b50919050565b61085d806102606000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220105c70821f17ce182660ebdfd21d18fd546f800383325dc976b4d2f5ad3d277464736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220105c70821f17ce182660ebdfd21d18fd546f800383325dc976b4d2f5ad3d277464736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." + }, + "increaseAllowance(address,uint256)": { + "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." + }, + "name()": { + "details": "Returns the name of the token." + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 423, + "contract": "src/token/WETH.sol:WETH", + "label": "_balances", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 429, + "contract": "src/token/WETH.sol:WETH", + "label": "_allowances", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 431, + "contract": "src/token/WETH.sol:WETH", + "label": "_totalSupply", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 433, + "contract": "src/token/WETH.sol:WETH", + "label": "_name", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 435, + "contract": "src/token/WETH.sol:WETH", + "label": "_symbol", + "offset": 0, + "slot": "4", + "type": "t_string_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/chiado/WETHFaucet.json b/contracts/deployments/chiado/WETHFaucet.json new file mode 100644 index 000000000..0057490d8 --- /dev/null +++ b/contracts/deployments/chiado/WETHFaucet.json @@ -0,0 +1,146 @@ +{ + "address": "0x395014fddc3b12F9a78ED8E57DA162Fd77E12bE3", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "request", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrewAlready", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6689d4f304c3b06f38519d390fde898bb24edee77894e415f28220720d3e2f48", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x395014fddc3b12F9a78ED8E57DA162Fd77E12bE3", + "transactionIndex": 0, + "gasUsed": "260119", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3d49ab133f39228cfe8aa8940a79675131ef1db2757c3ea43f24b3776ae14e8e", + "transactionHash": "0x6689d4f304c3b06f38519d390fde898bb24edee77894e415f28220720d3e2f48", + "logs": [], + "blockNumber": 2249776, + "cumulativeGasUsed": "260119", + "status": 1, + "byzantium": true + }, + "args": [ + "0x014A442480DbAD767b7615E55E271799889FA1a7" + ], + "numDeployments": 1, + "solcInputHash": "a007c0c32fbf14d3b8d9e895ad7ca280", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"balance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"request\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrewAlready\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/token/Faucet.sol\":\"Faucet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/token/Faucet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract Faucet {\\n IERC20 public token;\\n mapping(address => bool) public withdrewAlready;\\n\\n constructor(IERC20 _token) {\\n token = _token;\\n }\\n\\n function balance() public view returns (uint) {\\n return token.balanceOf(address(this));\\n }\\n\\n function request() public {\\n require(\\n !withdrewAlready[msg.sender],\\n \\\"You have used this faucet already. If you need more tokens, please use another address.\\\"\\n );\\n token.transfer(msg.sender, 10000 ether);\\n withdrewAlready[msg.sender] = true;\\n }\\n}\\n\",\"keccak256\":\"0x96dfe825cf0342eeff4380ac3632e50fed75eb083ff9b5133ab1575ed38dc333\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516103e03803806103e083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61034d806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063338cdca114610051578063b69ef8a81461005b578063d61c40dc14610076578063fc0c546a146100a9575b600080fd5b6100596100d4565b005b61006361022b565b6040519081526020015b60405180910390f35b6100996100843660046102ac565b60016020526000908152604090205460ff1681565b604051901515815260200161006d565b6000546100bc906001600160a01b031681565b6040516001600160a01b03909116815260200161006d565b3360009081526001602052604090205460ff161561017e5760405162461bcd60e51b815260206004820152605760248201527f596f752068617665207573656420746869732066617563657420616c7265616460448201527f792e20496620796f75206e656564206d6f726520746f6b656e732c20706c656160648201527639b2903ab9b29030b737ba3432b91030b2323932b9b99760491b608482015260a40160405180910390fd5b60005460405163a9059cbb60e01b815233600482015269021e19e0c9bab240000060248201526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156101d357600080fd5b505af11580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b91906102dc565b50336000908152600160208190526040909120805460ff19169091179055565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561026f57600080fd5b505afa158015610283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a791906102fe565b905090565b6000602082840312156102be57600080fd5b81356001600160a01b03811681146102d557600080fd5b9392505050565b6000602082840312156102ee57600080fd5b815180151581146102d557600080fd5b60006020828403121561031057600080fd5b505191905056fea26469706673582212205834b9da8d3e30c6124c75f3a860d0d45dd1a253a98d2f15c37030d47e91889a64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063338cdca114610051578063b69ef8a81461005b578063d61c40dc14610076578063fc0c546a146100a9575b600080fd5b6100596100d4565b005b61006361022b565b6040519081526020015b60405180910390f35b6100996100843660046102ac565b60016020526000908152604090205460ff1681565b604051901515815260200161006d565b6000546100bc906001600160a01b031681565b6040516001600160a01b03909116815260200161006d565b3360009081526001602052604090205460ff161561017e5760405162461bcd60e51b815260206004820152605760248201527f596f752068617665207573656420746869732066617563657420616c7265616460448201527f792e20496620796f75206e656564206d6f726520746f6b656e732c20706c656160648201527639b2903ab9b29030b737ba3432b91030b2323932b9b99760491b608482015260a40160405180910390fd5b60005460405163a9059cbb60e01b815233600482015269021e19e0c9bab240000060248201526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156101d357600080fd5b505af11580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b91906102dc565b50336000908152600160208190526040909120805460ff19169091179055565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561026f57600080fd5b505afa158015610283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a791906102fe565b905090565b6000602082840312156102be57600080fd5b81356001600160a01b03811681146102d557600080fd5b9392505050565b6000602082840312156102ee57600080fd5b815180151581146102d557600080fd5b60006020828403121561031057600080fd5b505191905056fea26469706673582212205834b9da8d3e30c6124c75f3a860d0d45dd1a253a98d2f15c37030d47e91889a64736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 25951, + "contract": "src/token/Faucet.sol:Faucet", + "label": "token", + "offset": 0, + "slot": "0", + "type": "t_contract(IERC20)1072" + }, + { + "astId": 25955, + "contract": "src/token/Faucet.sol:Faucet", + "label": "withdrewAlready", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20)1072": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} diff --git a/contracts/deployments/chiado/WPNKFaucet.json b/contracts/deployments/chiado/WPNKFaucet.json new file mode 100644 index 000000000..f8b4d15be --- /dev/null +++ b/contracts/deployments/chiado/WPNKFaucet.json @@ -0,0 +1,146 @@ +{ + "address": "0x5898aeE045A25B276369914c3448B72a41758B2c", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "request", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrewAlready", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb35cd25025514f4ceea9f6794c1d39aa7b864712e7e12894835e1f0339ff4b19", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x5898aeE045A25B276369914c3448B72a41758B2c", + "transactionIndex": 0, + "gasUsed": "260119", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2a5bf0e51e6ef3b5d65aa0b72477796eef03ac7702a74c66d64e8d6ff56df53f", + "transactionHash": "0xb35cd25025514f4ceea9f6794c1d39aa7b864712e7e12894835e1f0339ff4b19", + "logs": [], + "blockNumber": 2322229, + "cumulativeGasUsed": "260119", + "status": 1, + "byzantium": true + }, + "args": [ + "0xD75E27A56AaF9eE7F8d9A472a8C2EF2f65a764dd" + ], + "numDeployments": 2, + "solcInputHash": "619e4fd2e5ff33514c8e0080269dcddd", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_token\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"balance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"request\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrewAlready\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/token/Faucet.sol\":\"Faucet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"src/token/Faucet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract Faucet {\\n IERC20 public token;\\n mapping(address => bool) public withdrewAlready;\\n\\n constructor(IERC20 _token) {\\n token = _token;\\n }\\n\\n function balance() public view returns (uint) {\\n return token.balanceOf(address(this));\\n }\\n\\n function request() public {\\n require(\\n !withdrewAlready[msg.sender],\\n \\\"You have used this faucet already. If you need more tokens, please use another address.\\\"\\n );\\n token.transfer(msg.sender, 10000 ether);\\n withdrewAlready[msg.sender] = true;\\n }\\n}\\n\",\"keccak256\":\"0x96dfe825cf0342eeff4380ac3632e50fed75eb083ff9b5133ab1575ed38dc333\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516103e03803806103e083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61034d806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063338cdca114610051578063b69ef8a81461005b578063d61c40dc14610076578063fc0c546a146100a9575b600080fd5b6100596100d4565b005b61006361022b565b6040519081526020015b60405180910390f35b6100996100843660046102ac565b60016020526000908152604090205460ff1681565b604051901515815260200161006d565b6000546100bc906001600160a01b031681565b6040516001600160a01b03909116815260200161006d565b3360009081526001602052604090205460ff161561017e5760405162461bcd60e51b815260206004820152605760248201527f596f752068617665207573656420746869732066617563657420616c7265616460448201527f792e20496620796f75206e656564206d6f726520746f6b656e732c20706c656160648201527639b2903ab9b29030b737ba3432b91030b2323932b9b99760491b608482015260a40160405180910390fd5b60005460405163a9059cbb60e01b815233600482015269021e19e0c9bab240000060248201526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156101d357600080fd5b505af11580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b91906102dc565b50336000908152600160208190526040909120805460ff19169091179055565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561026f57600080fd5b505afa158015610283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a791906102fe565b905090565b6000602082840312156102be57600080fd5b81356001600160a01b03811681146102d557600080fd5b9392505050565b6000602082840312156102ee57600080fd5b815180151581146102d557600080fd5b60006020828403121561031057600080fd5b505191905056fea26469706673582212205834b9da8d3e30c6124c75f3a860d0d45dd1a253a98d2f15c37030d47e91889a64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063338cdca114610051578063b69ef8a81461005b578063d61c40dc14610076578063fc0c546a146100a9575b600080fd5b6100596100d4565b005b61006361022b565b6040519081526020015b60405180910390f35b6100996100843660046102ac565b60016020526000908152604090205460ff1681565b604051901515815260200161006d565b6000546100bc906001600160a01b031681565b6040516001600160a01b03909116815260200161006d565b3360009081526001602052604090205460ff161561017e5760405162461bcd60e51b815260206004820152605760248201527f596f752068617665207573656420746869732066617563657420616c7265616460448201527f792e20496620796f75206e656564206d6f726520746f6b656e732c20706c656160648201527639b2903ab9b29030b737ba3432b91030b2323932b9b99760491b608482015260a40160405180910390fd5b60005460405163a9059cbb60e01b815233600482015269021e19e0c9bab240000060248201526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156101d357600080fd5b505af11580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b91906102dc565b50336000908152600160208190526040909120805460ff19169091179055565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561026f57600080fd5b505afa158015610283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a791906102fe565b905090565b6000602082840312156102be57600080fd5b81356001600160a01b03811681146102d557600080fd5b9392505050565b6000602082840312156102ee57600080fd5b815180151581146102d557600080fd5b60006020828403121561031057600080fd5b505191905056fea26469706673582212205834b9da8d3e30c6124c75f3a860d0d45dd1a253a98d2f15c37030d47e91889a64736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 26232, + "contract": "src/token/Faucet.sol:Faucet", + "label": "token", + "offset": 0, + "slot": "0", + "type": "t_contract(IERC20)1072" + }, + { + "astId": 26236, + "contract": "src/token/Faucet.sol:Faucet", + "label": "withdrewAlready", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20)1072": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} diff --git a/contracts/deployments/chiado/WrappedPinakionV2.json b/contracts/deployments/chiado/WrappedPinakionV2.json new file mode 100644 index 000000000..a12bae532 --- /dev/null +++ b/contracts/deployments/chiado/WrappedPinakionV2.json @@ -0,0 +1,436 @@ +{ + "address": "0xD75E27A56AaF9eE7F8d9A472a8C2EF2f65a764dd", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xfa9fed8954035128e3a75c493d5ac33cc2bffa9e191a9ece16f9a2757cb2bab8", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xD75E27A56AaF9eE7F8d9A472a8C2EF2f65a764dd", + "transactionIndex": 1, + "gasUsed": "616199", + "logsBloom": "0x0000000000000000000000000000000000000000000000000000000000000000000000020000000001000200000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000000400000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa2364345d35827c8c0c8c469b6ae0824e3ab838dcc0e0dbaabf3450754b49992", + "transactionHash": "0xfa9fed8954035128e3a75c493d5ac33cc2bffa9e191a9ece16f9a2757cb2bab8", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 2322228, + "transactionHash": "0xfa9fed8954035128e3a75c493d5ac33cc2bffa9e191a9ece16f9a2757cb2bab8", + "address": "0xD75E27A56AaF9eE7F8d9A472a8C2EF2f65a764dd", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f50e77f2a2b6138d16c6c7511562e5c33c4b15a3" + ], + "data": "0x00000000000000000000000000000000000000000000d3c21bcecceda1000000", + "logIndex": 1, + "blockHash": "0xa2364345d35827c8c0c8c469b6ae0824e3ab838dcc0e0dbaabf3450754b49992" + } + ], + "blockNumber": 2322228, + "cumulativeGasUsed": "4491861", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "619e4fd2e5ff33514c8e0080269dcddd", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/token/WrappedPinakionV2.sol\":\"WrappedPinakionV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0x4ffc0547c02ad22925310c585c0f166f8759e2648a09e9b489100c42f15dd98d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"src/token/WrappedPinakionV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\n\\ncontract WrappedPinakionV2 is ERC20 {\\n constructor() ERC20(\\\"Staking PNK on xDai\\\", \\\"stPNK\\\") {\\n _mint(msg.sender, 1000000 ether);\\n }\\n}\\n\",\"keccak256\":\"0xc0648090b2add69db6ae19830b9c1a589af0fa059fada8ffb6ccdeed90e84c02\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604080518082018252601381527f5374616b696e6720504e4b206f6e2078446169000000000000000000000000006020808301918252835180850190945260058452647374504e4b60d81b9084015281519192916100719160039161016a565b50805161008590600490602084019061016a565b5050506100a23369d3c21bcecceda10000006100a760201b60201c565b610264565b6001600160a01b0382166101015760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546101139190610203565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b82805461017690610229565b90600052602060002090601f01602090048101928261019857600085556101de565b82601f106101b157805160ff19168380011785556101de565b828001600101855582156101de579182015b828111156101de5782518255916020019190600101906101c3565b506101ea9291506101ee565b5090565b5b808211156101ea57600081556001016101ef565b6000821982111561022457634e487b7160e01b600052601160045260246000fd5b500190565b600181811c9082168061023d57607f821691505b6020821081141561025e57634e487b7160e01b600052602260045260246000fd5b50919050565b61085d806102736000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220f3e2c60c1f5db76a5e828c52754fa6038e65d3519bf5c40755c1db138d61812264736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610801565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b602082108114156107fb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082257634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220f3e2c60c1f5db76a5e828c52754fa6038e65d3519bf5c40755c1db138d61812264736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." + }, + "increaseAllowance(address,uint256)": { + "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." + }, + "name()": { + "details": "Returns the name of the token." + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 423, + "contract": "src/token/WrappedPinakionV2.sol:WrappedPinakionV2", + "label": "_balances", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 429, + "contract": "src/token/WrappedPinakionV2.sol:WrappedPinakionV2", + "label": "_allowances", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 431, + "contract": "src/token/WrappedPinakionV2.sol:WrappedPinakionV2", + "label": "_totalSupply", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 433, + "contract": "src/token/WrappedPinakionV2.sol:WrappedPinakionV2", + "label": "_name", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 435, + "contract": "src/token/WrappedPinakionV2.sol:WrappedPinakionV2", + "label": "_symbol", + "offset": 0, + "slot": "4", + "type": "t_string_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/chiado/xKlerosLiquidV2.json b/contracts/deployments/chiado/xKlerosLiquidV2.json new file mode 100644 index 000000000..f8e6d7f58 --- /dev/null +++ b/contracts/deployments/chiado/xKlerosLiquidV2.json @@ -0,0 +1,2402 @@ +{ + "address": "0x34E520dc1d2Db660113b64724e14CEdCD01Ee879", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IArbitrable", + "name": "_arbitrable", + "type": "address" + } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_appeal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "Draw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum xKlerosLiquidV2.Period", + "name": "_period", + "type": "uint8" + } + ], + "name": "NewPeriod", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum xKlerosLiquidV2.Phase", + "name": "_phase", + "type": "uint8" + } + ], + "name": "NewPhase", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrable", + "name": "_arbitrable", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "Ruling", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_subcourtID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "_stake", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_newTotalStake", + "type": "uint256" + } + ], + "name": "StakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "_tokenAmount", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "_ETHAmount", + "type": "int256" + } + ], + "name": "TokenAndETHShift", + "type": "event" + }, + { + "inputs": [], + "name": "ALPHA_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_STAKE_PATHS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_JURORS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NON_PAYABLE_AMOUNT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RN", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RNBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RNGenerator", + "outputs": [ + { + "internalType": "contract IRandomAuRa", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "arbitrationCost", + "outputs": [ + { + "internalType": "uint256", + "name": "cost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IForeignGateway", + "name": "_foreignGateway", + "type": "address" + } + ], + "name": "changeForeignGateway", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxDrawingTime", + "type": "uint256" + } + ], + "name": "changeMaxDrawingTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minStakingTime", + "type": "uint256" + } + ], + "name": "changeMinStakingTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract WrappedPinakion", + "name": "_pinakion", + "type": "address" + } + ], + "name": "changePinakion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IRandomAuRa", + "name": "_RNGenerator", + "type": "address" + } + ], + "name": "changeRNGenerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + } + ], + "name": "changeSubcourtAlpha", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "changeSubcourtJurorFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + } + ], + "name": "changeSubcourtJurorsForJump", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + } + ], + "name": "changeSubcourtMinStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + } + ], + "name": "changeSubcourtTimesPerPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_weth", + "type": "address" + } + ], + "name": "changeWethAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "courts", + "outputs": [ + { + "internalType": "uint96", + "name": "parent", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "minStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "alpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeForJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "jurorsForCourtJump", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numberOfChoices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_parent", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_minStake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_jurorsForCourtJump", + "type": "uint256" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "internalType": "uint256", + "name": "_sortitionSumTreeK", + "type": "uint256" + } + ], + "name": "createSubcourt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "currentRuling", + "outputs": [ + { + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delayedSetStakes", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "subcourtID", + "type": "uint96" + }, + { + "internalType": "uint128", + "name": "stake", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "uint96", + "name": "subcourtID", + "type": "uint96" + }, + { + "internalType": "contract IArbitrable", + "name": "arbitrated", + "type": "address" + }, + { + "internalType": "uint256", + "name": "numberOfChoices", + "type": "uint256" + }, + { + "internalType": "enum xKlerosLiquidV2.Period", + "name": "period", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "lastPeriodChange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "drawsInRound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "commitsInRound", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "ruled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "disputesRuling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputesWithoutJurors", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_iterations", + "type": "uint256" + } + ], + "name": "executeDelayedSetStakes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_destination", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "executeGovernorProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "foreignGateway", + "outputs": [ + { + "internalType": "contract IForeignGateway", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "getDispute", + "outputs": [ + { + "internalType": "uint256[]", + "name": "votesLengths", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "tokensAtStakePerJuror", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "totalFeesForJurors", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "votesInEachRound", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "repartitionsInEachRound", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "penaltiesInEachRound", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "getJuror", + "outputs": [ + { + "internalType": "uint96[]", + "name": "subcourtIDs", + "type": "uint96[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + } + ], + "name": "getSubcourt", + "outputs": [ + { + "internalType": "uint256[]", + "name": "children", + "type": "uint256[]" + }, + { + "internalType": "uint256[4]", + "name": "timesPerPeriod", + "type": "uint256[4]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_appeal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_voteID", + "type": "uint256" + } + ], + "name": "getVote", + "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": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_appeal", + "type": "uint256" + } + ], + "name": "getVoteCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "winningChoice", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "counts", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract WrappedPinakion", + "name": "_pinakion", + "type": "address" + }, + { + "internalType": "contract IRandomAuRa", + "name": "_RNGenerator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minStakingTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxDrawingTime", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "_courtParameters", + "type": "uint256[4]" + }, + { + "internalType": "uint256[4]", + "name": "_timesPerPeriod", + "type": "uint256[4]" + }, + { + "internalType": "uint256", + "name": "_sortitionSumTreeK", + "type": "uint256" + }, + { + "internalType": "contract IForeignGateway", + "name": "_foreignGateway", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_weth", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jurors", + "outputs": [ + { + "internalType": "uint256", + "name": "stakedTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedTokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastDelayedSetStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastPhaseChange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockInsolventTransfers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxDrawingTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minStakingTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextDelayedSetStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "onApprove", + "outputs": [ + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "onTransfer", + "outputs": [ + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "phase", + "outputs": [ + { + "internalType": "enum xKlerosLiquidV2.Phase", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pinakion", + "outputs": [ + { + "internalType": "contract WrappedPinakion", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "proxyPayment", + "outputs": [ + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "rule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint128", + "name": "_stake", + "type": "uint128" + } + ], + "name": "setStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + } + ], + "name": "stakeOf", + "outputs": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDisputes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xdb6a244e5101865541ff6d716ed335268c82aa88e3ff47dc219cda97d50b40ef", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x34E520dc1d2Db660113b64724e14CEdCD01Ee879", + "transactionIndex": 1, + "gasUsed": "3055546", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8523df3c3be71b598f308dcb14f0c03e80382deb0f53120672a7a06f437a4335", + "transactionHash": "0xdb6a244e5101865541ff6d716ed335268c82aa88e3ff47dc219cda97d50b40ef", + "logs": [], + "blockNumber": 2309689, + "cumulativeGasUsed": "6902252", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "554a0755634b519652537ffa5fcb4ec8", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"}],\"name\":\"DisputeCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_appeal\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"Draw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum xKlerosLiquidV2.Period\",\"name\":\"_period\",\"type\":\"uint8\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"enum xKlerosLiquidV2.Phase\",\"name\":\"_phase\",\"type\":\"uint8\"}],\"name\":\"NewPhase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract IArbitrable\",\"name\":\"_arbitrable\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"Ruling\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_subcourtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"_stake\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_newTotalStake\",\"type\":\"uint256\"}],\"name\":\"StakeSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_tokenAmount\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"_ETHAmount\",\"type\":\"int256\"}],\"name\":\"TokenAndETHShift\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ALPHA_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_STAKE_PATHS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_JURORS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NON_PAYABLE_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RN\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RNBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RNGenerator\",\"outputs\":[{\"internalType\":\"contract IRandomAuRa\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"arbitrationCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IForeignGateway\",\"name\":\"_foreignGateway\",\"type\":\"address\"}],\"name\":\"changeForeignGateway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"}],\"name\":\"changeMaxDrawingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"}],\"name\":\"changeMinStakingTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract WrappedPinakion\",\"name\":\"_pinakion\",\"type\":\"address\"}],\"name\":\"changePinakion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IRandomAuRa\",\"name\":\"_RNGenerator\",\"type\":\"address\"}],\"name\":\"changeRNGenerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"}],\"name\":\"changeSubcourtAlpha\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeSubcourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"}],\"name\":\"changeSubcourtJurorsForJump\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"}],\"name\":\"changeSubcourtMinStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"}],\"name\":\"changeSubcourtTimesPerPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_weth\",\"type\":\"address\"}],\"name\":\"changeWethAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"courts\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jurorsForCourtJump\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_parent\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_minStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_alpha\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jurorsForCourtJump\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"}],\"name\":\"createSubcourt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"currentRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ruling\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"delayedSetStakes\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint128\",\"name\":\"stake\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"contract IArbitrable\",\"name\":\"arbitrated\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"numberOfChoices\",\"type\":\"uint256\"},{\"internalType\":\"enum xKlerosLiquidV2.Period\",\"name\":\"period\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"lastPeriodChange\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"drawsInRound\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitsInRound\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"ruled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"disputesRuling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputesWithoutJurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_iterations\",\"type\":\"uint256\"}],\"name\":\"executeDelayedSetStakes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destination\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"executeGovernorProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foreignGateway\",\"outputs\":[{\"internalType\":\"contract IForeignGateway\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getDispute\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"votesLengths\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"tokensAtStakePerJuror\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"totalFeesForJurors\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"votesInEachRound\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"repartitionsInEachRound\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"penaltiesInEachRound\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"getJuror\",\"outputs\":[{\"internalType\":\"uint96[]\",\"name\":\"subcourtIDs\",\"type\":\"uint96[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"}],\"name\":\"getSubcourt\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"children\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[4]\",\"name\":\"timesPerPeriod\",\"type\":\"uint256[4]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_appeal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_voteID\",\"type\":\"uint256\"}],\"name\":\"getVote\",\"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\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_appeal\",\"type\":\"uint256\"}],\"name\":\"getVoteCounter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"counts\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract WrappedPinakion\",\"name\":\"_pinakion\",\"type\":\"address\"},{\"internalType\":\"contract IRandomAuRa\",\"name\":\"_RNGenerator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minStakingTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxDrawingTime\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"},{\"internalType\":\"uint256[4]\",\"name\":\"_courtParameters\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_timesPerPeriod\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256\",\"name\":\"_sortitionSumTreeK\",\"type\":\"uint256\"},{\"internalType\":\"contract IForeignGateway\",\"name\":\"_foreignGateway\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_weth\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jurors\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"stakedTokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lockedTokens\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastDelayedSetStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastPhaseChange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lockInsolventTransfers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDrawingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minStakingTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextDelayedSetStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"onApprove\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"onTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"phase\",\"outputs\":[{\"internalType\":\"enum xKlerosLiquidV2.Phase\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pinakion\",\"outputs\":[{\"internalType\":\"contract WrappedPinakion\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"proxyPayment\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ruling\",\"type\":\"uint256\"}],\"name\":\"rule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint128\",\"name\":\"_stake\",\"type\":\"uint128\"}],\"name\":\"setStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"}],\"name\":\"stakeOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDisputes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract is an adaption of Mainnet's KlerosLiquid (https://github.com/kleros/kleros/blob/69cfbfb2128c29f1625b3a99a3183540772fda08/contracts/kleros/KlerosLiquid.sol) for xDai chain. Notice that variables referring to ETH values in this contract, will hold the native token values of the chain on which xKlerosLiquid is deployed. When this contract gets deployed on xDai chain, ETH variables will hold xDai values.\",\"events\":{\"Draw(address,uint256,uint256,uint256)\":{\"details\":\"Emitted when a juror is drawn.\",\"params\":{\"_address\":\"The drawn address.\",\"_appeal\":\"The appeal the draw is for. 0 is for the first round.\",\"_disputeID\":\"The ID of the dispute.\",\"_voteID\":\"The vote ID.\"}},\"NewPeriod(uint256,uint8)\":{\"details\":\"Emitted when a dispute passes to a new period.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\",\"_period\":\"The new period.\"}},\"NewPhase(uint8)\":{\"details\":\"Emitted when we pass to a new phase.\",\"params\":{\"_phase\":\"The new phase.\"}},\"StakeSet(address,uint256,uint128,uint256)\":{\"details\":\"Emitted when a juror's stake is set.\",\"params\":{\"_address\":\"The address of the juror.\",\"_newTotalStake\":\"The new total stake.\",\"_stake\":\"The new stake.\",\"_subcourtID\":\"The ID of the subcourt at the end of the stake path.\"}},\"TokenAndETHShift(address,uint256,int256,int256)\":{\"details\":\"Emitted when a juror wins or loses tokens and ETH from a dispute.\",\"params\":{\"_ETHAmount\":\"The amount of ETH won or lost.\",\"_address\":\"The juror affected.\",\"_disputeID\":\"The ID of the dispute.\",\"_tokenAmount\":\"The amount of tokens won or lost.\"}}},\"kind\":\"dev\",\"methods\":{\"arbitrationCost(bytes)\":{\"details\":\"Gets the cost of arbitration in a specified subcourt.\",\"params\":{\"_extraData\":\"Additional info about the dispute. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\"},\"returns\":{\"cost\":\"The cost.\"}},\"changeForeignGateway(address)\":{\"details\":\"Changes the `foreignGateway` storage variable.\",\"params\":{\"_foreignGateway\":\"The new value for the `foreignGateway` storage variable.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeMaxDrawingTime(uint256)\":{\"details\":\"Changes the `maxDrawingTime` storage variable.\",\"params\":{\"_maxDrawingTime\":\"The new value for the `maxDrawingTime` storage variable.\"}},\"changeMinStakingTime(uint256)\":{\"details\":\"Changes the `minStakingTime` storage variable.\",\"params\":{\"_minStakingTime\":\"The new value for the `minStakingTime` storage variable.\"}},\"changePinakion(address)\":{\"details\":\"Changes the `pinakion` storage variable.\",\"params\":{\"_pinakion\":\"The new value for the `pinakion` storage variable.\"}},\"changeRNGenerator(address)\":{\"details\":\"Changes the `RNGenerator` storage variable.\",\"params\":{\"_RNGenerator\":\"The new value for the `RNGenerator` storage variable.\"}},\"changeSubcourtAlpha(uint96,uint256)\":{\"details\":\"Changes the `alpha` property value of a specified subcourt.\",\"params\":{\"_alpha\":\"The new value for the `alpha` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"changeSubcourtJurorFee(uint96,uint256)\":{\"details\":\"Changes the `feeForJuror` property value of a specified subcourt.\",\"params\":{\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"changeSubcourtJurorsForJump(uint96,uint256)\":{\"details\":\"Changes the `jurorsForCourtJump` property value of a specified subcourt.\",\"params\":{\"_jurorsForCourtJump\":\"The new value for the `jurorsForCourtJump` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"changeSubcourtMinStake(uint96,uint256)\":{\"details\":\"Changes the `minStake` property value of a specified subcourt. Don't set to a value lower than its parent's `minStake` property value.\",\"params\":{\"_minStake\":\"The new value for the `minStake` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"changeSubcourtTimesPerPeriod(uint96,uint256[4])\":{\"details\":\"Changes the `timesPerPeriod` property value of a specified subcourt.\",\"params\":{\"_subcourtID\":\"The ID of the subcourt.\",\"_timesPerPeriod\":\"The new value for the `timesPerPeriod` property value.\"}},\"changeWethAddress(address)\":{\"details\":\"Changes the `weth` storage variable.\",\"params\":{\"_weth\":\"The new value for the `weth` storage variable.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Creates a dispute. Must be called by the arbitrable contract.\",\"params\":{\"_extraData\":\"Additional info about the dispute to be created. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\",\"_numberOfChoices\":\"Number of choices to choose from in the dispute to be created.\"},\"returns\":{\"disputeID\":\"The ID of the created dispute.\"}},\"createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256)\":{\"details\":\"Creates a subcourt under a specified parent court.\",\"params\":{\"_alpha\":\"The `alpha` property value of the subcourt.\",\"_feeForJuror\":\"The `feeForJuror` property value of the subcourt.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the subcourt.\",\"_jurorsForCourtJump\":\"The `jurorsForCourtJump` property value of the subcourt.\",\"_minStake\":\"The `minStake` property value of the subcourt.\",\"_parent\":\"The `parent` property value of the subcourt.\",\"_sortitionSumTreeK\":\"The number of children per node of the subcourt's sortition sum tree.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the subcourt.\"}},\"currentRuling(uint256)\":{\"details\":\"Gets the current ruling of a specified dispute.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"ruling\":\"The current ruling.\"}},\"executeDelayedSetStakes(uint256)\":{\"details\":\"Executes the next delayed set stakes. `O(n)` where `n` is the number of iterations to run.\",\"params\":{\"_iterations\":\"The number of delayed set stakes to execute.\"}},\"executeGovernorProposal(address,uint256,bytes)\":{\"details\":\"Lets the governor 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.\"}},\"getDispute(uint256)\":{\"details\":\"Gets a specified dispute's non primitive properties.\",\"params\":{\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"penaltiesInEachRound\":\"The dispute's amount of tokens collected from penalties in each round. `O(a)` where `a` is the number of appeals of the dispute.\",\"repartitionsInEachRound\":\"The dispute's counter of vote reward repartitions made in each round.\",\"tokensAtStakePerJuror\":\"The dispute's required tokens at stake per Juror.\",\"totalFeesForJurors\":\"The dispute's total fees for Jurors.\",\"votesInEachRound\":\"The dispute's counter of votes made in each round.\",\"votesLengths\":\"The dispute's vote length.\"}},\"getJuror(address)\":{\"details\":\"Gets a specified juror's non primitive properties.\",\"params\":{\"_account\":\"The address of the juror.\"},\"returns\":{\"subcourtIDs\":\"The juror's IDs of subcourts where the juror has stake path.\"}},\"getSubcourt(uint96)\":{\"details\":\"Gets a specified subcourt's non primitive properties.\",\"params\":{\"_subcourtID\":\"The ID of the subcourt.\"},\"returns\":{\"children\":\"The subcourt's child court list.\",\"timesPerPeriod\":\"The subcourt's time per period.\"}},\"getVote(uint256,uint256,uint256)\":{\"details\":\"Gets a specified vote for a specified appeal in a specified dispute.\",\"params\":{\"_appeal\":\"The appeal.\",\"_disputeID\":\"The ID of the dispute.\",\"_voteID\":\"The ID of the vote.\"},\"returns\":{\"account\":\"The account for vote.\",\"choice\":\" The choice for vote.\",\"commit\":\" The commit for vote.\",\"voted\":\"True if the account voted, False otherwise.\"}},\"getVoteCounter(uint256,uint256)\":{\"details\":\"Gets the vote counter for a specified appeal in a specified dispute. Note: This function is only to be used by the interface and it won't work if the number of choices is too high.\",\"params\":{\"_appeal\":\"The appeal.\",\"_disputeID\":\"The ID of the dispute.\"},\"returns\":{\"counts\":\"The count.\",\"tied\":\"Whether the vote tied. `O(n)` where `n` is the number of choices of the dispute.\",\"winningChoice\":\"The winning choice.\"}},\"initialize(address,address,address,uint256,uint256,bool,uint256[4],uint256[4],uint256,address,address)\":{\"details\":\"Constructs the KlerosLiquid contract.\",\"params\":{\"_RNGenerator\":\"The address of the random number generator contract.\",\"_courtParameters\":\"MinStake, alpha, feeForJuror and jurorsForCourtJump respectively.\",\"_foreignGateway\":\"Foreign gateway on xDai.\",\"_governor\":\"The governor's address.\",\"_hiddenVotes\":\"The `hiddenVotes` property value of the general court.\",\"_maxDrawingTime\":\"The maximum time that the drawing phase should last.\",\"_minStakingTime\":\"The minimum time that the staking phase should last.\",\"_pinakion\":\"The address of the token contract.\",\"_sortitionSumTreeK\":\"The number of children per node of the general court's sortition sum tree.\",\"_timesPerPeriod\":\"The `timesPerPeriod` property value of the general court.\",\"_weth\":\"Weth contract.\"}},\"onApprove(address,address,uint256)\":{\"details\":\"Notifies the controller about an approval allowing the controller to react if desired.\",\"params\":{\"_amount\":\"The amount in the `approve()` call.\",\"_owner\":\"The address that calls `approve()`.\",\"_spender\":\"The spender in the `approve()` call.\"},\"returns\":{\"allowed\":\"Whether the operation should be allowed or not.\"}},\"onTransfer(address,address,uint256)\":{\"details\":\"Notifies the controller about a token transfer allowing the controller to react if desired.\",\"params\":{\"_amount\":\"The amount of the transfer.\",\"_from\":\"The origin of the transfer.\",\"_to\":\"The destination of the transfer.\"},\"returns\":{\"allowed\":\"Whether the operation should be allowed or not.\"}},\"proxyPayment(address)\":{\"details\":\"DEPRECATED. Called when `_owner` sends ETH to the Wrapped Token contract.\",\"params\":{\"_owner\":\"The address that sent the ETH to create tokens.\"},\"returns\":{\"allowed\":\"Whether the operation should be allowed or not.\"}},\"rule(uint256,uint256)\":{\"details\":\"Receive the ruling from foreign gateway which technically is an arbitrator of this contract.\",\"params\":{\"_disputeID\":\"ID of the dispute.\",\"_ruling\":\"Ruling given by V2 court and relayed by foreign gateway.\"}},\"setStake(uint96,uint128)\":{\"details\":\"Sets the caller's stake in a subcourt.\",\"params\":{\"_stake\":\"The new stake.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"stakeOf(address,uint96)\":{\"details\":\"Gets the stake of a specified juror in a specified subcourt.\",\"params\":{\"_account\":\"The address of the juror.\",\"_subcourtID\":\"The ID of the subcourt.\"},\"returns\":{\"stake\":\"The stake.\"}}},\"title\":\"xKlerosLiquidV2\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol\":\"xKlerosLiquidV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@kleros/vea-contracts/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @hrishibhat]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /**\\n * @dev The Fast Bridge participants watch for these events to decide if a challenge should be submitted.\\n * @param _epoch The epoch for which the the claim was made.\\n * @param _batchMerkleRoot The timestamp of the claim creation.\\n */\\n event ClaimReceived(uint256 indexed _epoch, bytes32 indexed _batchMerkleRoot);\\n\\n /**\\n * @dev This event indicates that `sendSafeFallback()` should be called on the sending side.\\n * @param _epoch The epoch associated with the challenged claim.\\n */\\n event ClaimChallenged(uint256 indexed _epoch);\\n\\n /**\\n * @dev This events indicates that optimistic verification has succeeded. The messages are ready to be relayed.\\n * @param _epoch The epoch associated with the batch.\\n * @param _success The success of the optimistic verification.\\n */\\n event BatchVerified(uint256 indexed _epoch, bool _success);\\n\\n /**\\n * @dev This event indicates that the batch has been received via the Safe Bridge.\\n * @param _epoch The epoch associated with the batch.\\n * @param _isBridgerHonest Whether the bridger made an honest claim.\\n * @param _isChallengerHonest Whether the bridger made an honest challenge.\\n */\\n event BatchSafeVerified(uint256 indexed _epoch, bool _isBridgerHonest, bool _isChallengerHonest);\\n\\n /**\\n * @dev This event indicates that the claim deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _bridger The recipient of the claim deposit.\\n */\\n event ClaimDepositWithdrawn(uint256 indexed _epoch, address indexed _bridger);\\n\\n /**\\n * @dev This event indicates that the challenge deposit has been withdrawn.\\n * @param _epoch The epoch associated with the batch.\\n * @param _challenger The recipient of the challenge deposit.\\n */\\n event ChallengeDepositWithdrawn(uint256 indexed _epoch, address indexed _challenger);\\n\\n /**\\n * @dev This event indicates that a message has been relayed for the batch in this `_epoch`.\\n * @param _epoch The epoch associated with the batch.\\n * @param _nonce The nonce of the message that was relayed.\\n */\\n event MessageRelayed(uint256 indexed _epoch, uint256 indexed _nonce);\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Submit a claim about the `_batchMerkleRoot` for the latests completed Fast bridge epoch and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to claim.\\n * @param _batchMerkleRoot The hash claimed for the ticket.\\n */\\n function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable;\\n\\n /**\\n * @dev Submit a challenge for the claim of the current epoch's Fast Bridge batch merkleroot state and submit a deposit. The `batchMerkleRoot` in the claim already made for the last finalized epoch should be different from the one on the sending side, otherwise the sender will lose his deposit.\\n * @param _epoch The epoch of the claim to challenge.\\n */\\n function challenge(uint256 _epoch) external payable;\\n\\n /**\\n * @dev Resolves the optimistic claim for '_epoch'.\\n * @param _epoch The epoch of the optimistic claim.\\n */\\n function verifyBatch(uint256 _epoch) external;\\n\\n /**\\n * @dev Verifies merkle proof for the given message and associated nonce for the most recent possible epoch and relays the message.\\n * @param _epoch The epoch in which the message was batched by the bridge.\\n * @param _proof The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch.\\n * @param _message The data on the cross-domain chain for the message.\\n */\\n function verifyAndRelayMessage(\\n uint256 _epoch,\\n bytes32[] calldata _proof,\\n bytes calldata _message\\n ) external;\\n\\n /**\\n * @dev Sends the deposit back to the Bridger if their claim is not successfully challenged. Includes a portion of the Challenger's deposit if unsuccessfully challenged.\\n * @param _epoch The epoch associated with the claim deposit to withraw.\\n */\\n function withdrawClaimDeposit(uint256 _epoch) external;\\n\\n /**\\n * @dev Sends the deposit back to the Challenger if his challenge is successful. Includes a portion of the Bridger's deposit.\\n * @param _epoch The epoch associated with the challenge deposit to withraw.\\n */\\n function withdrawChallengeDeposit(uint256 _epoch) external;\\n\\n // ************************************* //\\n // * Public Views * //\\n // ************************************* //\\n\\n /**\\n * @dev Returns the `start` and `end` time of challenge period for this `epoch`.\\n * @param _epoch The epoch of the claim to request the challenge period.\\n * @return start The start time of the challenge period.\\n * @return end The end time of the challenge period.\\n */\\n function claimChallengePeriod(uint256 _epoch) external view returns (uint256 start, uint256 end);\\n\\n /**\\n * @dev Returns the epoch period.\\n */\\n function epochPeriod() external view returns (uint256 epochPeriod);\\n\\n /**\\n * @dev Returns the challenge period.\\n */\\n function challengePeriod() external view returns (uint256 challengePeriod);\\n}\\n\",\"keccak256\":\"0xff909a62e9a08540dafcd08c779a64917ed1e44be52d5a225ff9149ff95909e8\",\"license\":\"MIT\"},\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IFastBridgeReceiver.sol\\\";\\n\\ninterface IReceiverGateway {\\n function fastBridgeReceiver() external view returns (IFastBridgeReceiver);\\n\\n function senderChainID() external view returns (uint256);\\n\\n function senderGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xfa82fbd575c462ad6dffa18c67eb097a4c5088715ae956a836726aafa4be0f90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\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 * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\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 {ERC1967Proxy-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 * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 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 bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\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(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\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 require(_initializing, \\\"Initializable: contract is not initializing\\\");\\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 require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _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 _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x3798da9e212cd00a7cda94ddb5a9721171a718e89c500d8901f810e0e37fa74e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0f633a0223d9a1dcccfcf38a64c9de0874dfcbfac0c6941ccf074d63a2ce0e1e\",\"license\":\"MIT\"},\"src/arbitration/IArbitrable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrator.sol\\\";\\n\\n/**\\n * @title IArbitrable\\n * Arbitrable interface. Note that this interface follows the ERC-792 standard.\\n * When developing arbitrable contracts, we need to:\\n * - Define the action taken when a ruling is received by the contract.\\n * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);\\n */\\ninterface IArbitrable {\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrator The arbitrator giving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Give a ruling for a dispute. 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 ID of the dispute in the Arbitrator contract.\\n * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for \\\"Not able/wanting to make a decision\\\".\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external;\\n}\\n\",\"keccak256\":\"0x8f1c36f6206566f0790448a654190e68a43a1dd2e039c2b77e7455d3fcd599a4\",\"license\":\"MIT\"},\"src/arbitration/IArbitrator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IArbitrable.sol\\\";\\n\\n/**\\n * @title Arbitrator\\n * Arbitrator interface that implements the new arbitration standard.\\n * Unlike the ERC-792 this standard doesn't have anything related to 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).\\n */\\ninterface IArbitrator {\\n /**\\n * @dev To be emitted when a dispute is created.\\n * @param _disputeID ID of the dispute.\\n * @param _arbitrable The contract which created the dispute.\\n */\\n event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);\\n\\n /**\\n * @dev To be raised when a ruling is given.\\n * @param _arbitrable The arbitrable receiving the ruling.\\n * @param _disputeID ID of the dispute in the Arbitrator contract.\\n * @param _ruling The ruling which was given.\\n */\\n event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);\\n\\n /**\\n * @dev Create a dispute. Must be called by the arbitrable contract.\\n * Must pay at least arbitrationCost(_extraData).\\n * @param _choices Amount of choices the arbitrator can make in this dispute.\\n * @param _extraData Can be used to give additional info on the dispute to be created.\\n * @return disputeID ID of the dispute created.\\n */\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);\\n\\n /**\\n * @dev Compute the cost of arbitration. 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 Can be used to give additional info on the dispute to be created.\\n * @return cost Required cost of arbitration.\\n */\\n function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);\\n}\\n\",\"keccak256\":\"0x2264bc7cb975d89776b9bf3e35cecd4dec7d601604601ca4822d8bfc0886c379\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@jaybuidl, @shotaronowhere, @shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrator.sol\\\";\\nimport \\\"@kleros/vea-contracts/interfaces/IReceiverGateway.sol\\\";\\n\\ninterface IForeignGateway is IArbitrator, IReceiverGateway {\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external;\\n\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n // For cross-chain Evidence standard\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function createDisputeERC20(\\n uint256 _choices,\\n bytes calldata _extraData,\\n uint256 _amount\\n ) external returns (uint256 disputeID);\\n}\\n\",\"keccak256\":\"0x4cfc88d2d7cf211ce9a1f3c991f093baefa026784185da2319d566051d0c8c43\",\"license\":\"MIT\"},\"src/kleros-v1/interfaces/ITokenController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @dev The token controller contract must implement these functions. See https://github.com/Giveth/minime/blob/master/contracts/TokenController.sol\\n */\\ninterface ITokenController {\\n /**\\n * @notice Called when `_owner` sends ether to the MiniMe Token contract\\n * @param _owner The address that sent the ether to create tokens\\n * @return True if the ether is accepted, false if it throws\\n */\\n function proxyPayment(address _owner) external payable returns (bool);\\n\\n /**\\n * @notice Notifies the controller about a token transfer allowing the controller to react if desired\\n * @param _from The origin of the transfer\\n * @param _to The destination of the transfer\\n * @param _amount The amount of the transfer\\n * @return False if the controller does not authorize the transfer\\n */\\n function onTransfer(address _from, address _to, uint256 _amount) external returns (bool);\\n\\n /**\\n * @notice Notifies the controller about an approval allowing the controller to react if desired\\n * @param _owner The address that calls `approve()`\\n * @param _spender The spender in the `approve()` call\\n * @param _amount The amount in the `approve()` call\\n * @return False if the controller does not authorize the approval\\n */\\n function onApprove(address _owner, address _spender, uint256 _amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x872b17903608262164b43c7304e9fe1d6ae631070ffd2c911e7508d7f7cf7c91\",\"license\":\"MIT\"},\"src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\nimport \\\"../interfaces/ITokenController.sol\\\";\\nimport \\\"./interfaces/ITokenBridge.sol\\\";\\nimport \\\"./interfaces/IERC677.sol\\\";\\n\\ncontract WrappedPinakion is Initializable {\\n using SafeMath for uint256;\\n\\n /* Events */\\n\\n /**\\n * @notice Emitted when `value` tokens are moved from one account (`from`) to another (`to`).\\n * @dev Notice that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @notice 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 /* Storage */\\n\\n mapping(address => uint256) private balances;\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /// @notice Total supply of the token. Equals the total xPinakion deposit into the contract.\\n uint256 public totalSupply;\\n\\n /// @notice Name of the token.\\n string public name;\\n\\n /// @notice Symbol of the token.\\n string public symbol;\\n\\n /// @notice Number of decimals of the token.\\n uint8 public decimals;\\n\\n /// @notice The token's controller.\\n address public controller;\\n\\n /// @notice Bridged PNK on xDai to be wrapped. This token is upgradeable.\\n IERC677 public xPinakion;\\n\\n /// @notice xDai Token Bridge. The Token Bridge is upgradeable.\\n ITokenBridge public tokenBridge;\\n\\n /* Modifiers */\\n\\n /// @dev Verifies that the sender has ability to modify controlled parameters.\\n modifier onlyController() {\\n require(controller == msg.sender, \\\"The caller is not the controller.\\\");\\n _;\\n }\\n\\n /* Initializer */\\n\\n /**\\n * @dev Constructor.\\n * @param _name for the wrapped PNK on the home chain.\\n * @param _symbol for wrapped PNK ticker on the home chain.\\n * @param _xPinakion the home PNK contract which is already bridged to the foreign PNK contract.\\n * @param _tokenBridge the TokenBridge contract.\\n */\\n function initialize(\\n string memory _name,\\n string memory _symbol,\\n IERC677 _xPinakion,\\n ITokenBridge _tokenBridge\\n ) public initializer {\\n name = _name;\\n symbol = _symbol;\\n decimals = 18;\\n xPinakion = _xPinakion;\\n tokenBridge = _tokenBridge;\\n controller = msg.sender;\\n }\\n\\n /* External */\\n\\n /**\\n * @notice Changes `controller` to `_controller`.\\n * @param _controller The new controller of the contract\\n */\\n function changeController(address _controller) external onlyController {\\n controller = _controller;\\n }\\n\\n /**\\n * @notice Converts bridged PNK (xPinakion) into wrapped PNK which can be staked in KlerosLiquid.\\n * @param _amount The amount of wrapped pinakions to mint.\\n */\\n function deposit(uint256 _amount) external {\\n _mint(msg.sender, _amount);\\n require(\\n xPinakion.transferFrom(msg.sender, address(this), _amount),\\n \\\"Sender does not have enough approved funds.\\\"\\n );\\n }\\n\\n /**\\n * @notice IERC20 Receiver functionality.\\n * @dev Converts bridged PNK (xPinakion) into wrapped PNK which can be staked in KlerosLiquid.\\n * If the tokenBridge is calling this function, then this contract has already received\\n * the xPinakion tokens. Notice that the Home bridge calls onTokenBridge as a result of\\n * someone invoking `relayTokensAndCall()` on the Foreign bridge contract.\\n * @param _token The token address the _amount belongs to.\\n * @param _amount The amount of wrapped PNK to mint.\\n * @param _data Calldata containing the address of the recipient.\\n * Notice that the address has to be padded to the right 32 bytes.\\n */\\n function onTokenBridged(address _token, uint256 _amount, bytes calldata _data) external {\\n require(msg.sender == address(tokenBridge), \\\"Sender not authorized.\\\");\\n require(_token == address(xPinakion), \\\"Token bridged is not xPinakion.\\\");\\n\\n address recipient;\\n assembly {\\n recipient := calldataload(0x84)\\n }\\n _mint(recipient, _amount);\\n }\\n\\n /**\\n * @notice Converts wrapped PNK back into bridged PNK (xPinakion).\\n * @param _amount The amount of bridged PNK to withdraw.\\n */\\n function withdraw(uint256 _amount) external {\\n _burn(_amount);\\n require(xPinakion.transfer(msg.sender, _amount), \\\"The `transfer` function must not fail.\\\");\\n }\\n\\n /**\\n * @notice Converts wrapped PNK back into PNK using the Token Bridge.\\n * @dev This function is not strictly needed, but it provides a good UX to users who want to get their Mainnet's PNK back.\\n * What normally takes 3 transactions, here is done in one go.\\n * Notice that the PNK have to be claimed on Mainnet's TokenBridge by the receiver.\\n * @param _amount The amount of PNK to withdraw.\\n * @param _receiver The address which will receive the PNK back in the foreign chain.\\n */\\n function withdrawAndConvertToPNK(uint256 _amount, address _receiver) external {\\n _burn(_amount);\\n // Using approve is safe here, because this contract approves the bridge to spend the tokens and triggers the relay immediately.\\n xPinakion.approve(address(tokenBridge), _amount);\\n tokenBridge.relayTokens(xPinakion, _receiver, _amount);\\n }\\n\\n /**\\n * @notice Moves `_amount` tokens from the caller's account to `_recipient`.\\n * @param _recipient The entity receiving the funds.\\n * @param _amount The amount to tranfer in base units.\\n * @return True on success.\\n */\\n function transfer(address _recipient, uint256 _amount) public returns (bool) {\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onTransfer(msg.sender, _recipient, _amount),\\n \\\"Token controller rejects transfer.\\\"\\n );\\n }\\n balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: transfer amount exceeds balance\\n balances[_recipient] = balances[_recipient].add(_amount);\\n emit Transfer(msg.sender, _recipient, _amount);\\n return true;\\n }\\n\\n /**\\n * @notice Moves `_amount` tokens from `_sender` to `_recipient` using the\\n * allowance mechanism. `_amount` is then deducted from the caller's allowance.\\n * @param _sender The entity to take the funds from.\\n * @param _recipient The entity receiving the funds.\\n * @param _amount The amount to tranfer in base units.\\n * @return True on success.\\n */\\n function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) {\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onTransfer(_sender, _recipient, _amount),\\n \\\"Token controller rejects transfer.\\\"\\n );\\n }\\n\\n /** The controller of this contract can move tokens around at will,\\n * this is important to recognize! Confirm that you trust the\\n * controller of this contract, which in most situations should be\\n * another open source smart contract or 0x0.\\n */\\n if (msg.sender != controller) {\\n allowance[_sender][msg.sender] = allowance[_sender][msg.sender].sub(_amount); // ERC20: transfer amount exceeds allowance.\\n }\\n\\n balances[_sender] = balances[_sender].sub(_amount); // ERC20: transfer amount exceeds balance\\n balances[_recipient] = balances[_recipient].add(_amount);\\n emit Transfer(_sender, _recipient, _amount);\\n return true;\\n }\\n\\n /**\\n * @notice Approves `_spender` to spend `_amount`.\\n * @param _spender The entity allowed to spend funds.\\n * @param _amount The amount of base units the entity will be allowed to spend.\\n * @return True on success.\\n */\\n function approve(address _spender, uint256 _amount) public returns (bool) {\\n // Alerts the token controller of the approve function call\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onApprove(msg.sender, _spender, _amount),\\n \\\"Token controller does not approve.\\\"\\n );\\n }\\n\\n allowance[msg.sender][_spender] = _amount;\\n emit Approval(msg.sender, _spender, _amount);\\n return true;\\n }\\n\\n /**\\n * @notice Increases the `_spender` allowance by `_addedValue`.\\n * @param _spender The entity allowed to spend funds.\\n * @param _addedValue The amount of extra base units the entity will be allowed to spend.\\n * @return True on success.\\n */\\n function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {\\n uint256 newAllowance = allowance[msg.sender][_spender].add(_addedValue);\\n // Alerts the token controller of the approve function call\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onApprove(msg.sender, _spender, newAllowance),\\n \\\"Token controller does not approve.\\\"\\n );\\n }\\n\\n allowance[msg.sender][_spender] = newAllowance;\\n emit Approval(msg.sender, _spender, newAllowance);\\n return true;\\n }\\n\\n /**\\n * @notice Decreases the `_spender` allowance by `_subtractedValue`.\\n * @param _spender The entity whose spending allocation will be reduced.\\n * @param _subtractedValue The reduction of spending allocation in base units.\\n * @return True on success.\\n */\\n function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {\\n uint256 newAllowance = allowance[msg.sender][_spender].sub(_subtractedValue); // ERC20: decreased allowance below zero\\n // Alerts the token controller of the approve function call\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onApprove(msg.sender, _spender, newAllowance),\\n \\\"Token controller does not approve.\\\"\\n );\\n }\\n\\n allowance[msg.sender][_spender] = newAllowance;\\n emit Approval(msg.sender, _spender, newAllowance);\\n return true;\\n }\\n\\n /* Internal */\\n\\n /**\\n * @dev Internal function that mints an amount of the token and assigns it to\\n * an account. This encapsulates the modification of balances such that the\\n * proper events are emitted.\\n * @param _recipient The address which will receive the minted tokens.\\n * @param _amount The amount that will be created.\\n */\\n function _mint(address _recipient, uint256 _amount) internal {\\n totalSupply = totalSupply.add(_amount);\\n balances[_recipient] = balances[_recipient].add(_amount);\\n emit Transfer(address(0x0), _recipient, _amount);\\n }\\n\\n /**\\n * @dev Destroys `_amount` tokens from the caller. Cannot burn locked tokens.\\n * @param _amount The quantity of tokens to burn in base units.\\n */\\n function _burn(uint256 _amount) internal {\\n if (isContract(controller)) {\\n require(\\n ITokenController(controller).onTransfer(msg.sender, address(0x0), _amount),\\n \\\"Token controller rejects transfer.\\\"\\n );\\n }\\n balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: burn amount exceeds balance\\n totalSupply = totalSupply.sub(_amount);\\n emit Transfer(msg.sender, address(0x0), _amount);\\n }\\n\\n /**\\n * @dev Internal function to determine if an address is a contract.\\n * @param _addr The address being queried.\\n * @return True if `_addr` is a contract.\\n */\\n function isContract(address _addr) internal view returns (bool) {\\n uint256 size;\\n if (_addr == address(0)) return false;\\n assembly {\\n size := extcodesize(_addr)\\n }\\n return size > 0;\\n }\\n\\n /* Getters */\\n\\n /**\\n * @dev Gets the balance of the specified address.\\n * @param _owner The address to query the balance of.\\n * @return uint256 value representing the amount owned by the passed address.\\n */\\n function balanceOf(address _owner) public view returns (uint256) {\\n return balances[_owner];\\n }\\n}\\n\",\"keccak256\":\"0x1cdaf0dd439866cb5029d3299bd3bb7412c4d55aeafebdd168a60914da741606\",\"license\":\"MIT\"},\"src/kleros-v1/kleros-liquid-xdai/interfaces/IERC677.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface IERC677 {\\n function transfer(address _to, uint256 _value) external returns (bool);\\n\\n function transferFrom(address _from, address _to, uint256 _value) external returns (bool);\\n\\n function approve(address _spender, uint256 _value) external returns (bool);\\n}\\n\",\"keccak256\":\"0x901e298088578c3333807574c52d2d288a1a1036531bd85168f9505cb85168e7\",\"license\":\"MIT\"},\"src/kleros-v1/kleros-liquid-xdai/interfaces/IRandomAuRa.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\ninterface IRandomAuRa {\\n function currentSeed() external view returns (uint256);\\n\\n function isCommitPhase() external view returns (bool);\\n\\n function nextCommitPhaseStartBlock() external view returns (uint256);\\n\\n function collectRoundLength() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x0fcb472d7f826d65845caa8683bb25159ae0ce4bbc03fe1569af7a65dca7398d\",\"license\":\"MIT\"},\"src/kleros-v1/kleros-liquid-xdai/interfaces/ITokenBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"./IERC677.sol\\\";\\n\\ninterface ITokenBridge {\\n function relayTokens(IERC677 token, address _receiver, uint256 _value) external;\\n}\\n\",\"keccak256\":\"0x8054fe008a2a2473ab24168068e9207b54bc0ac9a6de31899f5da62ef1a85805\",\"license\":\"MIT\"},\"src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IArbitrator, IArbitrable} from \\\"../../arbitration/IArbitrator.sol\\\";\\nimport {ITokenController} from \\\"../interfaces/ITokenController.sol\\\";\\nimport {WrappedPinakion} from \\\"./WrappedPinakion.sol\\\";\\nimport {IRandomAuRa} from \\\"./interfaces/IRandomAuRa.sol\\\";\\n\\nimport {SortitionSumTreeFactory} from \\\"../../libraries/SortitionSumTreeFactory.sol\\\";\\nimport \\\"../../gateway/interfaces/IForeignGateway.sol\\\";\\n\\n/**\\n * @title xKlerosLiquidV2\\n * @dev This contract is an adaption of Mainnet's KlerosLiquid (https://github.com/kleros/kleros/blob/69cfbfb2128c29f1625b3a99a3183540772fda08/contracts/kleros/KlerosLiquid.sol)\\n * for xDai chain. Notice that variables referring to ETH values in this contract, will hold the native token values of the chain on which xKlerosLiquid is deployed.\\n * When this contract gets deployed on xDai chain, ETH variables will hold xDai values.\\n */\\ncontract xKlerosLiquidV2 is Initializable, ITokenController, IArbitrator {\\n /* Enums */\\n\\n // General\\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 // Dispute\\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 /* Structs */\\n\\n // General\\n struct Court {\\n uint96 parent; // The parent court.\\n uint256[] children; // List of child courts.\\n bool hiddenVotes; // Whether to use commit and reveal or not.\\n uint256 minStake; // Minimum tokens needed to stake in the court.\\n uint256 alpha; // Basis point of tokens that are lost when incoherent.\\n uint256 feeForJuror; // Arbitration fee paid per juror.\\n // The appeal after the one that reaches this number of jurors will go to the parent court if any, otherwise, no more appeals are possible.\\n uint256 jurorsForCourtJump;\\n uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.\\n }\\n struct DelayedSetStake {\\n address account; // The address of the juror.\\n uint96 subcourtID; // The ID of the subcourt.\\n uint128 stake; // The new stake.\\n }\\n\\n // Dispute\\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 or revealed, false otherwise.\\n }\\n struct VoteCounter {\\n // 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 uint256 winningChoice;\\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 }\\n struct Dispute {\\n // Note that appeal `0` is equivalent to the first round of the dispute.\\n uint96 subcourtID; // The ID of the subcourt the dispute is in.\\n IArbitrable arbitrated; // The arbitrated arbitrable contract.\\n // The number of choices jurors have when voting. This does not include choice `0` which is reserved for \\\"refuse to arbitrate\\\"/\\\"no ruling\\\".\\n uint256 numberOfChoices;\\n Period period; // The current period of the dispute.\\n uint256 lastPeriodChange; // The last time the period was changed.\\n // The votes in the form `votes[appeal][voteID]`. On each round, a new list is pushed and packed with as many empty votes as there are draws. We use `dispute.votes.length` to get the number of appeals plus 1 for the first round.\\n Vote[][] votes;\\n VoteCounter[] voteCounters; // The vote counters in the form `voteCounters[appeal]`.\\n uint256[] tokensAtStakePerJuror; // The amount of tokens at stake for each juror in the form `tokensAtStakePerJuror[appeal]`.\\n uint256[] totalFeesForJurors; // The total juror fees paid in the form `totalFeesForJurors[appeal]`.\\n uint256 drawsInRound; // A counter of draws made in the current round.\\n uint256 commitsInRound; // A counter of commits made in the current round.\\n uint256[] votesInEachRound; // A counter of votes made in each round in the form `votesInEachRound[appeal]`.\\n // A counter of vote reward repartitions made in each round in the form `repartitionsInEachRound[appeal]`.\\n uint256[] repartitionsInEachRound;\\n uint256[] penaltiesInEachRound; // The amount of tokens collected from penalties in each round in the form `penaltiesInEachRound[appeal]`.\\n bool ruled; // True if the ruling has been executed, false otherwise.\\n }\\n\\n // Juror\\n struct Juror {\\n // The IDs of subcourts where the juror has stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`.\\n uint96[] subcourtIDs;\\n uint256 stakedTokens; // The juror's total amount of tokens staked in subcourts.\\n uint256 lockedTokens; // The juror's total amount of tokens locked in disputes.\\n }\\n\\n /* Events */\\n\\n /** @dev Emitted when we pass to a new phase.\\n * @param _phase The new phase.\\n */\\n event NewPhase(Phase _phase);\\n\\n /** @dev Emitted when a dispute passes to a new period.\\n * @param _disputeID The ID of the dispute.\\n * @param _period The new period.\\n */\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\n\\n /** @dev Emitted when a juror's stake is set.\\n * @param _address The address of the juror.\\n * @param _subcourtID The ID of the subcourt at the end of the stake path.\\n * @param _stake The new stake.\\n * @param _newTotalStake The new total stake.\\n */\\n event StakeSet(address indexed _address, uint256 _subcourtID, uint128 _stake, uint256 _newTotalStake);\\n\\n /** @dev Emitted when a juror is drawn.\\n * @param _address The drawn address.\\n * @param _disputeID The ID of the dispute.\\n * @param _appeal The appeal the draw is for. 0 is for the first round.\\n * @param _voteID The vote ID.\\n */\\n event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _appeal, uint256 _voteID);\\n\\n /** @dev Emitted when a juror wins or loses tokens and ETH from a dispute.\\n * @param _address The juror affected.\\n * @param _disputeID The ID of the dispute.\\n * @param _tokenAmount The amount of tokens won or lost.\\n * @param _ETHAmount The amount of ETH won or lost.\\n */\\n event TokenAndETHShift(address indexed _address, uint256 indexed _disputeID, int _tokenAmount, int _ETHAmount);\\n\\n /* Storage */\\n\\n // General Constants\\n uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have.\\n uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute.\\n uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH.\\n uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by.\\n // General Contracts\\n address public governor; // The governor of the contract.\\n WrappedPinakion public pinakion; // The Pinakion token contract.\\n IRandomAuRa public RNGenerator; // The random number generator contract.\\n // General Dynamic\\n Phase public phase; // The current phase.\\n uint256 public lastPhaseChange; // The last time the phase was changed.\\n uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors.\\n // The block number to get the next random number from. Used so there is at least a 1 block difference from the staking phase.\\n uint256 public RNBlock;\\n uint256 public RN; // The current random number.\\n uint256 public minStakingTime; // The minimum staking time.\\n uint256 public maxDrawingTime; // The maximum drawing time.\\n // True if insolvent (`balance < stakedTokens || balance < lockedTokens`) token transfers should be blocked. Used to avoid blocking penalties.\\n bool public lockInsolventTransfers;\\n // General Storage\\n Court[] public courts; // The subcourts.\\n using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees; // Use library functions for sortition sum trees.\\n SortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees.\\n // The delayed calls to `_setStake`. Used to schedule `_setStake`s when not in the staking phase.\\n mapping(uint256 => DelayedSetStake) public delayedSetStakes;\\n // The index of the next `delayedSetStakes` item to execute. Starts at 1 because `lastDelayedSetStake` starts at 0.\\n uint256 public nextDelayedSetStake;\\n uint256 public lastDelayedSetStake; // The index of the last `delayedSetStakes` item. 0 is skipped because it is the initial value.\\n\\n // Dispute\\n // Use a mapping instead of an array so that upgrading (appending variables to) the Dispute struct is possible without big layout changes.\\n mapping(uint256 => Dispute) public disputes; // The disputes.\\n uint256 public totalDisputes;\\n\\n // Juror\\n mapping(address => Juror) public jurors; // The jurors.\\n\\n IForeignGateway public foreignGateway; // Foreign gateway contract.\\n IERC20 public weth; // WETH token address.\\n\\n mapping(uint256 => uint256) public disputesRuling;\\n\\n /* Modifiers */\\n\\n /** @dev Requires a specific phase.\\n * @param _phase The required phase.\\n */\\n modifier onlyDuringPhase(Phase _phase) {\\n require(phase == _phase);\\n _;\\n }\\n\\n /** @dev Requires a specific period in a dispute.\\n * @param _disputeID The ID of the dispute.\\n * @param _period The required period.\\n */\\n modifier onlyDuringPeriod(uint256 _disputeID, Period _period) {\\n require(disputes[_disputeID].period == _period);\\n _;\\n }\\n\\n /** @dev Requires that the sender is the governor. Note that the governor is expected to not be malicious. */\\n modifier onlyByGovernor() {\\n require(governor == msg.sender);\\n _;\\n }\\n\\n /* Constructor */\\n\\n /** @dev Constructs the KlerosLiquid contract.\\n * @param _governor The governor's address.\\n * @param _pinakion The address of the token contract.\\n * @param _RNGenerator The address of the random number generator contract.\\n * @param _minStakingTime The minimum time that the staking phase should last.\\n * @param _maxDrawingTime The maximum time that the drawing phase should last.\\n * @param _hiddenVotes The `hiddenVotes` property value of the general court.\\n * @param _courtParameters MinStake, alpha, feeForJuror and jurorsForCourtJump respectively.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the general court.\\n * @param _sortitionSumTreeK The number of children per node of the general court's sortition sum tree.\\n * @param _foreignGateway Foreign gateway on xDai.\\n * @param _weth Weth contract.\\n */\\n function initialize(\\n address _governor,\\n WrappedPinakion _pinakion,\\n IRandomAuRa _RNGenerator,\\n uint256 _minStakingTime,\\n uint256 _maxDrawingTime,\\n bool _hiddenVotes,\\n uint256[4] memory _courtParameters,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK,\\n IForeignGateway _foreignGateway,\\n IERC20 _weth\\n ) public initializer {\\n // Initialize contract.\\n governor = _governor;\\n pinakion = _pinakion;\\n RNGenerator = _RNGenerator;\\n minStakingTime = _minStakingTime;\\n maxDrawingTime = _maxDrawingTime;\\n phase = Phase.staking;\\n lastPhaseChange = block.timestamp;\\n lockInsolventTransfers = true;\\n if (nextDelayedSetStake == 0) nextDelayedSetStake = 1;\\n foreignGateway = _foreignGateway;\\n weth = _weth;\\n\\n // Create the general court.\\n if (courts.length == 0) {\\n courts.push(\\n Court({\\n parent: 0,\\n children: new uint256[](0),\\n hiddenVotes: _hiddenVotes,\\n minStake: _courtParameters[0],\\n alpha: _courtParameters[1],\\n feeForJuror: _courtParameters[2],\\n jurorsForCourtJump: _courtParameters[3],\\n timesPerPeriod: _timesPerPeriod\\n })\\n );\\n sortitionSumTrees.createTree(bytes32(0), _sortitionSumTreeK);\\n }\\n }\\n\\n /* External */\\n\\n /** @dev Lets the governor 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 */\\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 */\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n /** @dev Changes the `pinakion` storage variable.\\n * @param _pinakion The new value for the `pinakion` storage variable.\\n */\\n function changePinakion(WrappedPinakion _pinakion) external onlyByGovernor {\\n pinakion = _pinakion;\\n }\\n\\n /** @dev Changes the `RNGenerator` storage variable.\\n * @param _RNGenerator The new value for the `RNGenerator` storage variable.\\n */\\n function changeRNGenerator(IRandomAuRa _RNGenerator) external onlyByGovernor {\\n RNGenerator = _RNGenerator;\\n if (phase == Phase.generating) {\\n RNBlock = RNGenerator.nextCommitPhaseStartBlock() + RNGenerator.collectRoundLength();\\n }\\n }\\n\\n /** @dev Changes the `minStakingTime` storage variable.\\n * @param _minStakingTime The new value for the `minStakingTime` storage variable.\\n */\\n function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor {\\n minStakingTime = _minStakingTime;\\n }\\n\\n /** @dev Changes the `maxDrawingTime` storage variable.\\n * @param _maxDrawingTime The new value for the `maxDrawingTime` storage variable.\\n */\\n function changeMaxDrawingTime(uint256 _maxDrawingTime) external onlyByGovernor {\\n maxDrawingTime = _maxDrawingTime;\\n }\\n\\n /** @dev Changes the `foreignGateway` storage variable.\\n * @param _foreignGateway The new value for the `foreignGateway` storage variable.\\n */\\n function changeForeignGateway(IForeignGateway _foreignGateway) external onlyByGovernor {\\n foreignGateway = _foreignGateway;\\n }\\n\\n /** @dev Changes the `weth` storage variable.\\n * @param _weth The new value for the `weth` storage variable.\\n */\\n function changeWethAddress(IERC20 _weth) external onlyByGovernor {\\n weth = _weth;\\n }\\n\\n /** @dev Creates a subcourt under a specified parent court.\\n * @param _parent The `parent` property value of the subcourt.\\n * @param _hiddenVotes The `hiddenVotes` property value of the subcourt.\\n * @param _minStake The `minStake` property value of the subcourt.\\n * @param _alpha The `alpha` property value of the subcourt.\\n * @param _feeForJuror The `feeForJuror` property value of the subcourt.\\n * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the subcourt.\\n * @param _timesPerPeriod The `timesPerPeriod` property value of the subcourt.\\n * @param _sortitionSumTreeK The number of children per node of the subcourt's sortition sum tree.\\n */\\n function createSubcourt(\\n uint96 _parent,\\n bool _hiddenVotes,\\n uint256 _minStake,\\n uint256 _alpha,\\n uint256 _feeForJuror,\\n uint256 _jurorsForCourtJump,\\n uint256[4] memory _timesPerPeriod,\\n uint256 _sortitionSumTreeK\\n ) external onlyByGovernor {\\n require(\\n courts[_parent].minStake <= _minStake,\\n \\\"A subcourt cannot be a child of a subcourt with a higher minimum stake.\\\"\\n );\\n\\n // Create the subcourt.\\n uint256 subcourtID = courts.length;\\n Court storage subcourt = courts.push();\\n subcourt.parent = _parent;\\n subcourt.children = new uint256[](0);\\n subcourt.hiddenVotes = _hiddenVotes;\\n subcourt.minStake = _minStake;\\n subcourt.alpha = _alpha;\\n subcourt.feeForJuror = _feeForJuror;\\n subcourt.jurorsForCourtJump = _jurorsForCourtJump;\\n subcourt.timesPerPeriod = _timesPerPeriod;\\n sortitionSumTrees.createTree(bytes32(subcourtID), _sortitionSumTreeK);\\n\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n }\\n\\n /** @dev Changes the `minStake` property value of a specified subcourt. Don't set to a value lower than its parent's `minStake` property value.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _minStake The new value for the `minStake` property value.\\n */\\n function changeSubcourtMinStake(uint96 _subcourtID, uint256 _minStake) external onlyByGovernor {\\n require(_subcourtID == 0 || courts[courts[_subcourtID].parent].minStake <= _minStake);\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(\\n courts[courts[_subcourtID].children[i]].minStake >= _minStake,\\n \\\"A subcourt cannot be the parent of a subcourt with a lower minimum stake.\\\"\\n );\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n }\\n\\n /** @dev Changes the `alpha` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _alpha The new value for the `alpha` property value.\\n */\\n function changeSubcourtAlpha(uint96 _subcourtID, uint256 _alpha) external onlyByGovernor {\\n courts[_subcourtID].alpha = _alpha;\\n }\\n\\n /** @dev Changes the `feeForJuror` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function changeSubcourtJurorFee(uint96 _subcourtID, uint256 _feeForJuror) external onlyByGovernor {\\n courts[_subcourtID].feeForJuror = _feeForJuror;\\n }\\n\\n /** @dev Changes the `jurorsForCourtJump` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value.\\n */\\n function changeSubcourtJurorsForJump(uint96 _subcourtID, uint256 _jurorsForCourtJump) external onlyByGovernor {\\n courts[_subcourtID].jurorsForCourtJump = _jurorsForCourtJump;\\n }\\n\\n /** @dev Changes the `timesPerPeriod` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _timesPerPeriod The new value for the `timesPerPeriod` property value.\\n */\\n function changeSubcourtTimesPerPeriod(\\n uint96 _subcourtID,\\n uint256[4] memory _timesPerPeriod\\n ) external onlyByGovernor {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n }\\n\\n /** @dev Sets the caller's stake in a subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _stake The new stake.\\n */\\n function setStake(uint96 _subcourtID, uint128 _stake) external {\\n require(_setStake(msg.sender, _subcourtID, _stake));\\n }\\n\\n /** @dev Executes the next delayed set stakes.\\n * `O(n)` where `n` is the number of iterations to run.\\n * @param _iterations The number of delayed set stakes to execute.\\n */\\n function executeDelayedSetStakes(uint256 _iterations) external onlyDuringPhase(Phase.staking) {\\n uint256 actualIterations = (nextDelayedSetStake + _iterations) - 1 > lastDelayedSetStake\\n ? (lastDelayedSetStake - nextDelayedSetStake) + 1\\n : _iterations;\\n uint256 newNextDelayedSetStake = nextDelayedSetStake + actualIterations;\\n require(newNextDelayedSetStake >= nextDelayedSetStake);\\n for (uint256 i = nextDelayedSetStake; i < newNextDelayedSetStake; i++) {\\n DelayedSetStake storage delayedSetStake = delayedSetStakes[i];\\n _setStake(delayedSetStake.account, delayedSetStake.subcourtID, delayedSetStake.stake);\\n delete delayedSetStakes[i];\\n }\\n nextDelayedSetStake = newNextDelayedSetStake;\\n }\\n\\n /** @dev Receive the ruling from foreign gateway which technically is an arbitrator of this contract.\\n * @param _disputeID ID of the dispute.\\n * @param _ruling Ruling given by V2 court and relayed by foreign gateway.\\n */\\n function rule(uint256 _disputeID, uint256 _ruling) external {\\n require(_disputeID < totalDisputes, \\\"Dispute ID does not exist.\\\");\\n require(msg.sender == address(foreignGateway), \\\"Can only be called by gateway\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(!dispute.ruled, \\\"Ruling already executed.\\\");\\n dispute.ruled = true;\\n disputesRuling[_disputeID] = _ruling;\\n\\n // Send the relayed ruling to the arbitrable while fully bypassing the dispute flow.\\n dispute.arbitrated.rule(_disputeID, _ruling);\\n\\n emit Ruling(dispute.arbitrated, _disputeID, _ruling);\\n }\\n\\n /* Public */\\n\\n /** @dev Creates a dispute. Must be called by the arbitrable contract.\\n * @param _numberOfChoices Number of choices to choose from in the dispute to be created.\\n * @param _extraData Additional info about the dispute to be created. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\\n * @return disputeID The ID of the created dispute.\\n */\\n function createDispute(\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) public payable override returns (uint256 disputeID) {\\n require(msg.value == 0, \\\"Fees should be paid in WETH\\\");\\n uint256 fee = arbitrationCost(_extraData);\\n require(weth.transferFrom(msg.sender, address(this), fee), \\\"Not enough WETH for arbitration\\\");\\n\\n disputeID = totalDisputes++;\\n Dispute storage dispute = disputes[disputeID];\\n dispute.arbitrated = IArbitrable(msg.sender);\\n\\n // The V2 subcourtID is off by one\\n (uint96 subcourtID, uint256 minJurors) = extraDataToSubcourtIDAndMinJurors(_extraData);\\n bytes memory extraDataV2 = abi.encode(uint256(subcourtID + 1), minJurors);\\n\\n require(weth.transfer(address(foreignGateway), fee), \\\"Fee transfer to gateway failed\\\");\\n foreignGateway.createDisputeERC20(_numberOfChoices, extraDataV2, fee);\\n\\n emit DisputeCreation(disputeID, IArbitrable(msg.sender));\\n }\\n\\n /** @dev DEPRECATED. Called when `_owner` sends ETH to the Wrapped Token contract.\\n * @param _owner The address that sent the ETH to create tokens.\\n * @return allowed Whether the operation should be allowed or not.\\n */\\n function proxyPayment(address _owner) public payable override returns (bool allowed) {\\n allowed = false;\\n }\\n\\n /** @dev Notifies the controller about a token transfer allowing the controller to react if desired.\\n * @param _from The origin of the transfer.\\n * @param _to The destination of the transfer.\\n * @param _amount The amount of the transfer.\\n * @return allowed Whether the operation should be allowed or not.\\n */\\n function onTransfer(address _from, address _to, uint256 _amount) public override returns (bool allowed) {\\n if (lockInsolventTransfers) {\\n // Never block penalties or rewards.\\n uint256 newBalance = pinakion.balanceOf(_from) - _amount;\\n if (newBalance < jurors[_from].stakedTokens || newBalance < jurors[_from].lockedTokens) return false;\\n }\\n allowed = true;\\n }\\n\\n /** @dev Notifies the controller about an approval allowing the controller to react if desired.\\n * @param _owner The address that calls `approve()`.\\n * @param _spender The spender in the `approve()` call.\\n * @param _amount The amount in the `approve()` call.\\n * @return allowed Whether the operation should be allowed or not.\\n */\\n function onApprove(address _owner, address _spender, uint256 _amount) public override returns (bool allowed) {\\n allowed = true;\\n }\\n\\n /* Public Views */\\n\\n /** @dev Gets the cost of arbitration in a specified subcourt.\\n * @param _extraData Additional info about the dispute. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).\\n * @return cost The cost.\\n */\\n function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) {\\n cost = foreignGateway.arbitrationCost(_extraData);\\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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n if (dispute.voteCounters.length == 0) {\\n ruling = disputesRuling[_disputeID];\\n } else {\\n ruling = dispute.voteCounters[dispute.voteCounters.length - 1].tied\\n ? 0\\n : dispute.voteCounters[dispute.voteCounters.length - 1].winningChoice;\\n }\\n }\\n\\n /* Internal */\\n\\n /** @dev Sets the specified juror's stake in a subcourt.\\n * `O(n + p * log_k(j))` where\\n * `n` is the number of subcourts the juror has staked in,\\n * `p` is the depth of the subcourt tree,\\n * `k` is the minimum number of children per node of one of these subcourts' sortition sum tree,\\n * and `j` is the maximum number of jurors that ever staked in one of these subcourts simultaneously.\\n * @param _account The address of the juror.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _stake The new stake.\\n * @return succeeded True if the call succeeded, false otherwise.\\n */\\n function _setStake(address _account, uint96 _subcourtID, uint128 _stake) internal returns (bool succeeded) {\\n if (!(_subcourtID < courts.length)) return false;\\n\\n if (!(_stake == 0 || courts[_subcourtID].minStake <= _stake)) return false; // The juror's stake cannot be lower than the minimum stake for the subcourt.\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n if (!(_stake == 0 || currentStake > 0 || juror.subcourtIDs.length < MAX_STAKE_PATHS)) return false; // Maximum stake paths reached.\\n uint256 newTotalStake = juror.stakedTokens - currentStake + _stake; // Can't overflow because _stake is a uint128.\\n if (!(_stake == 0 || pinakion.balanceOf(_account) >= newTotalStake)) return false; // The juror's total amount of staked tokens cannot be higher than the juror's balance.\\n\\n // Update juror's records.\\n juror.stakedTokens = newTotalStake;\\n if (_stake == 0) {\\n for (uint256 i = 0; i < juror.subcourtIDs.length; i++)\\n if (juror.subcourtIDs[i] == _subcourtID) {\\n juror.subcourtIDs[i] = juror.subcourtIDs[juror.subcourtIDs.length - 1];\\n juror.subcourtIDs.pop();\\n break;\\n }\\n } else if (currentStake == 0) juror.subcourtIDs.push(_subcourtID);\\n\\n // Update subcourt parents.\\n bool finished = false;\\n uint256 currentSubcourtID = _subcourtID;\\n while (!finished) {\\n sortitionSumTrees.set(bytes32(currentSubcourtID), _stake, stakePathID);\\n if (currentSubcourtID == 0) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n return true;\\n }\\n\\n /** @dev Gets a subcourt ID and the minimum number of jurors required from a specified extra data bytes array.\\n * @param _extraData The extra data bytes array. The first 32 bytes are the subcourt ID and the next 32 bytes are the minimum number of jurors.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n */\\n function extraDataToSubcourtIDAndMinJurors(\\n bytes memory _extraData\\n ) internal view returns (uint96 subcourtID, uint256 minJurors) {\\n if (_extraData.length >= 64) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n }\\n if (subcourtID >= courts.length) subcourtID = 0;\\n if (minJurors == 0) minJurors = MIN_JURORS;\\n } else {\\n subcourtID = 0;\\n minJurors = MIN_JURORS;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The account to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(\\n address _account,\\n uint96 _subcourtID\\n ) internal pure returns (bytes32 stakePathID) {\\n assembly {\\n // solium-disable-line security/no-inline-assembly\\n let ptr := mload(0x40)\\n for {\\n let i := 0x00\\n } lt(i, 0x14) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(add(0x0c, i), _account))\\n }\\n for {\\n let i := 0x14\\n } lt(i, 0x20) {\\n i := add(i, 0x01)\\n } {\\n mstore8(add(ptr, i), byte(i, _subcourtID))\\n }\\n stakePathID := mload(ptr)\\n }\\n }\\n\\n /* Interface Views */\\n\\n /** @dev Gets a specified subcourt's non primitive properties.\\n * @param _subcourtID The ID of the subcourt.\\n * @return children The subcourt's child court list.\\n * @return timesPerPeriod The subcourt's time per period.\\n */\\n function getSubcourt(\\n uint96 _subcourtID\\n ) external view returns (uint256[] memory children, uint256[4] memory timesPerPeriod) {\\n Court storage subcourt = courts[_subcourtID];\\n children = subcourt.children;\\n timesPerPeriod = subcourt.timesPerPeriod;\\n }\\n\\n /** @dev Gets a specified vote for a specified appeal in a specified dispute.\\n * @param _disputeID The ID of the dispute.\\n * @param _appeal The appeal.\\n * @param _voteID The ID of the vote.\\n * @return account The account for vote.\\n * @return commit The commit for vote.\\n * @return choice The choice for vote.\\n * @return voted True if the account voted, False otherwise.\\n */\\n function getVote(\\n uint256 _disputeID,\\n uint256 _appeal,\\n uint256 _voteID\\n ) external view returns (address account, bytes32 commit, uint256 choice, bool voted) {\\n Vote storage vote = disputes[_disputeID].votes[_appeal][_voteID];\\n account = vote.account;\\n commit = vote.commit;\\n choice = vote.choice;\\n voted = vote.voted;\\n }\\n\\n /** @dev Gets the vote counter for a specified appeal in a specified dispute.\\n * Note: This function is only to be used by the interface and it won't work if the number of choices is too high.\\n * @param _disputeID The ID of the dispute.\\n * @param _appeal The appeal.\\n * @return winningChoice The winning choice.\\n * @return counts The count.\\n * @return tied Whether the vote tied.\\n * `O(n)` where\\n * `n` is the number of choices of the dispute.\\n */\\n function getVoteCounter(\\n uint256 _disputeID,\\n uint256 _appeal\\n ) external view returns (uint256 winningChoice, uint256[] memory counts, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n VoteCounter storage voteCounter = dispute.voteCounters[_appeal];\\n winningChoice = voteCounter.winningChoice;\\n counts = new uint256[](dispute.numberOfChoices + 1);\\n for (uint256 i = 0; i <= dispute.numberOfChoices; i++) counts[i] = voteCounter.counts[i];\\n tied = voteCounter.tied;\\n }\\n\\n /** @dev Gets a specified dispute's non primitive properties.\\n * @param _disputeID The ID of the dispute.\\n * @return votesLengths The dispute's vote length.\\n * @return tokensAtStakePerJuror The dispute's required tokens at stake per Juror.\\n * @return totalFeesForJurors The dispute's total fees for Jurors.\\n * @return votesInEachRound The dispute's counter of votes made in each round.\\n * @return repartitionsInEachRound The dispute's counter of vote reward repartitions made in each round.\\n * @return penaltiesInEachRound The dispute's amount of tokens collected from penalties in each round.\\n * `O(a)` where\\n * `a` is the number of appeals of the dispute.\\n */\\n function getDispute(\\n uint256 _disputeID\\n )\\n external\\n view\\n returns (\\n uint256[] memory votesLengths,\\n uint256[] memory tokensAtStakePerJuror,\\n uint256[] memory totalFeesForJurors,\\n uint256[] memory votesInEachRound,\\n uint256[] memory repartitionsInEachRound,\\n uint256[] memory penaltiesInEachRound\\n )\\n {\\n Dispute storage dispute = disputes[_disputeID];\\n votesLengths = new uint256[](dispute.votes.length);\\n for (uint256 i = 0; i < dispute.votes.length; i++) votesLengths[i] = dispute.votes[i].length;\\n tokensAtStakePerJuror = dispute.tokensAtStakePerJuror;\\n totalFeesForJurors = dispute.totalFeesForJurors;\\n votesInEachRound = dispute.votesInEachRound;\\n repartitionsInEachRound = dispute.repartitionsInEachRound;\\n penaltiesInEachRound = dispute.penaltiesInEachRound;\\n }\\n\\n /** @dev Gets a specified juror's non primitive properties.\\n * @param _account The address of the juror.\\n * @return subcourtIDs The juror's IDs of subcourts where the juror has stake path.\\n */\\n function getJuror(address _account) external view returns (uint96[] memory subcourtIDs) {\\n Juror storage juror = jurors[_account];\\n subcourtIDs = juror.subcourtIDs;\\n }\\n\\n /** @dev Gets the stake of a specified juror in a specified subcourt.\\n * @param _account The address of the juror.\\n * @param _subcourtID The ID of the subcourt.\\n * @return stake The stake.\\n */\\n function stakeOf(address _account, uint96 _subcourtID) external view returns (uint256 stake) {\\n return\\n sortitionSumTrees.stakeOf(\\n bytes32(uint256(_subcourtID)),\\n accountAndSubcourtIDToStakePathID(_account, _subcourtID)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x3dcdb8741f6ef181e21ecfe20c91af0eba52f300d4f3b534b6ae9e2210e33138\",\"license\":\"MIT\"},\"src/libraries/SortitionSumTreeFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@epiqueras, @unknownunknown1]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title SortitionSumTreeFactory\\n * @author Enrique Piqueras - \\n * @dev A factory of trees that keep track of staked values for sortition.\\n */\\nlibrary SortitionSumTreeFactory {\\n /* Structs */\\n\\n struct SortitionSumTree {\\n uint K; // The maximum number of childs per node.\\n // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around.\\n uint[] stack;\\n uint[] nodes;\\n // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.\\n mapping(bytes32 => uint) IDsToNodeIndexes;\\n mapping(uint => bytes32) nodeIndexesToIDs;\\n }\\n\\n /* Storage */\\n\\n struct SortitionSumTrees {\\n mapping(bytes32 => SortitionSumTree) sortitionSumTrees;\\n }\\n\\n /* Public */\\n\\n /**\\n * @dev Create a sortition sum tree at the specified key.\\n * @param _key The key of the new tree.\\n * @param _K The number of children each node in the tree should have.\\n */\\n function createTree(SortitionSumTrees storage self, bytes32 _key, uint _K) public {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n require(tree.K == 0, \\\"Tree already exists.\\\");\\n require(_K > 1, \\\"K must be greater than one.\\\");\\n tree.K = _K;\\n tree.nodes.push(0);\\n }\\n\\n /**\\n * @dev Set a value of a tree.\\n * @param _key The key of the tree.\\n * @param _value The new value.\\n * @param _ID The ID of the value.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function set(SortitionSumTrees storage self, bytes32 _key, uint _value, bytes32 _ID) public {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) {\\n // No existing node.\\n if (_value != 0) {\\n // Non zero value.\\n // Append.\\n // Add node.\\n if (tree.stack.length == 0) {\\n // No vacant spots.\\n // Get the index and append the value.\\n treeIndex = tree.nodes.length;\\n tree.nodes.push(_value);\\n\\n // Potentially append a new node and make the parent a sum node.\\n if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) {\\n // Is first child.\\n uint parentIndex = treeIndex / tree.K;\\n bytes32 parentID = tree.nodeIndexesToIDs[parentIndex];\\n uint newIndex = treeIndex + 1;\\n tree.nodes.push(tree.nodes[parentIndex]);\\n delete tree.nodeIndexesToIDs[parentIndex];\\n tree.IDsToNodeIndexes[parentID] = newIndex;\\n tree.nodeIndexesToIDs[newIndex] = parentID;\\n }\\n } else {\\n // Some vacant spot.\\n // Pop the stack and append the value.\\n treeIndex = tree.stack[tree.stack.length - 1];\\n tree.stack.pop();\\n tree.nodes[treeIndex] = _value;\\n }\\n\\n // Add label.\\n tree.IDsToNodeIndexes[_ID] = treeIndex;\\n tree.nodeIndexesToIDs[treeIndex] = _ID;\\n\\n updateParents(self, _key, treeIndex, true, _value);\\n }\\n } else {\\n // Existing node.\\n if (_value == 0) {\\n // Zero value.\\n // Remove.\\n // Remember value and set to 0.\\n uint value = tree.nodes[treeIndex];\\n tree.nodes[treeIndex] = 0;\\n\\n // Push to stack.\\n tree.stack.push(treeIndex);\\n\\n // Clear label.\\n delete tree.IDsToNodeIndexes[_ID];\\n delete tree.nodeIndexesToIDs[treeIndex];\\n\\n updateParents(self, _key, treeIndex, false, value);\\n } else if (_value != tree.nodes[treeIndex]) {\\n // New, non zero value.\\n // Set.\\n bool plusOrMinus = tree.nodes[treeIndex] <= _value;\\n uint plusOrMinusValue = plusOrMinus ? _value - tree.nodes[treeIndex] : tree.nodes[treeIndex] - _value;\\n tree.nodes[treeIndex] = _value;\\n\\n updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue);\\n }\\n }\\n }\\n\\n /* Public Views */\\n\\n /**\\n * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned.\\n * @param _key The key of the tree to get the leaves from.\\n * @param _cursor The pagination cursor.\\n * @param _count The number of items to return.\\n * @return startIndex The index at which leaves start.\\n * @return values The values of the returned leaves.\\n * @return hasMore Whether there are more for pagination.\\n * `O(n)` where\\n * `n` is the maximum number of nodes ever appended.\\n */\\n function queryLeafs(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint _cursor,\\n uint _count\\n ) public view returns (uint startIndex, uint[] memory values, bool hasMore) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n // Find the start index.\\n for (uint i = 0; i < tree.nodes.length; i++) {\\n if ((tree.K * i) + 1 >= tree.nodes.length) {\\n startIndex = i;\\n break;\\n }\\n }\\n\\n // Get the values.\\n uint loopStartIndex = startIndex + _cursor;\\n values = new uint[](loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count);\\n uint valuesIndex = 0;\\n for (uint j = loopStartIndex; j < tree.nodes.length; j++) {\\n if (valuesIndex < _count) {\\n values[valuesIndex] = tree.nodes[j];\\n valuesIndex++;\\n } else {\\n hasMore = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @dev Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0.\\n * @param _key The key of the tree.\\n * @param _drawnNumber The drawn number.\\n * @return ID The drawn ID.\\n * `O(k * log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) public view returns (bytes32 ID) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = 0;\\n uint currentDrawnNumber = _drawnNumber % tree.nodes[0];\\n\\n while (\\n (tree.K * treeIndex) + 1 < tree.nodes.length // While it still has children.\\n )\\n for (uint i = 1; i <= tree.K; i++) {\\n // Loop over children.\\n uint nodeIndex = (tree.K * treeIndex) + i;\\n uint nodeValue = tree.nodes[nodeIndex];\\n\\n if (currentDrawnNumber >= nodeValue)\\n currentDrawnNumber -= nodeValue; // Go to the next child.\\n else {\\n // Pick this child.\\n treeIndex = nodeIndex;\\n break;\\n }\\n }\\n\\n ID = tree.nodeIndexesToIDs[treeIndex];\\n }\\n\\n /** @dev Gets a specified ID's associated value.\\n * @param _key The key of the tree.\\n * @param _ID The ID of the value.\\n * @return value The associated value.\\n */\\n function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) public view returns (uint value) {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n uint treeIndex = tree.IDsToNodeIndexes[_ID];\\n\\n if (treeIndex == 0) value = 0;\\n else value = tree.nodes[treeIndex];\\n }\\n\\n /* Private */\\n\\n /**\\n * @dev Update all the parents of a node.\\n * @param _key The key of the tree to update.\\n * @param _treeIndex The index of the node to start from.\\n * @param _plusOrMinus Wether to add (true) or substract (false).\\n * @param _value The value to add or substract.\\n * `O(log_k(n))` where\\n * `k` is the maximum number of childs per node in the tree,\\n * and `n` is the maximum number of nodes ever appended.\\n */\\n function updateParents(\\n SortitionSumTrees storage self,\\n bytes32 _key,\\n uint _treeIndex,\\n bool _plusOrMinus,\\n uint _value\\n ) private {\\n SortitionSumTree storage tree = self.sortitionSumTrees[_key];\\n\\n uint parentIndex = _treeIndex;\\n while (parentIndex != 0) {\\n parentIndex = (parentIndex - 1) / tree.K;\\n tree.nodes[parentIndex] = _plusOrMinus\\n ? tree.nodes[parentIndex] + _value\\n : tree.nodes[parentIndex] - _value;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x053af9495cb8382dfc1e1503d8f3dab3d356d664efdbdf534f146ab8f3834e95\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50613656806100206000396000f3fe6080604052600436106102df5760003560e01c80638ce7ff4a11610186578063c5e4ccc4116100d7578063e3b0073e11610085578063e3b0073e14610a4c578063e4c0aaf414610a7b578063eaff425a14610a9b578063f48c305414610ab0578063f66d685a14610ac4578063f7434ea914610ade578063fbf405b014610afe57600080fd5b8063c5e4ccc414610927578063ce9e77301461093d578063d4155d1f1461095d578063da682aeb1461098a578063dca5f6b0146109ae578063dd5e5cb5146109fa578063e3a96cbd14610a1a57600080fd5b8063b1c9fe6e11610134578063b1c9fe6e14610800578063b4a616081461082e578063b78a80ff14610843578063b888adfa146108d2578063c057eca7146108e8578063c108f3b4146108fe578063c13517e11461091457600080fd5b80638ce7ff4a146106f45780638d7c7daa1461074057806396d92a72146107605780639929057b146107805780639e72c153146107a0578063a2473cc1146107c0578063a57366e7146107e057600080fd5b806340026c87116102405780635e4a627d116101ee5780635e4a627d146106235780636a4f8f3914610639578063751accd0146106595780637a5de2a914610679578063823cfd7014610699578063840bc19c146106b957806385c855f3146106d457600080fd5b806340026c87146104be57806348b4e924146104ec5780634a3931491461050c578063564a565d1461053c57806357260364146105c357806359354c77146105e35780635bc24dd31461060357600080fd5b80631b92bbbe1161029d5780631b92bbbe146103bb5780631c3db16d146103d15780631f5a0dd2146103f15780632ea7b4d014610448578063311a6c561461045e5780633e1d09be1461047e5780633fc8cef31461049e57600080fd5b8062f5822c146102e4578063023d44df14610306578063034327441461032f57806303438616146103455780630c340a24146103725780630d44cf79146103a5575b600080fd5b3480156102f057600080fd5b506103046102ff366004612d61565b610b1e565b005b34801561031257600080fd5b5061031c60055481565b6040519081526020015b60405180910390f35b34801561033b57600080fd5b5061031c60045481565b34801561035157600080fd5b5061031c610360366004612d7e565b60146020526000908152604090205481565b34801561037e57600080fd5b50600054610398906201000090046001600160a01b031681565b6040516103269190612d97565b3480156103b157600080fd5b5061031c600e5481565b3480156103c757600080fd5b5061031c60085481565b3480156103dd57600080fd5b5061031c6103ec366004612d7e565b610b5d565b3480156103fd57600080fd5b5061041161040c366004612d7e565b610c0c565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c001610326565b34801561045457600080fd5b5061031c61271081565b34801561046a57600080fd5b50610304610479366004612dab565b610c60565b34801561048a57600080fd5b50610304610499366004612de9565b610e49565b3480156104aa57600080fd5b50601354610398906001600160a01b031681565b3480156104ca57600080fd5b506104de6104d9366004612e13565b611057565b604051610326929190612e69565b3480156104f857600080fd5b50610304610507366004612f40565b61111d565b34801561051857600080fd5b5061052c610527366004613008565b611497565b6040519015158152602001610326565b34801561054857600080fd5b506105af610557366004612d7e565b600f602052600090815260409020805460018201546002830154600384015460088501546009860154600d909601546001600160601b03861696600160601b9096046001600160a01b03169560ff9485169490911688565b60405161032698979695949392919061305f565b3480156105cf57600080fd5b506103046105de3660046130c2565b611596565b3480156105ef57600080fd5b506103046105fe366004612de9565b6115f4565b34801561060f57600080fd5b5061030461061e366004612de9565b611647565b34801561062f57600080fd5b5061031c60065481565b34801561064557600080fd5b50600254610398906001600160a01b031681565b34801561066557600080fd5b50610304610674366004613182565b61169a565b34801561068557600080fd5b50610304610694366004612d61565b61175f565b3480156106a557600080fd5b506103046106b4366004612d7e565b61179e565b3480156106c557600080fd5b5061031c6001600160ff1b0381565b3480156106e057600080fd5b506103046106ef3660046131da565b6117c0565b34801561070057600080fd5b5061071461070f36600461321d565b6117d8565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610326565b34801561074c57600080fd5b50601254610398906001600160a01b031681565b34801561076c57600080fd5b5061030461077b366004612d61565b611863565b34801561078c57600080fd5b5061030461079b366004612d7e565b6119de565b3480156107ac57600080fd5b506103046107bb366004612d61565b611b00565b3480156107cc57600080fd5b5061031c6107db366004613249565b611b3f565b3480156107ec57600080fd5b506103046107fb366004612de9565b611bed565b34801561080c57600080fd5b5060025461082190600160a01b900460ff1681565b6040516103269190613275565b34801561083a57600080fd5b5061031c600481565b34801561084f57600080fd5b5061089c61085e366004612d7e565b600c60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b0316906001600160801b031683565b604080516001600160a01b0390941684526001600160601b0390921660208401526001600160801b031690820152606001610326565b3480156108de57600080fd5b5061031c60035481565b3480156108f457600080fd5b5061031c60075481565b34801561090a57600080fd5b5061031c600d5481565b61031c61092236600461328f565b611c40565b34801561093357600080fd5b5061031c60105481565b34801561094957600080fd5b506103046109583660046132d5565b611f88565b34801561096957600080fd5b5061097d610978366004612d61565b6121e4565b604051610326919061334d565b34801561099657600080fd5b5061052c6109a5366004613008565b50600192915050565b3480156109ba57600080fd5b506109e56109c9366004612d61565b6011602052600090815260409020600181015460029091015482565b60408051928352602083019190915201610326565b348015610a0657600080fd5b50610304610a15366004612d7e565b612287565b348015610a2657600080fd5b50610a3a610a35366004612d7e565b6122a9565b6040516103269695949392919061339a565b348015610a5857600080fd5b50610a6c610a67366004612dab565b612521565b6040516103269392919061341c565b348015610a8757600080fd5b50610304610a96366004612d61565b612620565b348015610aa757600080fd5b5061031c600381565b61052c610abe366004612d61565b50600090565b348015610ad057600080fd5b5060095461052c9060ff1681565b348015610aea57600080fd5b5061031c610af9366004613447565b612667565b348015610b0a57600080fd5b50600154610398906001600160a01b031681565b6000546201000090046001600160a01b03163314610b3b57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600f602052604081206005810154610b8a576000838152601460205260409020549150610c06565b600581018054610b9c90600190613499565b81548110610bac57610bac6134b0565b600091825260209091206002600390920201015460ff16610c0057600581018054610bd990600190613499565b81548110610be957610be96134b0565b906000526020600020906003020160000154610c03565b60005b91505b50919050565b600a8181548110610c1c57600080fd5b60009182526020909120600b90910201805460028201546003830154600484015460058501546006909501546001600160601b03909416955060ff90921693909286565b6010548210610cb65760405162461bcd60e51b815260206004820152601a60248201527f4469737075746520494420646f6573206e6f742065786973742e00000000000060448201526064015b60405180910390fd5b6012546001600160a01b03163314610d105760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920676174657761790000006044820152606401610cad565b6000828152600f60205260409020600d81015460ff1615610d6e5760405162461bcd60e51b8152602060048201526018602482015277293ab634b7339030b63932b0b23c9032bc32b1baba32b21760411b6044820152606401610cad565b600d81018054600160ff19909116179055600083815260146020526040908190208390558154905163188d362b60e11b81526004810185905260248101849052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b158015610de357600080fd5b505af1158015610df7573d6000803e3d6000fd5b50508254604051858152869350600160601b9091046001600160a01b031691507f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3505050565b6000546201000090046001600160a01b03163314610e6657600080fd5b6001600160601b0382161580610ed7575080600a80846001600160601b031681548110610e9557610e956134b0565b60009182526020909120600b909102015481546001600160601b03909116908110610ec257610ec26134b0565b90600052602060002090600b02016003015411155b610ee057600080fd5b60005b600a836001600160601b031681548110610eff57610eff6134b0565b90600052602060002090600b0201600101805490508110156110205781600a80856001600160601b031681548110610f3957610f396134b0565b90600052602060002090600b02016001018381548110610f5b57610f5b6134b0565b906000526020600020015481548110610f7657610f766134b0565b90600052602060002090600b020160030154101561100e5760405162461bcd60e51b815260206004820152604960248201527f4120737562636f7572742063616e6e6f742062652074686520706172656e742060448201527f6f66206120737562636f75727420776974682061206c6f776572206d696e696d6064820152683ab69039ba30b5b29760b91b608482015260a401610cad565b80611018816134c6565b915050610ee3565b5080600a836001600160601b03168154811061103e5761103e6134b0565b90600052602060002090600b0201600301819055505050565b6060611061612ca1565b6000600a846001600160601b03168154811061107f5761107f6134b0565b90600052602060002090600b02019050806001018054806020026020016040519081016040528092919081815260200182805480156110dd57602002820191906000526020600020905b8154815260200190600101908083116110c9575b505060408051608081019182905294975060078601935060049250905082845b8154815260200190600101908083116110fd575050505050915050915091565b600054610100900460ff161580801561113d5750600054600160ff909116105b806111575750303b158015611157575060005460ff166001145b6111ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610cad565b6000805460ff1916600117905580156111dd576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b038f81169190910291909117909155600180546001600160a01b0319168d83161781556002805460078d905560088c90556001600160a81b031916928d1692909217909155426003556009805460ff19169091179055600d5461125b576001600d555b601280546001600160a01b038086166001600160a01b0319928316179092556013805492851692909116919091179055600a5461144357604080516101008101825260008082528251818152602080820185528084019182528b1515848601528a516060808601919091528b8201516080860152948b015160a0850152938a015160c084015260e08301899052600a8054600181018255925282517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600b90930292830180546001600160601b0319166001600160601b039092169190911781559051805193949193611375937fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a901929190910190612cbf565b50604082015160028201805460ff191691151591909117905560608201516003820155608082015160048083019190915560a0830151600583015560c0830151600683015560e08301516113ce91600784019190612d0a565b505060405163483abc4f60e11b8152600b6004820152600060248201526044810186905273c7e3BF90299f6BD9FA7c3703837A9CAbB57436369150639075789e9060640160006040518083038186803b15801561142a57600080fd5b505af415801561143e573d6000803e3d6000fd5b505050505b8015611489576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b60095460009060ff161561158b576001546040516370a0823160e01b815260009184916001600160a01b03909116906370a08231906114da908990600401612d97565b60206040518083038186803b1580156114f257600080fd5b505afa158015611506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152a91906134e1565b6115349190613499565b6001600160a01b03861660009081526011602052604090206001015490915081108061157a57506001600160a01b03851660009081526011602052604090206002015481105b1561158957600091505061158f565b505b5060015b9392505050565b6000546201000090046001600160a01b031633146115b357600080fd5b80600a836001600160601b0316815481106115d0576115d06134b0565b90600052602060002090600b02016007019060046115ef929190612d0a565b505050565b6000546201000090046001600160a01b0316331461161157600080fd5b80600a836001600160601b03168154811061162e5761162e6134b0565b90600052602060002090600b0201600501819055505050565b6000546201000090046001600160a01b0316331461166457600080fd5b80600a836001600160601b031681548110611681576116816134b0565b90600052602060002090600b0201600401819055505050565b6000546201000090046001600160a01b031633146116b757600080fd5b6000836001600160a01b031683836040516116d29190613526565b60006040518083038185875af1925050503d806000811461170f576040519150601f19603f3d011682016040523d82523d6000602084013e611714565b606091505b50509050806117595760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cad565b50505050565b6000546201000090046001600160a01b0316331461177c57600080fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546201000090046001600160a01b031633146117bb57600080fd5b600755565b6117cb3383836126ee565b6117d457600080fd5b5050565b6000806000806000600f60008981526020019081526020016000206004018781548110611807576118076134b0565b906000526020600020018681548110611822576118226134b0565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169b909a5091985060ff169650945050505050565b6000546201000090046001600160a01b0316331461188057600080fd5b600280546001600160a01b0319166001600160a01b038316179055600160028054600160a01b900460ff16908111156118bb576118bb613049565b14156119db57600260009054906101000a90046001600160a01b03166001600160a01b0316631c77c58c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561190f57600080fd5b505afa158015611923573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194791906134e1565b600260009054906101000a90046001600160a01b03166001600160a01b03166378ab865d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd91906134e1565b6119d79190613542565b6005555b50565b60008060028054600160a01b900460ff16908111156119ff576119ff613049565b14611a0957600080fd5b6000600e54600184600d54611a1e9190613542565b611a289190613499565b11611a335782611a4e565b600d54600e54611a439190613499565b611a4e906001613542565b9050600081600d54611a609190613542565b9050600d54811015611a7157600080fd5b600d545b81811015611af7576000818152600c6020526040902080546001820154611ac1916001600160a01b03811691600160a01b9091046001600160601b0316906001600160801b03166126ee565b50506000818152600c6020526040812090815560010180546001600160801b031916905580611aef816134c6565b915050611a75565b50600d55505050565b6000546201000090046001600160a01b03163314611b1d57600080fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b600073c7e3BF90299f6BD9FA7c3703837A9CAbB5743636637521ccb1600b6001600160601b038516611b718787612c10565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b158015611bb557600080fd5b505af4158015611bc9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f91906134e1565b6000546201000090046001600160a01b03163314611c0a57600080fd5b80600a836001600160601b031681548110611c2757611c276134b0565b90600052602060002090600b0201600601819055505050565b60003415611c905760405162461bcd60e51b815260206004820152601b60248201527f466565732073686f756c64206265207061696420696e205745544800000000006044820152606401610cad565b6000611c9b83612667565b6013546040516323b872dd60e01b8152336004820152306024820152604481018390529192506001600160a01b0316906323b872dd90606401602060405180830381600087803b158015611cee57600080fd5b505af1158015611d02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d26919061355a565b611d725760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f756768205745544820666f72206172626974726174696f6e006044820152606401610cad565b60108054906000611d82836134c6565b909155506000818152600f6020526040812080546001600160601b031633600160601b0217815591935080611db686612c58565b90925090506000611dc8836001613577565b604080516001600160601b03929092166020830152810183905260600160408051808303601f190181529082905260135460125463a9059cbb60e01b84526001600160a01b03908116600485015260248401899052919350169063a9059cbb90604401602060405180830381600087803b158015611e4557600080fd5b505af1158015611e59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7d919061355a565b611ec95760405162461bcd60e51b815260206004820152601e60248201527f466565207472616e7366657220746f2067617465776179206661696c656400006044820152606401610cad565b60125460405163979f8e6560e01b81526001600160a01b039091169063979f8e6590611efd908b9085908a906004016135ce565b602060405180830381600087803b158015611f1757600080fd5b505af1158015611f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4f91906134e1565b50604051339087907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a3505050505092915050565b6000546201000090046001600160a01b03163314611fa557600080fd5b85600a896001600160601b031681548110611fc257611fc26134b0565b90600052602060002090600b02016003015411156120585760405162461bcd60e51b815260206004820152604760248201527f4120737562636f7572742063616e6e6f742062652061206368696c64206f662060448201527f6120737562636f7572742077697468206120686967686572206d696e696d756d6064820152661039ba30b5b29760c91b608482015260a401610cad565b600a805460018101825560009182527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600b82020180546001600160601b0319166001600160601b038c1617815590916040519080825280602002602001820160405280156120d1578160200160208202803683370190505b5080516120e8916001840191602090910190612cbf565b5060028101805460ff19168a151517905560038101889055600480820188905560058201879055600682018690556121269060078301908690612d0a565b5060405163483abc4f60e11b8152600b6004820152602481018390526044810184905273c7e3BF90299f6BD9FA7c3703837A9CAbB574363690639075789e9060640160006040518083038186803b15801561218057600080fd5b505af4158015612194573d6000803e3d6000fd5b50505050600a8a6001600160601b0316815481106121b4576121b46134b0565b600091825260208083206001600b9093020182018054928301815583529091200191909155505050505050505050565b6001600160a01b0381166000908152601160209081526040918290208054835181840281018401909452808452606093919283919083018282801561227a57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b010492830192600103820291508084116122375790505b5050505050915050919050565b6000546201000090046001600160a01b031633146122a457600080fd5b600855565b6000818152600f602052604090206004810154606091829182918291829182916001600160401b038111156122e0576122e0612ebd565b604051908082528060200260200182016040528015612309578160200160208202803683370190505b50965060005b600482015481101561236d57816004018181548110612330576123306134b0565b9060005260206000200180549050888281518110612350576123506134b0565b602090810291909101015280612365816134c6565b91505061230f565b50806006018054806020026020016040519081016040528092919081815260200182805480156123bc57602002820191906000526020600020905b8154815260200190600101908083116123a8575b505050505095508060070180548060200260200160405190810160405280929190818152602001828054801561241157602002820191906000526020600020905b8154815260200190600101908083116123fd575b5050505050945080600a0180548060200260200160405190810160405280929190818152602001828054801561246657602002820191906000526020600020905b815481526020019060010190808311612452575b5050505050935080600b018054806020026020016040519081016040528092919081815260200182805480156124bb57602002820191906000526020600020905b8154815260200190600101908083116124a7575b5050505050925080600c0180548060200260200160405190810160405280929190818152602001828054801561251057602002820191906000526020600020905b8154815260200190600101908083116124fc575b505050505091505091939550919395565b6000828152600f60205260408120600581018054606092849290918391908790811061254f5761254f6134b0565b9060005260206000209060030201905080600001549450816001015460016125779190613542565b6001600160401b0381111561258e5761258e612ebd565b6040519080825280602002602001820160405280156125b7578160200160208202803683370190505b50935060005b8260010154811161260a57600081815260018301602052604090205485518690839081106125ed576125ed6134b0565b602090810291909101015280612602816134c6565b9150506125bd565b506002015493969295505060ff90921692509050565b6000546201000090046001600160a01b0316331461263d57600080fd5b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60125460405163f7434ea960e01b81526000916001600160a01b03169063f7434ea9906126989085906004016135f7565b60206040518083038186803b1580156126b057600080fd5b505afa1580156126c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e891906134e1565b92915050565b600a546000906001600160601b0384161061270b5750600061158f565b6001600160801b03821615806127575750816001600160801b0316600a846001600160601b031681548110612742576127426134b0565b90600052602060002090600b02016003015411155b6127635750600061158f565b6001600160a01b0384166000908152601160205260408120906127868686612c10565b604051637521ccb160e01b8152600b60048201526001600160601b03871660248201526044810182905290915060009073c7e3BF90299f6BD9FA7c3703837A9CAbB574363690637521ccb19060640160206040518083038186803b1580156127ed57600080fd5b505af4158015612801573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282591906134e1565b90506001600160801b038516158061283d5750600081115b80612849575082546004115b612859576000935050505061158f565b6000856001600160801b03168285600101546128759190613499565b61287f9190613542565b90506001600160801b038616158061291557506001546040516370a0823160e01b815282916001600160a01b0316906370a08231906128c2908c90600401612d97565b60206040518083038186803b1580156128da57600080fd5b505afa1580156128ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291291906134e1565b10155b61292657600094505050505061158f565b600184018190556001600160801b038616612a8b5760005b8454811015612a8557876001600160601b0316856000018281548110612966576129666134b0565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415612a7357845485906129a390600190613499565b815481106129b3576129b36134b0565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b03168560000182815481106129f1576129f16134b0565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480612a3d57612a3d61360a565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055612a85565b80612a7d816134c6565b91505061293e565b50612acb565b81612acb578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918a16021790555b60006001600160601b0388165b81612ba357604051631712e1c560e11b8152600b6004820152602481018290526001600160801b03891660448201526064810186905273c7e3BF90299f6BD9FA7c3703837A9CAbB574363690632e25c38a9060840160006040518083038186803b158015612b4557600080fd5b505af4158015612b59573d6000803e3d6000fd5b505050508060001415612b6f5760019150612ad8565b600a8181548110612b8257612b826134b0565b60009182526020909120600b90910201546001600160601b03169050612ad8565b604080516001600160601b038b1681526001600160801b038a1660208201529081018490526001600160a01b038b16907f8f753321c98641397daaca5e8abf8881fff1fd7a7bc229924a012e2cb61763d59060600160405180910390a25060019998505050505050505050565b600060405160005b6014811015612c33578481600c011a81830153600101612c18565b5060145b6020811015612c4f5783811a81830153600101612c37565b50519392505050565b6000806040835110612c9557505060208101516040820151600a546001600160601b03831610612c8757600091505b80612c90575060035b915091565b50600090506003915091565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215612cfa579160200282015b82811115612cfa578251825591602001919060010190612cdf565b50612d06929150612d37565b5090565b8260048101928215612cfa5791602002820182811115612cfa578251825591602001919060010190612cdf565b5b80821115612d065760008155600101612d38565b6001600160a01b03811681146119db57600080fd5b600060208284031215612d7357600080fd5b813561158f81612d4c565b600060208284031215612d9057600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215612dbe57600080fd5b50508035926020909101359150565b80356001600160601b0381168114612de457600080fd5b919050565b60008060408385031215612dfc57600080fd5b612e0583612dcd565b946020939093013593505050565b600060208284031215612e2557600080fd5b61158f82612dcd565b600081518084526020808501945080840160005b83811015612e5e57815187529582019590820190600101612e42565b509495945050505050565b60a081526000612e7c60a0830185612e2e565b905060208083018460005b6004811015612ea457815183529183019190830190600101612e87565b505050509392505050565b80151581146119db57600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612ee457600080fd5b604051608081018181106001600160401b0382111715612f0657612f06612ebd565b604052806080840185811115612f1b57600080fd5b845b81811015612f35578035835260209283019201612f1d565b509195945050505050565b60008060008060008060008060008060006102208c8e031215612f6257600080fd5b8b35612f6d81612d4c565b9a5060208c0135612f7d81612d4c565b995060408c0135612f8d81612d4c565b985060608c0135975060808c0135965060a08c0135612fab81612eaf565b9550612fba8d60c08e01612ed3565b9450612fca8d6101408e01612ed3565b93506101c08c013592506101e08c0135612fe381612d4c565b91506102008c0135612ff481612d4c565b809150509295989b509295989b9093969950565b60008060006060848603121561301d57600080fd5b833561302881612d4c565b9250602084013561303881612d4c565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b6001600160601b03891681526001600160a01b03881660208201526040810187905261010081016005871061309657613096613049565b6060820196909652608081019490945260a084019290925260c0830152151560e0909101529392505050565b60008060a083850312156130d557600080fd5b6130de83612dcd565b91506130ed8460208501612ed3565b90509250929050565b600082601f83011261310757600080fd5b81356001600160401b038082111561312157613121612ebd565b604051601f8301601f19908116603f0116810190828211818310171561314957613149612ebd565b8160405283815286602085880101111561316257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561319757600080fd5b83356131a281612d4c565b92506020840135915060408401356001600160401b038111156131c457600080fd5b6131d0868287016130f6565b9150509250925092565b600080604083850312156131ed57600080fd5b6131f683612dcd565b915060208301356001600160801b038116811461321257600080fd5b809150509250929050565b60008060006060848603121561323257600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561325c57600080fd5b823561326781612d4c565b91506130ed60208401612dcd565b602081016003831061328957613289613049565b91905290565b600080604083850312156132a257600080fd5b8235915060208301356001600160401b038111156132bf57600080fd5b6132cb858286016130f6565b9150509250929050565b600080600080600080600080610160898b0312156132f257600080fd5b6132fb89612dcd565b9750602089013561330b81612eaf565b965060408901359550606089013594506080890135935060a089013592506133368a60c08b01612ed3565b915061014089013590509295985092959890939650565b6020808252825182820181905260009190848201906040850190845b8181101561338e5783516001600160601b031683529284019291840191600101613369565b50909695505050505050565b60c0815260006133ad60c0830189612e2e565b82810360208401526133bf8189612e2e565b905082810360408401526133d38188612e2e565b905082810360608401526133e78187612e2e565b905082810360808401526133fb8186612e2e565b905082810360a084015261340f8185612e2e565b9998505050505050505050565b8381526060602082015260006134356060830185612e2e565b90508215156040830152949350505050565b60006020828403121561345957600080fd5b81356001600160401b0381111561346f57600080fd5b61347b848285016130f6565b949350505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156134ab576134ab613483565b500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156134da576134da613483565b5060010190565b6000602082840312156134f357600080fd5b5051919050565b60005b838110156135155781810151838201526020016134fd565b838111156117595750506000910152565b600082516135388184602087016134fa565b9190910192915050565b6000821982111561355557613555613483565b500190565b60006020828403121561356c57600080fd5b815161158f81612eaf565b60006001600160601b0380831681851680830382111561359957613599613483565b01949350505050565b600081518084526135ba8160208601602086016134fa565b601f01601f19169290920160200192915050565b8381526060602082015260006135e760608301856135a2565b9050826040830152949350505050565b60208152600061158f60208301846135a2565b634e487b7160e01b600052603160045260246000fdfea26469706673582212208c24f0dc5c862abcfbeb5d7abaf80f855b2bfba8e446fb9c2aa2b7b83edd554e64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106102df5760003560e01c80638ce7ff4a11610186578063c5e4ccc4116100d7578063e3b0073e11610085578063e3b0073e14610a4c578063e4c0aaf414610a7b578063eaff425a14610a9b578063f48c305414610ab0578063f66d685a14610ac4578063f7434ea914610ade578063fbf405b014610afe57600080fd5b8063c5e4ccc414610927578063ce9e77301461093d578063d4155d1f1461095d578063da682aeb1461098a578063dca5f6b0146109ae578063dd5e5cb5146109fa578063e3a96cbd14610a1a57600080fd5b8063b1c9fe6e11610134578063b1c9fe6e14610800578063b4a616081461082e578063b78a80ff14610843578063b888adfa146108d2578063c057eca7146108e8578063c108f3b4146108fe578063c13517e11461091457600080fd5b80638ce7ff4a146106f45780638d7c7daa1461074057806396d92a72146107605780639929057b146107805780639e72c153146107a0578063a2473cc1146107c0578063a57366e7146107e057600080fd5b806340026c87116102405780635e4a627d116101ee5780635e4a627d146106235780636a4f8f3914610639578063751accd0146106595780637a5de2a914610679578063823cfd7014610699578063840bc19c146106b957806385c855f3146106d457600080fd5b806340026c87146104be57806348b4e924146104ec5780634a3931491461050c578063564a565d1461053c57806357260364146105c357806359354c77146105e35780635bc24dd31461060357600080fd5b80631b92bbbe1161029d5780631b92bbbe146103bb5780631c3db16d146103d15780631f5a0dd2146103f15780632ea7b4d014610448578063311a6c561461045e5780633e1d09be1461047e5780633fc8cef31461049e57600080fd5b8062f5822c146102e4578063023d44df14610306578063034327441461032f57806303438616146103455780630c340a24146103725780630d44cf79146103a5575b600080fd5b3480156102f057600080fd5b506103046102ff366004612d61565b610b1e565b005b34801561031257600080fd5b5061031c60055481565b6040519081526020015b60405180910390f35b34801561033b57600080fd5b5061031c60045481565b34801561035157600080fd5b5061031c610360366004612d7e565b60146020526000908152604090205481565b34801561037e57600080fd5b50600054610398906201000090046001600160a01b031681565b6040516103269190612d97565b3480156103b157600080fd5b5061031c600e5481565b3480156103c757600080fd5b5061031c60085481565b3480156103dd57600080fd5b5061031c6103ec366004612d7e565b610b5d565b3480156103fd57600080fd5b5061041161040c366004612d7e565b610c0c565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c001610326565b34801561045457600080fd5b5061031c61271081565b34801561046a57600080fd5b50610304610479366004612dab565b610c60565b34801561048a57600080fd5b50610304610499366004612de9565b610e49565b3480156104aa57600080fd5b50601354610398906001600160a01b031681565b3480156104ca57600080fd5b506104de6104d9366004612e13565b611057565b604051610326929190612e69565b3480156104f857600080fd5b50610304610507366004612f40565b61111d565b34801561051857600080fd5b5061052c610527366004613008565b611497565b6040519015158152602001610326565b34801561054857600080fd5b506105af610557366004612d7e565b600f602052600090815260409020805460018201546002830154600384015460088501546009860154600d909601546001600160601b03861696600160601b9096046001600160a01b03169560ff9485169490911688565b60405161032698979695949392919061305f565b3480156105cf57600080fd5b506103046105de3660046130c2565b611596565b3480156105ef57600080fd5b506103046105fe366004612de9565b6115f4565b34801561060f57600080fd5b5061030461061e366004612de9565b611647565b34801561062f57600080fd5b5061031c60065481565b34801561064557600080fd5b50600254610398906001600160a01b031681565b34801561066557600080fd5b50610304610674366004613182565b61169a565b34801561068557600080fd5b50610304610694366004612d61565b61175f565b3480156106a557600080fd5b506103046106b4366004612d7e565b61179e565b3480156106c557600080fd5b5061031c6001600160ff1b0381565b3480156106e057600080fd5b506103046106ef3660046131da565b6117c0565b34801561070057600080fd5b5061071461070f36600461321d565b6117d8565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610326565b34801561074c57600080fd5b50601254610398906001600160a01b031681565b34801561076c57600080fd5b5061030461077b366004612d61565b611863565b34801561078c57600080fd5b5061030461079b366004612d7e565b6119de565b3480156107ac57600080fd5b506103046107bb366004612d61565b611b00565b3480156107cc57600080fd5b5061031c6107db366004613249565b611b3f565b3480156107ec57600080fd5b506103046107fb366004612de9565b611bed565b34801561080c57600080fd5b5060025461082190600160a01b900460ff1681565b6040516103269190613275565b34801561083a57600080fd5b5061031c600481565b34801561084f57600080fd5b5061089c61085e366004612d7e565b600c60205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b0316906001600160801b031683565b604080516001600160a01b0390941684526001600160601b0390921660208401526001600160801b031690820152606001610326565b3480156108de57600080fd5b5061031c60035481565b3480156108f457600080fd5b5061031c60075481565b34801561090a57600080fd5b5061031c600d5481565b61031c61092236600461328f565b611c40565b34801561093357600080fd5b5061031c60105481565b34801561094957600080fd5b506103046109583660046132d5565b611f88565b34801561096957600080fd5b5061097d610978366004612d61565b6121e4565b604051610326919061334d565b34801561099657600080fd5b5061052c6109a5366004613008565b50600192915050565b3480156109ba57600080fd5b506109e56109c9366004612d61565b6011602052600090815260409020600181015460029091015482565b60408051928352602083019190915201610326565b348015610a0657600080fd5b50610304610a15366004612d7e565b612287565b348015610a2657600080fd5b50610a3a610a35366004612d7e565b6122a9565b6040516103269695949392919061339a565b348015610a5857600080fd5b50610a6c610a67366004612dab565b612521565b6040516103269392919061341c565b348015610a8757600080fd5b50610304610a96366004612d61565b612620565b348015610aa757600080fd5b5061031c600381565b61052c610abe366004612d61565b50600090565b348015610ad057600080fd5b5060095461052c9060ff1681565b348015610aea57600080fd5b5061031c610af9366004613447565b612667565b348015610b0a57600080fd5b50600154610398906001600160a01b031681565b6000546201000090046001600160a01b03163314610b3b57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600f602052604081206005810154610b8a576000838152601460205260409020549150610c06565b600581018054610b9c90600190613499565b81548110610bac57610bac6134b0565b600091825260209091206002600390920201015460ff16610c0057600581018054610bd990600190613499565b81548110610be957610be96134b0565b906000526020600020906003020160000154610c03565b60005b91505b50919050565b600a8181548110610c1c57600080fd5b60009182526020909120600b90910201805460028201546003830154600484015460058501546006909501546001600160601b03909416955060ff90921693909286565b6010548210610cb65760405162461bcd60e51b815260206004820152601a60248201527f4469737075746520494420646f6573206e6f742065786973742e00000000000060448201526064015b60405180910390fd5b6012546001600160a01b03163314610d105760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c792062652063616c6c656420627920676174657761790000006044820152606401610cad565b6000828152600f60205260409020600d81015460ff1615610d6e5760405162461bcd60e51b8152602060048201526018602482015277293ab634b7339030b63932b0b23c9032bc32b1baba32b21760411b6044820152606401610cad565b600d81018054600160ff19909116179055600083815260146020526040908190208390558154905163188d362b60e11b81526004810185905260248101849052600160601b9091046001600160a01b03169063311a6c5690604401600060405180830381600087803b158015610de357600080fd5b505af1158015610df7573d6000803e3d6000fd5b50508254604051858152869350600160601b9091046001600160a01b031691507f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a3505050565b6000546201000090046001600160a01b03163314610e6657600080fd5b6001600160601b0382161580610ed7575080600a80846001600160601b031681548110610e9557610e956134b0565b60009182526020909120600b909102015481546001600160601b03909116908110610ec257610ec26134b0565b90600052602060002090600b02016003015411155b610ee057600080fd5b60005b600a836001600160601b031681548110610eff57610eff6134b0565b90600052602060002090600b0201600101805490508110156110205781600a80856001600160601b031681548110610f3957610f396134b0565b90600052602060002090600b02016001018381548110610f5b57610f5b6134b0565b906000526020600020015481548110610f7657610f766134b0565b90600052602060002090600b020160030154101561100e5760405162461bcd60e51b815260206004820152604960248201527f4120737562636f7572742063616e6e6f742062652074686520706172656e742060448201527f6f66206120737562636f75727420776974682061206c6f776572206d696e696d6064820152683ab69039ba30b5b29760b91b608482015260a401610cad565b80611018816134c6565b915050610ee3565b5080600a836001600160601b03168154811061103e5761103e6134b0565b90600052602060002090600b0201600301819055505050565b6060611061612ca1565b6000600a846001600160601b03168154811061107f5761107f6134b0565b90600052602060002090600b02019050806001018054806020026020016040519081016040528092919081815260200182805480156110dd57602002820191906000526020600020905b8154815260200190600101908083116110c9575b505060408051608081019182905294975060078601935060049250905082845b8154815260200190600101908083116110fd575050505050915050915091565b600054610100900460ff161580801561113d5750600054600160ff909116105b806111575750303b158015611157575060005460ff166001145b6111ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610cad565b6000805460ff1916600117905580156111dd576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b038f81169190910291909117909155600180546001600160a01b0319168d83161781556002805460078d905560088c90556001600160a81b031916928d1692909217909155426003556009805460ff19169091179055600d5461125b576001600d555b601280546001600160a01b038086166001600160a01b0319928316179092556013805492851692909116919091179055600a5461144357604080516101008101825260008082528251818152602080820185528084019182528b1515848601528a516060808601919091528b8201516080860152948b015160a0850152938a015160c084015260e08301899052600a8054600181018255925282517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600b90930292830180546001600160601b0319166001600160601b039092169190911781559051805193949193611375937fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a901929190910190612cbf565b50604082015160028201805460ff191691151591909117905560608201516003820155608082015160048083019190915560a0830151600583015560c0830151600683015560e08301516113ce91600784019190612d0a565b505060405163483abc4f60e11b8152600b6004820152600060248201526044810186905273__$9b1aa2a5defb7a13dc220b13d2e6a83a6b$__9150639075789e9060640160006040518083038186803b15801561142a57600080fd5b505af415801561143e573d6000803e3d6000fd5b505050505b8015611489576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b60095460009060ff161561158b576001546040516370a0823160e01b815260009184916001600160a01b03909116906370a08231906114da908990600401612d97565b60206040518083038186803b1580156114f257600080fd5b505afa158015611506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152a91906134e1565b6115349190613499565b6001600160a01b03861660009081526011602052604090206001015490915081108061157a57506001600160a01b03851660009081526011602052604090206002015481105b1561158957600091505061158f565b505b5060015b9392505050565b6000546201000090046001600160a01b031633146115b357600080fd5b80600a836001600160601b0316815481106115d0576115d06134b0565b90600052602060002090600b02016007019060046115ef929190612d0a565b505050565b6000546201000090046001600160a01b0316331461161157600080fd5b80600a836001600160601b03168154811061162e5761162e6134b0565b90600052602060002090600b0201600501819055505050565b6000546201000090046001600160a01b0316331461166457600080fd5b80600a836001600160601b031681548110611681576116816134b0565b90600052602060002090600b0201600401819055505050565b6000546201000090046001600160a01b031633146116b757600080fd5b6000836001600160a01b031683836040516116d29190613526565b60006040518083038185875af1925050503d806000811461170f576040519150601f19603f3d011682016040523d82523d6000602084013e611714565b606091505b50509050806117595760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610cad565b50505050565b6000546201000090046001600160a01b0316331461177c57600080fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546201000090046001600160a01b031633146117bb57600080fd5b600755565b6117cb3383836126ee565b6117d457600080fd5b5050565b6000806000806000600f60008981526020019081526020016000206004018781548110611807576118076134b0565b906000526020600020018681548110611822576118226134b0565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169b909a5091985060ff169650945050505050565b6000546201000090046001600160a01b0316331461188057600080fd5b600280546001600160a01b0319166001600160a01b038316179055600160028054600160a01b900460ff16908111156118bb576118bb613049565b14156119db57600260009054906101000a90046001600160a01b03166001600160a01b0316631c77c58c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561190f57600080fd5b505afa158015611923573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194791906134e1565b600260009054906101000a90046001600160a01b03166001600160a01b03166378ab865d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561199557600080fd5b505afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd91906134e1565b6119d79190613542565b6005555b50565b60008060028054600160a01b900460ff16908111156119ff576119ff613049565b14611a0957600080fd5b6000600e54600184600d54611a1e9190613542565b611a289190613499565b11611a335782611a4e565b600d54600e54611a439190613499565b611a4e906001613542565b9050600081600d54611a609190613542565b9050600d54811015611a7157600080fd5b600d545b81811015611af7576000818152600c6020526040902080546001820154611ac1916001600160a01b03811691600160a01b9091046001600160601b0316906001600160801b03166126ee565b50506000818152600c6020526040812090815560010180546001600160801b031916905580611aef816134c6565b915050611a75565b50600d55505050565b6000546201000090046001600160a01b03163314611b1d57600080fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b600073__$9b1aa2a5defb7a13dc220b13d2e6a83a6b$__637521ccb1600b6001600160601b038516611b718787612c10565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b158015611bb557600080fd5b505af4158015611bc9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158f91906134e1565b6000546201000090046001600160a01b03163314611c0a57600080fd5b80600a836001600160601b031681548110611c2757611c276134b0565b90600052602060002090600b0201600601819055505050565b60003415611c905760405162461bcd60e51b815260206004820152601b60248201527f466565732073686f756c64206265207061696420696e205745544800000000006044820152606401610cad565b6000611c9b83612667565b6013546040516323b872dd60e01b8152336004820152306024820152604481018390529192506001600160a01b0316906323b872dd90606401602060405180830381600087803b158015611cee57600080fd5b505af1158015611d02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d26919061355a565b611d725760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f756768205745544820666f72206172626974726174696f6e006044820152606401610cad565b60108054906000611d82836134c6565b909155506000818152600f6020526040812080546001600160601b031633600160601b0217815591935080611db686612c58565b90925090506000611dc8836001613577565b604080516001600160601b03929092166020830152810183905260600160408051808303601f190181529082905260135460125463a9059cbb60e01b84526001600160a01b03908116600485015260248401899052919350169063a9059cbb90604401602060405180830381600087803b158015611e4557600080fd5b505af1158015611e59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7d919061355a565b611ec95760405162461bcd60e51b815260206004820152601e60248201527f466565207472616e7366657220746f2067617465776179206661696c656400006044820152606401610cad565b60125460405163979f8e6560e01b81526001600160a01b039091169063979f8e6590611efd908b9085908a906004016135ce565b602060405180830381600087803b158015611f1757600080fd5b505af1158015611f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4f91906134e1565b50604051339087907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a3505050505092915050565b6000546201000090046001600160a01b03163314611fa557600080fd5b85600a896001600160601b031681548110611fc257611fc26134b0565b90600052602060002090600b02016003015411156120585760405162461bcd60e51b815260206004820152604760248201527f4120737562636f7572742063616e6e6f742062652061206368696c64206f662060448201527f6120737562636f7572742077697468206120686967686572206d696e696d756d6064820152661039ba30b5b29760c91b608482015260a401610cad565b600a805460018101825560009182527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600b82020180546001600160601b0319166001600160601b038c1617815590916040519080825280602002602001820160405280156120d1578160200160208202803683370190505b5080516120e8916001840191602090910190612cbf565b5060028101805460ff19168a151517905560038101889055600480820188905560058201879055600682018690556121269060078301908690612d0a565b5060405163483abc4f60e11b8152600b6004820152602481018390526044810184905273__$9b1aa2a5defb7a13dc220b13d2e6a83a6b$__90639075789e9060640160006040518083038186803b15801561218057600080fd5b505af4158015612194573d6000803e3d6000fd5b50505050600a8a6001600160601b0316815481106121b4576121b46134b0565b600091825260208083206001600b9093020182018054928301815583529091200191909155505050505050505050565b6001600160a01b0381166000908152601160209081526040918290208054835181840281018401909452808452606093919283919083018282801561227a57602002820191906000526020600020906000905b82829054906101000a90046001600160601b03166001600160601b0316815260200190600c0190602082600b010492830192600103820291508084116122375790505b5050505050915050919050565b6000546201000090046001600160a01b031633146122a457600080fd5b600855565b6000818152600f602052604090206004810154606091829182918291829182916001600160401b038111156122e0576122e0612ebd565b604051908082528060200260200182016040528015612309578160200160208202803683370190505b50965060005b600482015481101561236d57816004018181548110612330576123306134b0565b9060005260206000200180549050888281518110612350576123506134b0565b602090810291909101015280612365816134c6565b91505061230f565b50806006018054806020026020016040519081016040528092919081815260200182805480156123bc57602002820191906000526020600020905b8154815260200190600101908083116123a8575b505050505095508060070180548060200260200160405190810160405280929190818152602001828054801561241157602002820191906000526020600020905b8154815260200190600101908083116123fd575b5050505050945080600a0180548060200260200160405190810160405280929190818152602001828054801561246657602002820191906000526020600020905b815481526020019060010190808311612452575b5050505050935080600b018054806020026020016040519081016040528092919081815260200182805480156124bb57602002820191906000526020600020905b8154815260200190600101908083116124a7575b5050505050925080600c0180548060200260200160405190810160405280929190818152602001828054801561251057602002820191906000526020600020905b8154815260200190600101908083116124fc575b505050505091505091939550919395565b6000828152600f60205260408120600581018054606092849290918391908790811061254f5761254f6134b0565b9060005260206000209060030201905080600001549450816001015460016125779190613542565b6001600160401b0381111561258e5761258e612ebd565b6040519080825280602002602001820160405280156125b7578160200160208202803683370190505b50935060005b8260010154811161260a57600081815260018301602052604090205485518690839081106125ed576125ed6134b0565b602090810291909101015280612602816134c6565b9150506125bd565b506002015493969295505060ff90921692509050565b6000546201000090046001600160a01b0316331461263d57600080fd5b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60125460405163f7434ea960e01b81526000916001600160a01b03169063f7434ea9906126989085906004016135f7565b60206040518083038186803b1580156126b057600080fd5b505afa1580156126c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e891906134e1565b92915050565b600a546000906001600160601b0384161061270b5750600061158f565b6001600160801b03821615806127575750816001600160801b0316600a846001600160601b031681548110612742576127426134b0565b90600052602060002090600b02016003015411155b6127635750600061158f565b6001600160a01b0384166000908152601160205260408120906127868686612c10565b604051637521ccb160e01b8152600b60048201526001600160601b03871660248201526044810182905290915060009073__$9b1aa2a5defb7a13dc220b13d2e6a83a6b$__90637521ccb19060640160206040518083038186803b1580156127ed57600080fd5b505af4158015612801573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282591906134e1565b90506001600160801b038516158061283d5750600081115b80612849575082546004115b612859576000935050505061158f565b6000856001600160801b03168285600101546128759190613499565b61287f9190613542565b90506001600160801b038616158061291557506001546040516370a0823160e01b815282916001600160a01b0316906370a08231906128c2908c90600401612d97565b60206040518083038186803b1580156128da57600080fd5b505afa1580156128ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291291906134e1565b10155b61292657600094505050505061158f565b600184018190556001600160801b038616612a8b5760005b8454811015612a8557876001600160601b0316856000018281548110612966576129666134b0565b600091825260209091206002820401546001909116600c026101000a90046001600160601b03161415612a7357845485906129a390600190613499565b815481106129b3576129b36134b0565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b03168560000182815481106129f1576129f16134b0565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b0316021790555084600001805480612a3d57612a3d61360a565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055612a85565b80612a7d816134c6565b91505061293e565b50612acb565b81612acb578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918a16021790555b60006001600160601b0388165b81612ba357604051631712e1c560e11b8152600b6004820152602481018290526001600160801b03891660448201526064810186905273__$9b1aa2a5defb7a13dc220b13d2e6a83a6b$__90632e25c38a9060840160006040518083038186803b158015612b4557600080fd5b505af4158015612b59573d6000803e3d6000fd5b505050508060001415612b6f5760019150612ad8565b600a8181548110612b8257612b826134b0565b60009182526020909120600b90910201546001600160601b03169050612ad8565b604080516001600160601b038b1681526001600160801b038a1660208201529081018490526001600160a01b038b16907f8f753321c98641397daaca5e8abf8881fff1fd7a7bc229924a012e2cb61763d59060600160405180910390a25060019998505050505050505050565b600060405160005b6014811015612c33578481600c011a81830153600101612c18565b5060145b6020811015612c4f5783811a81830153600101612c37565b50519392505050565b6000806040835110612c9557505060208101516040820151600a546001600160601b03831610612c8757600091505b80612c90575060035b915091565b50600090506003915091565b60405180608001604052806004906020820280368337509192915050565b828054828255906000526020600020908101928215612cfa579160200282015b82811115612cfa578251825591602001919060010190612cdf565b50612d06929150612d37565b5090565b8260048101928215612cfa5791602002820182811115612cfa578251825591602001919060010190612cdf565b5b80821115612d065760008155600101612d38565b6001600160a01b03811681146119db57600080fd5b600060208284031215612d7357600080fd5b813561158f81612d4c565b600060208284031215612d9057600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215612dbe57600080fd5b50508035926020909101359150565b80356001600160601b0381168114612de457600080fd5b919050565b60008060408385031215612dfc57600080fd5b612e0583612dcd565b946020939093013593505050565b600060208284031215612e2557600080fd5b61158f82612dcd565b600081518084526020808501945080840160005b83811015612e5e57815187529582019590820190600101612e42565b509495945050505050565b60a081526000612e7c60a0830185612e2e565b905060208083018460005b6004811015612ea457815183529183019190830190600101612e87565b505050509392505050565b80151581146119db57600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612ee457600080fd5b604051608081018181106001600160401b0382111715612f0657612f06612ebd565b604052806080840185811115612f1b57600080fd5b845b81811015612f35578035835260209283019201612f1d565b509195945050505050565b60008060008060008060008060008060006102208c8e031215612f6257600080fd5b8b35612f6d81612d4c565b9a5060208c0135612f7d81612d4c565b995060408c0135612f8d81612d4c565b985060608c0135975060808c0135965060a08c0135612fab81612eaf565b9550612fba8d60c08e01612ed3565b9450612fca8d6101408e01612ed3565b93506101c08c013592506101e08c0135612fe381612d4c565b91506102008c0135612ff481612d4c565b809150509295989b509295989b9093969950565b60008060006060848603121561301d57600080fd5b833561302881612d4c565b9250602084013561303881612d4c565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b6001600160601b03891681526001600160a01b03881660208201526040810187905261010081016005871061309657613096613049565b6060820196909652608081019490945260a084019290925260c0830152151560e0909101529392505050565b60008060a083850312156130d557600080fd5b6130de83612dcd565b91506130ed8460208501612ed3565b90509250929050565b600082601f83011261310757600080fd5b81356001600160401b038082111561312157613121612ebd565b604051601f8301601f19908116603f0116810190828211818310171561314957613149612ebd565b8160405283815286602085880101111561316257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561319757600080fd5b83356131a281612d4c565b92506020840135915060408401356001600160401b038111156131c457600080fd5b6131d0868287016130f6565b9150509250925092565b600080604083850312156131ed57600080fd5b6131f683612dcd565b915060208301356001600160801b038116811461321257600080fd5b809150509250929050565b60008060006060848603121561323257600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561325c57600080fd5b823561326781612d4c565b91506130ed60208401612dcd565b602081016003831061328957613289613049565b91905290565b600080604083850312156132a257600080fd5b8235915060208301356001600160401b038111156132bf57600080fd5b6132cb858286016130f6565b9150509250929050565b600080600080600080600080610160898b0312156132f257600080fd5b6132fb89612dcd565b9750602089013561330b81612eaf565b965060408901359550606089013594506080890135935060a089013592506133368a60c08b01612ed3565b915061014089013590509295985092959890939650565b6020808252825182820181905260009190848201906040850190845b8181101561338e5783516001600160601b031683529284019291840191600101613369565b50909695505050505050565b60c0815260006133ad60c0830189612e2e565b82810360208401526133bf8189612e2e565b905082810360408401526133d38188612e2e565b905082810360608401526133e78187612e2e565b905082810360808401526133fb8186612e2e565b905082810360a084015261340f8185612e2e565b9998505050505050505050565b8381526060602082015260006134356060830185612e2e565b90508215156040830152949350505050565b60006020828403121561345957600080fd5b81356001600160401b0381111561346f57600080fd5b61347b848285016130f6565b949350505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156134ab576134ab613483565b500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156134da576134da613483565b5060010190565b6000602082840312156134f357600080fd5b5051919050565b60005b838110156135155781810151838201526020016134fd565b838111156117595750506000910152565b600082516135388184602087016134fa565b9190910192915050565b6000821982111561355557613555613483565b500190565b60006020828403121561356c57600080fd5b815161158f81612eaf565b60006001600160601b0380831681851680830382111561359957613599613483565b01949350505050565b600081518084526135ba8160208601602086016134fa565b601f01601f19169290920160200192915050565b8381526060602082015260006135e760608301856135a2565b9050826040830152949350505050565b60208152600061158f60208301846135a2565b634e487b7160e01b600052603160045260246000fdfea26469706673582212208c24f0dc5c862abcfbeb5d7abaf80f855b2bfba8e446fb9c2aa2b7b83edd554e64736f6c63430008090033", + "libraries": { + "SortitionSumTreeFactory": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636" + }, + "devdoc": { + "details": "This contract is an adaption of Mainnet's KlerosLiquid (https://github.com/kleros/kleros/blob/69cfbfb2128c29f1625b3a99a3183540772fda08/contracts/kleros/KlerosLiquid.sol) for xDai chain. Notice that variables referring to ETH values in this contract, will hold the native token values of the chain on which xKlerosLiquid is deployed. When this contract gets deployed on xDai chain, ETH variables will hold xDai values.", + "events": { + "Draw(address,uint256,uint256,uint256)": { + "details": "Emitted when a juror is drawn.", + "params": { + "_address": "The drawn address.", + "_appeal": "The appeal the draw is for. 0 is for the first round.", + "_disputeID": "The ID of the dispute.", + "_voteID": "The vote ID." + } + }, + "NewPeriod(uint256,uint8)": { + "details": "Emitted when a dispute passes to a new period.", + "params": { + "_disputeID": "The ID of the dispute.", + "_period": "The new period." + } + }, + "NewPhase(uint8)": { + "details": "Emitted when we pass to a new phase.", + "params": { + "_phase": "The new phase." + } + }, + "StakeSet(address,uint256,uint128,uint256)": { + "details": "Emitted when a juror's stake is set.", + "params": { + "_address": "The address of the juror.", + "_newTotalStake": "The new total stake.", + "_stake": "The new stake.", + "_subcourtID": "The ID of the subcourt at the end of the stake path." + } + }, + "TokenAndETHShift(address,uint256,int256,int256)": { + "details": "Emitted when a juror wins or loses tokens and ETH from a dispute.", + "params": { + "_ETHAmount": "The amount of ETH won or lost.", + "_address": "The juror affected.", + "_disputeID": "The ID of the dispute.", + "_tokenAmount": "The amount of tokens won or lost." + } + } + }, + "kind": "dev", + "methods": { + "arbitrationCost(bytes)": { + "details": "Gets the cost of arbitration in a specified subcourt.", + "params": { + "_extraData": "Additional info about the dispute. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes)." + }, + "returns": { + "cost": "The cost." + } + }, + "changeForeignGateway(address)": { + "details": "Changes the `foreignGateway` storage variable.", + "params": { + "_foreignGateway": "The new value for the `foreignGateway` storage variable." + } + }, + "changeGovernor(address)": { + "details": "Changes the `governor` storage variable.", + "params": { + "_governor": "The new value for the `governor` storage variable." + } + }, + "changeMaxDrawingTime(uint256)": { + "details": "Changes the `maxDrawingTime` storage variable.", + "params": { + "_maxDrawingTime": "The new value for the `maxDrawingTime` storage variable." + } + }, + "changeMinStakingTime(uint256)": { + "details": "Changes the `minStakingTime` storage variable.", + "params": { + "_minStakingTime": "The new value for the `minStakingTime` storage variable." + } + }, + "changePinakion(address)": { + "details": "Changes the `pinakion` storage variable.", + "params": { + "_pinakion": "The new value for the `pinakion` storage variable." + } + }, + "changeRNGenerator(address)": { + "details": "Changes the `RNGenerator` storage variable.", + "params": { + "_RNGenerator": "The new value for the `RNGenerator` storage variable." + } + }, + "changeSubcourtAlpha(uint96,uint256)": { + "details": "Changes the `alpha` property value of a specified subcourt.", + "params": { + "_alpha": "The new value for the `alpha` property value.", + "_subcourtID": "The ID of the subcourt." + } + }, + "changeSubcourtJurorFee(uint96,uint256)": { + "details": "Changes the `feeForJuror` property value of a specified subcourt.", + "params": { + "_feeForJuror": "The new value for the `feeForJuror` property value.", + "_subcourtID": "The ID of the subcourt." + } + }, + "changeSubcourtJurorsForJump(uint96,uint256)": { + "details": "Changes the `jurorsForCourtJump` property value of a specified subcourt.", + "params": { + "_jurorsForCourtJump": "The new value for the `jurorsForCourtJump` property value.", + "_subcourtID": "The ID of the subcourt." + } + }, + "changeSubcourtMinStake(uint96,uint256)": { + "details": "Changes the `minStake` property value of a specified subcourt. Don't set to a value lower than its parent's `minStake` property value.", + "params": { + "_minStake": "The new value for the `minStake` property value.", + "_subcourtID": "The ID of the subcourt." + } + }, + "changeSubcourtTimesPerPeriod(uint96,uint256[4])": { + "details": "Changes the `timesPerPeriod` property value of a specified subcourt.", + "params": { + "_subcourtID": "The ID of the subcourt.", + "_timesPerPeriod": "The new value for the `timesPerPeriod` property value." + } + }, + "changeWethAddress(address)": { + "details": "Changes the `weth` storage variable.", + "params": { + "_weth": "The new value for the `weth` storage variable." + } + }, + "createDispute(uint256,bytes)": { + "details": "Creates a dispute. Must be called by the arbitrable contract.", + "params": { + "_extraData": "Additional info about the dispute to be created. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes).", + "_numberOfChoices": "Number of choices to choose from in the dispute to be created." + }, + "returns": { + "disputeID": "The ID of the created dispute." + } + }, + "createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256)": { + "details": "Creates a subcourt under a specified parent court.", + "params": { + "_alpha": "The `alpha` property value of the subcourt.", + "_feeForJuror": "The `feeForJuror` property value of the subcourt.", + "_hiddenVotes": "The `hiddenVotes` property value of the subcourt.", + "_jurorsForCourtJump": "The `jurorsForCourtJump` property value of the subcourt.", + "_minStake": "The `minStake` property value of the subcourt.", + "_parent": "The `parent` property value of the subcourt.", + "_sortitionSumTreeK": "The number of children per node of the subcourt's sortition sum tree.", + "_timesPerPeriod": "The `timesPerPeriod` property value of the subcourt." + } + }, + "currentRuling(uint256)": { + "details": "Gets the current ruling of a specified dispute.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "ruling": "The current ruling." + } + }, + "executeDelayedSetStakes(uint256)": { + "details": "Executes the next delayed set stakes. `O(n)` where `n` is the number of iterations to run.", + "params": { + "_iterations": "The number of delayed set stakes to execute." + } + }, + "executeGovernorProposal(address,uint256,bytes)": { + "details": "Lets the governor 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." + } + }, + "getDispute(uint256)": { + "details": "Gets a specified dispute's non primitive properties.", + "params": { + "_disputeID": "The ID of the dispute." + }, + "returns": { + "penaltiesInEachRound": "The dispute's amount of tokens collected from penalties in each round. `O(a)` where `a` is the number of appeals of the dispute.", + "repartitionsInEachRound": "The dispute's counter of vote reward repartitions made in each round.", + "tokensAtStakePerJuror": "The dispute's required tokens at stake per Juror.", + "totalFeesForJurors": "The dispute's total fees for Jurors.", + "votesInEachRound": "The dispute's counter of votes made in each round.", + "votesLengths": "The dispute's vote length." + } + }, + "getJuror(address)": { + "details": "Gets a specified juror's non primitive properties.", + "params": { + "_account": "The address of the juror." + }, + "returns": { + "subcourtIDs": "The juror's IDs of subcourts where the juror has stake path." + } + }, + "getSubcourt(uint96)": { + "details": "Gets a specified subcourt's non primitive properties.", + "params": { + "_subcourtID": "The ID of the subcourt." + }, + "returns": { + "children": "The subcourt's child court list.", + "timesPerPeriod": "The subcourt's time per period." + } + }, + "getVote(uint256,uint256,uint256)": { + "details": "Gets a specified vote for a specified appeal in a specified dispute.", + "params": { + "_appeal": "The appeal.", + "_disputeID": "The ID of the dispute.", + "_voteID": "The ID of the vote." + }, + "returns": { + "account": "The account for vote.", + "choice": " The choice for vote.", + "commit": " The commit for vote.", + "voted": "True if the account voted, False otherwise." + } + }, + "getVoteCounter(uint256,uint256)": { + "details": "Gets the vote counter for a specified appeal in a specified dispute. Note: This function is only to be used by the interface and it won't work if the number of choices is too high.", + "params": { + "_appeal": "The appeal.", + "_disputeID": "The ID of the dispute." + }, + "returns": { + "counts": "The count.", + "tied": "Whether the vote tied. `O(n)` where `n` is the number of choices of the dispute.", + "winningChoice": "The winning choice." + } + }, + "initialize(address,address,address,uint256,uint256,bool,uint256[4],uint256[4],uint256,address,address)": { + "details": "Constructs the KlerosLiquid contract.", + "params": { + "_RNGenerator": "The address of the random number generator contract.", + "_courtParameters": "MinStake, alpha, feeForJuror and jurorsForCourtJump respectively.", + "_foreignGateway": "Foreign gateway on xDai.", + "_governor": "The governor's address.", + "_hiddenVotes": "The `hiddenVotes` property value of the general court.", + "_maxDrawingTime": "The maximum time that the drawing phase should last.", + "_minStakingTime": "The minimum time that the staking phase should last.", + "_pinakion": "The address of the token contract.", + "_sortitionSumTreeK": "The number of children per node of the general court's sortition sum tree.", + "_timesPerPeriod": "The `timesPerPeriod` property value of the general court.", + "_weth": "Weth contract." + } + }, + "onApprove(address,address,uint256)": { + "details": "Notifies the controller about an approval allowing the controller to react if desired.", + "params": { + "_amount": "The amount in the `approve()` call.", + "_owner": "The address that calls `approve()`.", + "_spender": "The spender in the `approve()` call." + }, + "returns": { + "allowed": "Whether the operation should be allowed or not." + } + }, + "onTransfer(address,address,uint256)": { + "details": "Notifies the controller about a token transfer allowing the controller to react if desired.", + "params": { + "_amount": "The amount of the transfer.", + "_from": "The origin of the transfer.", + "_to": "The destination of the transfer." + }, + "returns": { + "allowed": "Whether the operation should be allowed or not." + } + }, + "proxyPayment(address)": { + "details": "DEPRECATED. Called when `_owner` sends ETH to the Wrapped Token contract.", + "params": { + "_owner": "The address that sent the ETH to create tokens." + }, + "returns": { + "allowed": "Whether the operation should be allowed or not." + } + }, + "rule(uint256,uint256)": { + "details": "Receive the ruling from foreign gateway which technically is an arbitrator of this contract.", + "params": { + "_disputeID": "ID of the dispute.", + "_ruling": "Ruling given by V2 court and relayed by foreign gateway." + } + }, + "setStake(uint96,uint128)": { + "details": "Sets the caller's stake in a subcourt.", + "params": { + "_stake": "The new stake.", + "_subcourtID": "The ID of the subcourt." + } + }, + "stakeOf(address,uint96)": { + "details": "Gets the stake of a specified juror in a specified subcourt.", + "params": { + "_account": "The address of the juror.", + "_subcourtID": "The ID of the subcourt." + }, + "returns": { + "stake": "The stake." + } + } + }, + "title": "xKlerosLiquidV2", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 143, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 146, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 2130, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "governor", + "offset": 2, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2133, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "pinakion", + "offset": 0, + "slot": "1", + "type": "t_contract(WrappedPinakion)1864" + }, + { + "astId": 2136, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "RNGenerator", + "offset": 0, + "slot": "2", + "type": "t_contract(IRandomAuRa)1919" + }, + { + "astId": 2139, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "phase", + "offset": 20, + "slot": "2", + "type": "t_enum(Phase)1960" + }, + { + "astId": 2141, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "lastPhaseChange", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 2143, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "disputesWithoutJurors", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 2145, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "RNBlock", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 2147, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "RN", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 2149, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "minStakingTime", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 2151, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "maxDrawingTime", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 2153, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "lockInsolventTransfers", + "offset": 0, + "slot": "9", + "type": "t_bool" + }, + { + "astId": 2157, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "courts", + "offset": 0, + "slot": "10", + "type": "t_array(t_struct(Court)1986_storage)dyn_storage" + }, + { + "astId": 2164, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "sortitionSumTrees", + "offset": 0, + "slot": "11", + "type": "t_struct(SortitionSumTrees)3785_storage" + }, + { + "astId": 2169, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "delayedSetStakes", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_uint256,t_struct(DelayedSetStake)1993_storage)" + }, + { + "astId": 2171, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "nextDelayedSetStake", + "offset": 0, + "slot": "13", + "type": "t_uint256" + }, + { + "astId": 2173, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "lastDelayedSetStake", + "offset": 0, + "slot": "14", + "type": "t_uint256" + }, + { + "astId": 2178, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "disputes", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_uint256,t_struct(Dispute)2054_storage)" + }, + { + "astId": 2180, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "totalDisputes", + "offset": 0, + "slot": "16", + "type": "t_uint256" + }, + { + "astId": 2185, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "jurors", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_struct(Juror)2062_storage)" + }, + { + "astId": 2188, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "foreignGateway", + "offset": 0, + "slot": "18", + "type": "t_contract(IForeignGateway)1133" + }, + { + "astId": 2191, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "weth", + "offset": 0, + "slot": "19", + "type": "t_contract(IERC20)383" + }, + { + "astId": 2195, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "disputesRuling", + "offset": 0, + "slot": "20", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_array(t_struct(Vote)2002_storage)dyn_storage)dyn_storage": { + "base": "t_array(t_struct(Vote)2002_storage)dyn_storage", + "encoding": "dynamic_array", + "label": "struct xKlerosLiquidV2.Vote[][]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Court)1986_storage)dyn_storage": { + "base": "t_struct(Court)1986_storage", + "encoding": "dynamic_array", + "label": "struct xKlerosLiquidV2.Court[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Vote)2002_storage)dyn_storage": { + "base": "t_struct(Vote)2002_storage", + "encoding": "dynamic_array", + "label": "struct xKlerosLiquidV2.Vote[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(VoteCounter)2011_storage)dyn_storage": { + "base": "t_struct(VoteCounter)2011_storage", + "encoding": "dynamic_array", + "label": "struct xKlerosLiquidV2.VoteCounter[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)4_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[4]", + "numberOfBytes": "128" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_array(t_uint96)dyn_storage": { + "base": "t_uint96", + "encoding": "dynamic_array", + "label": "uint96[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IArbitrable)1048": { + "encoding": "inplace", + "label": "contract IArbitrable", + "numberOfBytes": "20" + }, + "t_contract(IERC20)383": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(IForeignGateway)1133": { + "encoding": "inplace", + "label": "contract IForeignGateway", + "numberOfBytes": "20" + }, + "t_contract(IRandomAuRa)1919": { + "encoding": "inplace", + "label": "contract IRandomAuRa", + "numberOfBytes": "20" + }, + "t_contract(WrappedPinakion)1864": { + "encoding": "inplace", + "label": "contract WrappedPinakion", + "numberOfBytes": "20" + }, + "t_enum(Period)1966": { + "encoding": "inplace", + "label": "enum xKlerosLiquidV2.Period", + "numberOfBytes": "1" + }, + "t_enum(Phase)1960": { + "encoding": "inplace", + "label": "enum xKlerosLiquidV2.Phase", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_struct(Juror)2062_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct xKlerosLiquidV2.Juror)", + "numberOfBytes": "32", + "value": "t_struct(Juror)2062_storage" + }, + "t_mapping(t_bytes32,t_struct(SortitionSumTree)3779_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct SortitionSumTreeFactory.SortitionSumTree)", + "numberOfBytes": "32", + "value": "t_struct(SortitionSumTree)3779_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_struct(DelayedSetStake)1993_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct xKlerosLiquidV2.DelayedSetStake)", + "numberOfBytes": "32", + "value": "t_struct(DelayedSetStake)1993_storage" + }, + "t_mapping(t_uint256,t_struct(Dispute)2054_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct xKlerosLiquidV2.Dispute)", + "numberOfBytes": "32", + "value": "t_struct(Dispute)2054_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Court)1986_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.Court", + "members": [ + { + "astId": 1968, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "parent", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 1971, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "children", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 1973, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "hiddenVotes", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 1975, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "minStake", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 1977, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "alpha", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 1979, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "feeForJuror", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 1981, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "jurorsForCourtJump", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 1985, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "timesPerPeriod", + "offset": 0, + "slot": "7", + "type": "t_array(t_uint256)4_storage" + } + ], + "numberOfBytes": "352" + }, + "t_struct(DelayedSetStake)1993_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.DelayedSetStake", + "members": [ + { + "astId": 1988, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1990, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "subcourtID", + "offset": 20, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 1992, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "stake", + "offset": 0, + "slot": "1", + "type": "t_uint128" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Dispute)2054_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.Dispute", + "members": [ + { + "astId": 2013, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "subcourtID", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 2016, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "arbitrated", + "offset": 12, + "slot": "0", + "type": "t_contract(IArbitrable)1048" + }, + { + "astId": 2018, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "numberOfChoices", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2021, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "period", + "offset": 0, + "slot": "2", + "type": "t_enum(Period)1966" + }, + { + "astId": 2023, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "lastPeriodChange", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 2028, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "votes", + "offset": 0, + "slot": "4", + "type": "t_array(t_array(t_struct(Vote)2002_storage)dyn_storage)dyn_storage" + }, + { + "astId": 2032, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "voteCounters", + "offset": 0, + "slot": "5", + "type": "t_array(t_struct(VoteCounter)2011_storage)dyn_storage" + }, + { + "astId": 2035, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "tokensAtStakePerJuror", + "offset": 0, + "slot": "6", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2038, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "totalFeesForJurors", + "offset": 0, + "slot": "7", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2040, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "drawsInRound", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 2042, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "commitsInRound", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 2045, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "votesInEachRound", + "offset": 0, + "slot": "10", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2048, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "repartitionsInEachRound", + "offset": 0, + "slot": "11", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2051, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "penaltiesInEachRound", + "offset": 0, + "slot": "12", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2053, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "ruled", + "offset": 0, + "slot": "13", + "type": "t_bool" + } + ], + "numberOfBytes": "448" + }, + "t_struct(Juror)2062_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.Juror", + "members": [ + { + "astId": 2057, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "subcourtIDs", + "offset": 0, + "slot": "0", + "type": "t_array(t_uint96)dyn_storage" + }, + { + "astId": 2059, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "stakedTokens", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2061, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "lockedTokens", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_struct(SortitionSumTree)3779_storage": { + "encoding": "inplace", + "label": "struct SortitionSumTreeFactory.SortitionSumTree", + "members": [ + { + "astId": 3764, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "K", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 3767, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "stack", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 3770, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "nodes", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 3774, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "IDsToNodeIndexes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 3778, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "nodeIndexesToIDs", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "160" + }, + "t_struct(SortitionSumTrees)3785_storage": { + "encoding": "inplace", + "label": "struct SortitionSumTreeFactory.SortitionSumTrees", + "members": [ + { + "astId": 3784, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "sortitionSumTrees", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)3779_storage)" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Vote)2002_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.Vote", + "members": [ + { + "astId": 1995, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1997, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "commit", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 1999, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "choice", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2001, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "voted", + "offset": 0, + "slot": "3", + "type": "t_bool" + } + ], + "numberOfBytes": "128" + }, + "t_struct(VoteCounter)2011_storage": { + "encoding": "inplace", + "label": "struct xKlerosLiquidV2.VoteCounter", + "members": [ + { + "astId": 2004, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "winningChoice", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 2008, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "counts", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 2010, + "contract": "src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol:xKlerosLiquidV2", + "label": "tied", + "offset": 0, + "slot": "2", + "type": "t_bool" + } + ], + "numberOfBytes": "96" + }, + "t_uint128": { + "encoding": "inplace", + "label": "uint128", + "numberOfBytes": "16" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/gnosischain/PolicyRegistry.json b/contracts/deployments/gnosischain/PolicyRegistry.json new file mode 100644 index 000000000..ed3066b1b --- /dev/null +++ b/contracts/deployments/gnosischain/PolicyRegistry.json @@ -0,0 +1,98 @@ +{ + "address": "0x9d494768936b6bDaabc46733b8D53A937A6c6D7e", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "governor", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "policies", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_subcourtID", + "type": "uint256" + }, + { + "name": "_policy", + "type": "string" + } + ], + "name": "setPolicy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_governor", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_subcourtID", + "type": "uint256" + }, + { + "indexed": false, + "name": "_policy", + "type": "string" + } + ], + "name": "PolicyUpdate", + "type": "event" + } + ] +} diff --git a/contracts/deployments/gnosischain/TokenBridge.json b/contracts/deployments/gnosischain/TokenBridge.json new file mode 100644 index 000000000..4f1c50e09 --- /dev/null +++ b/contracts/deployments/gnosischain/TokenBridge.json @@ -0,0 +1,140 @@ +{ + "address": "0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "version", + "type": "uint256" + }, + { + "name": "implementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "version", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "upgradeabilityOwner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "version", + "type": "uint256" + }, + { + "name": "implementation", + "type": "address" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferProxyOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": false, + "name": "newOwner", + "type": "address" + } + ], + "name": "ProxyOwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "version", + "type": "uint256" + }, + { + "indexed": true, + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + } + ] +} diff --git a/contracts/deployments/gnosischain/TransactionBatcher.json b/contracts/deployments/gnosischain/TransactionBatcher.json new file mode 100644 index 000000000..e1dbd9e24 --- /dev/null +++ b/contracts/deployments/gnosischain/TransactionBatcher.json @@ -0,0 +1,28 @@ +{ + "address": "0x6426800F8508b15AED271337498fa5e7D0794d46", + "abi": [ + { + "inputs": [ + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + } + ], + "name": "batchSend", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ] +} diff --git a/contracts/deployments/gnosischain/WETH.json b/contracts/deployments/gnosischain/WETH.json new file mode 100644 index 000000000..dce27dbb9 --- /dev/null +++ b/contracts/deployments/gnosischain/WETH.json @@ -0,0 +1,883 @@ +{ + "address": "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "mintingFinished", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "result", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_bridgeContract", + "type": "address" + } + ], + "name": "setBridgeContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_sender", + "type": "address" + }, + { + "name": "_recipient", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "name": "result", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_value", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "version", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseApproval", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_to", + "type": "address" + } + ], + "name": "claimTokens", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "isBridge", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "finishMinting", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenInterfacesVersion", + "outputs": [ + { + "name": "major", + "type": "uint64" + }, + { + "name": "minor", + "type": "uint64" + }, + { + "name": "patch", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_holder", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + }, + { + "name": "_nonce", + "type": "uint256" + }, + { + "name": "_expiry", + "type": "uint256" + }, + { + "name": "_allowed", + "type": "bool" + }, + { + "name": "_v", + "type": "uint8" + }, + { + "name": "_r", + "type": "bytes32" + }, + { + "name": "_s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "push", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "move", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH_LEGACY", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "bridgeContract", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_holder", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_deadline", + "type": "uint256" + }, + { + "name": "_v", + "type": "uint8" + }, + { + "name": "_r", + "type": "bytes32" + }, + { + "name": "_s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_addedValue", + "type": "uint256" + } + ], + "name": "increaseApproval", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "name": "pull", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "expirations", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_chainId", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "amount", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "MintFinished", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + } + ], + "name": "OwnershipRenounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "burner", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "name": "data", + "type": "bytes" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } + ] +} diff --git a/contracts/deployments/gnosischain/WrappedPinakion.json b/contracts/deployments/gnosischain/WrappedPinakion.json new file mode 100644 index 000000000..f057e5e8c --- /dev/null +++ b/contracts/deployments/gnosischain/WrappedPinakion.json @@ -0,0 +1,136 @@ +{ + "address": "0xcb3231aBA3b451343e0Fddfc45883c842f223846", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} diff --git a/contracts/deployments/gnosischain/xKlerosLiquid.json b/contracts/deployments/gnosischain/xKlerosLiquid.json new file mode 100644 index 000000000..ee31ded75 --- /dev/null +++ b/contracts/deployments/gnosischain/xKlerosLiquid.json @@ -0,0 +1,136 @@ +{ + "address": "0x9C1dA9A04925bDfDedf0f6421bC7EEa8305F9002", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} diff --git a/contracts/deployments/gnosischain/xPNK.json b/contracts/deployments/gnosischain/xPNK.json new file mode 100644 index 000000000..406599d18 --- /dev/null +++ b/contracts/deployments/gnosischain/xPNK.json @@ -0,0 +1,4 @@ +{ + "address": "0x37b60f4E9A31A64cCc0024dce7D0fD07eAA0F7B3", + "abi": [] +} diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 95261dc70..792716ccf 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -4,4 +4,12 @@ src = 'src' out = 'out' libs = ['../node_modules', 'lib'] +[rpc_endpoints] +arbitrumGoerli = "https://goerli-rollup.arbitrum.io/rpc" +arbitrum = "https://arb1.arbitrum.io/rpc" +goerli = "https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}" +mainnet = "https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}" +chiado = "https://rpc.chiadochain.net" +gnosischain = "https://xdai-rpc.gateway.pokt.network" + # See more config options https://book.getfoundry.sh/reference/config.html diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index d50610ccb..0c8354fed 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -83,7 +83,8 @@ const config: HardhatUserConfig = { saveDeployments: true, tags: ["staging", "home", "layer2"], companionNetworks: { - foreign: "goerli", + foreignChiado: "chiado", + foreignGoerli: "goerli", }, verify: { etherscan: { @@ -130,6 +131,35 @@ const config: HardhatUserConfig = { home: "arbitrum", }, }, + chiado: { + chainId: 10200, + url: "https://rpc.chiadochain.net", + accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], + live: true, + saveDeployments: true, + tags: ["staging", "foreign", "layer1"], + companionNetworks: { + home: "arbitrumGoerli", + }, + verify: { + etherscan: { + apiUrl: "https://blockscout.com/gnosis/chiado", + }, + }, + }, + gnosischain: { + chainId: 100, + url: `https://xdai-rpc.gateway.pokt.network`, + accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], + live: true, + saveDeployments: true, + tags: ["production", "foreign", "layer1"], + verify: { + etherscan: { + apiKey: process.env.GNOSISSCAN_API_KEY, + }, + }, + }, }, namedAccounts: { deployer: { @@ -179,12 +209,14 @@ const config: HardhatUserConfig = { }, external: { // https://github.com/wighawag/hardhat-deploy#importing-deployment-from-other-projects-with-truffle-support - contracts: [ - { - artifacts: "node_modules/@kleros/vea-contracts/deployments", - deploy: "node_modules/@kleros/vea-contracts/deploy", - }, - ], + deployments: { + arbitrumGoerli: ["node_modules/@kleros/vea-contracts/deployments/arbitrumGoerli"], + arbitrum: ["node_modules/@kleros/vea-contracts/deployments/arbitrum"], + chiado: ["node_modules/@kleros/vea-contracts/deployments/chiado"], + gnosischain: ["node_modules/@kleros/vea-contracts/deployments/gnosischain"], + goerli: ["node_modules/@kleros/vea-contracts/deployments/goerli"], + mainnet: ["node_modules/@kleros/vea-contracts/deployments/mainnet"], + }, }, }; diff --git a/contracts/package.json b/contracts/package.json index 175be59d1..fcedc4218 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -69,6 +69,6 @@ "typescript": "^4.6.4" }, "dependencies": { - "@kleros/vea-contracts": "dev" + "@kleros/vea-contracts": "^0.1.12" } } diff --git a/contracts/scripts/console-init-chiado.ts b/contracts/scripts/console-init-chiado.ts new file mode 100644 index 000000000..b92c44054 --- /dev/null +++ b/contracts/scripts/console-init-chiado.ts @@ -0,0 +1,117 @@ +// .load scripts/console-init-chiado.ts +receiver = await ethers.getContract("FastBridgeReceiverOnGnosis"); +// gateway = await ethers.getContract("ForeignGatewayOnGnosis"); +gateway = await ethers.getContractAt("ForeignGatewayOnGnosis", "0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE"); +weth = await ethers.getContract("WETH"); +wethFaucet = await ethers.getContract("WETHFaucet"); +wpnk = await ethers.getContract("WrappedPinakionV2"); +wpnkFaucet = await ethers.getContract("WPNKFaucet"); +xKlerosLiquidV2 = await ethers.getContract("xKlerosLiquidV2"); +arbitrable = await ethers.getContract("ArbitrableExample"); +options = { + gasLimit: 10000000, + maxFeePerGas: ethers.utils.parseUnits("1", "gwei"), + maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"), +}; + +// await weth.transfer(wethFaucet.address, ethers.utils.parseEther("100000")) +// await wethFaucet.request(options) + +const createDispute = async () => { + const choices = 2; + const extraData = + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003"; + const metaEvidenceID = 0; + const evidenceID = ethers.BigNumber.from(ethers.utils.randomBytes(32)); + const feeForJuror = await gateway.arbitrationCost(extraData); + var tx; + try { + tx = await (await weth.increaseAllowance(arbitrable.address, feeForJuror, options)).wait(); + console.log("txID increateAllowance: %s", tx?.transactionHash); + tx = await ( + await arbitrable.createDispute(choices, extraData, metaEvidenceID, evidenceID, feeForJuror, options) + ).wait(); + console.log("txID createDispute: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + if (tx) { + var filter = gateway.filters.DisputeCreation(); + var logs = await gateway.queryFilter(filter, tx.blockNumber, tx.blockNumber); + console.log("Gateway DisputeID: %s", logs[0]?.args?._disputeID); + + filter = gateway.filters.OutgoingDispute(); + logs = await gateway.queryFilter(filter, tx.blockNumber, tx.blockNumber); + console.log("Outgoing Dispute: %O", logs[0]?.args); + } + } +}; + +const epochPeriod = await receiver.epochPeriod(); + +const epochID = async () => { + return Math.floor((await ethers.provider.getBlock("latest")).timestamp / epochPeriod); +}; + +const claim = async (epoch, merkleRoot) => { + const deposit = await receiver.deposit(); + try { + const tx = await ( + await receiver.claim(epoch, merkleRoot, { + value: deposit, + ...options, + }) + ).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } +}; + +const verifyBatch = async (epoch) => { + var tx; + try { + tx = await (await receiver.verifyBatch(epoch, options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const filter = receiver.filters.BatchVerified(); + const logs = await receiver.queryFilter(filter, tx?.blockNumber, tx?.blockNumber); + console.log("BatchVerified: %O", logs[0]?.args); + } +}; + +const verifyAndRelay = async (epoch, message) => { + var tx; + try { + tx = await (await receiver.verifyAndRelayMessage(epoch, [], message, options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + var filter = receiver.filters.MessageRelayed(); + var logs = await receiver.queryFilter(filter, tx?.blockNumber, tx?.blockNumber); + console.log("MessageRelayed: %O", logs[0]?.args); + + filter = arbitrable.filters.Ruling(); + logs = await arbitrable.queryFilter(filter, tx?.blockNumber, tx?.blockNumber); + console.log("Ruling: %O", logs[0]?.args); + } +}; diff --git a/contracts/scripts/console-init.ts b/contracts/scripts/console-init.ts new file mode 100644 index 000000000..cba0675e8 --- /dev/null +++ b/contracts/scripts/console-init.ts @@ -0,0 +1,257 @@ +// .load scripts/console-init.ts +me = (await ethers.provider.listAccounts())[0]; +core = await ethers.getContract("KlerosCore"); +disputeKit = await ethers.getContract("DisputeKitClassic"); +pnk = await ethers.getContract("PNK"); +registry = await ethers.getContract("PolicyRegistry"); +rng = await ethers.getContract("RandomizerRNG"); +rng2 = await ethers.getContract("BlockHashRNG"); +gateway = await ethers.getContract("HomeGatewayToGnosis"); +sender = await ethers.getContract("FastBridgeSenderToGnosis"); +resolver = await ethers.getContract("DisputeResolver"); +options = { gasLimit: 10000000, gasPrice: 5000000000 }; +var disputeID = 0; + +console.log("core phase: %s", await core.phase()); +console.log("disputekit phase: %s", await disputeKit.phase()); +console.log("freezingPhase timeout? %s", await core.freezingPhaseTimeout()); + +const relayCreateDispute = async (blockHash, foreignDisputeID) => { + // const blockHash = "0xda3c4d74eeb199345b771748a930a069b172dac9f4b50697f40803581eb13990"; + // const foreignDisputeID = 6; + const extraData = + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; + const fee = await core.arbitrationCost(extraData); + var tx; + try { + tx = await ( + await gateway.relayCreateDispute( + 10200, + blockHash, + foreignDisputeID, + 2, + extraData, + "0x34E520dc1d2Db660113b64724e14CEdCD01Ee879", + { + value: fee, + ...options, + } + ) + ).wait(); + console.log("txID: %s", tx?.transactionHash); + + disputeID = ( + await core.queryFilter(core.filters.DisputeCreation(), tx.blockNumber, tx.blockNumber) + )[0].args._disputeID.toNumber(); + console.log("Using disputeID %d from now", disputeID); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + if (tx) { + const filter = core.filters.DisputeCreation(); + const logs = await core.queryFilter(filter, tx.blockNumber, tx.blockNumber); + console.log("DisputeID: %s", logs[0]?.args?._disputeID); + } + } +}; + +const createDisputeOnResolver = async () => { + const choices = 2; + const nbOfJurors = 3; + const feeForJuror = (await core.courts(1)).feeForJuror; + var tx; + try { + tx = await ( + await resolver.createDispute( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003", + "", + 2, + { + value: feeForJuror.mul(nbOfJurors), + ...options, + } + ) + ).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + if (tx) { + const filter = core.filters.DisputeCreation(); + const logs = await core.queryFilter(filter, tx.blockNumber, tx.blockNumber); + console.log("DisputeID: %s", logs[0]?.args?._disputeID); + } + } +}; + +const passPhaseDk = async () => { + const before = await disputeKit.phase(); + var tx; + try { + tx = await (await disputeKit.passPhase(options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const after = await disputeKit.phase(); + console.log("Phase: %d -> %d", before, after); + } +}; + +const passPhaseCore = async () => { + const before = await core.phase(); + var tx; + try { + tx = await (await core.passPhase(options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const after = await core.phase(); + console.log("Phase: %d -> %d", before, after); + } +}; + +const passPeriod = async () => { + const before = (await core.disputes(disputeID)).period; + var tx; + try { + tx = await (await core.passPeriod(disputeID, options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const after = (await core.disputes(disputeID)).period; + console.log("Period for dispute %s: %d -> %d", disputeID, before, after); + } +}; + +const drawJurors = async () => { + var info = await core.getRoundInfo(disputeID, 0); + console.log("Drawn jurors before: %O", info.drawnJurors); + let tx; + try { + tx = await (await core.draw(disputeID, 10, options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + info = await core.getRoundInfo(disputeID, 0); + console.log("Drawn jurors after: %O", info.drawnJurors); + } +}; + +const isRngReady = async () => { + const requesterID = await rng.requesterToID(disputeKit.address); + const n = await rng.randomNumbers(requesterID); + if (n.eq(0)) { + console.log("rng is NOT ready."); + return false; + } else { + console.log("rng is ready: %s", n.toString()); + return true; + } +}; + +const getRoundInfo = async () => { + console.log("%O", await core.getRoundInfo(disputeID, 0)); +}; + +const executeRuling = async () => { + let tx; + try { + tx = await (await core.execute(disputeID, 0, 10)).wait(); // redistribute + console.log("txID execute: %s", tx?.transactionHash); + + tx = await (await core.executeRuling(disputeID)).wait(); // rule + console.log("txID executeRuling: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const dispute = await core.disputes(0); + console.log("Ruled? %s", dispute.ruled); + + const ruling = await core.currentRuling(disputeID); + console.log("Ruling: %d, Tied? %s, Overridden? %s", ruling.ruling, ruling.tied, ruling.overridden); + + var filter = sender.filters.MessageReceived(); + var logs = await sender.queryFilter(filter, tx?.blockNumber, tx?.blockNumber); + console.log("MessageReceived: %O", logs[0]?.args); + } +}; + +const toVoting = async () => { + console.log("Running for disputeID %d", disputeID); + var ready; + try { + ready = await passPhaseCore().then(passPhaseDk).then(passPhaseDk).then(isRngReady); + } catch (e) { + ready = false; + } + while (!ready) { + console.log("Waiting for RNG to be ready...", disputeID); + await new Promise((r) => setTimeout(r, 10000)); + ready = await isRngReady(); + } + console.log("RNG is ready, drawing jurors.", disputeID); + await drawJurors().then(passPhaseDk).then(passPhaseCore).then(passPeriod); +}; + +const epochPeriod = await sender.epochPeriod(); + +const epochID = async () => { + return Math.floor((await ethers.provider.getBlock("latest")).timestamp / epochPeriod); +}; + +const anyBatchToSend = async () => { + return await sender.batchSize(); +}; + +const sendBatch = async () => { + const before = await disputeKit.phase(); + var tx; + try { + tx = await (await sender.sendBatch(options)).wait(); + console.log("txID: %s", tx?.transactionHash); + } catch (e) { + if (typeof e === "string") { + console.log("Error: %s", e); + } else if (e instanceof Error) { + console.log("%O", e); + } + } finally { + const filter = sender.filters.BatchOutgoing(); + const logs = await sender.queryFilter(filter, tx.blockNumber, tx.blockNumber); + console.log("BatchOutgoing: %O", logs[0]?.args); + } +}; + +console.log("disputeID not set!"); diff --git a/contracts/scripts/generateDeploymentArtifact.sh b/contracts/scripts/generateDeploymentArtifact.sh new file mode 100755 index 000000000..f68852b07 --- /dev/null +++ b/contracts/scripts/generateDeploymentArtifact.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source $SCRIPT_DIR/../.env + +if [[ $# < 2 ]] +then + echo "usage: $(basename $0)
" + exit 1 +fi + +network=$1 +address=$2 + +# Limitation: proxy contracts will return the proxy's ABI, not its implementation's ABI. +# Workaround: query the address of the implementation, and manually change the address to the proxy's in the artifact. +# Example: WETH on Gnosis chain, https://gnosisscan.io/address/0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1#code + +case $network in +gnosischain) + url="https://api.gnosisscan.io" + apiKey="$GNOSISSCAN_API_KEY" + ;; +chiado) + # Warning: these are distinct instances! + # https://blockscout.com/gnosis/chiado/api-docs + # https://blockscout.chiadochain.net + url="https://blockscout.com/gnosis/chiado" + apiKey="" + ;; +arbitrum) + url="https://api.arbiscan.io" + apiKey="$ARBISCAN_API_KEY" + ;; +arbitrumGoerli) + url="https://api-goerli.arbiscan.io" + apiKey="$ARBISCAN_API_KEY" + ;; +mainnet) + url="https://api.etherscan.io" + apiKey="$ETHERSCAN_API_KEY" + ;; +goerli) + url="https://api-goerli.etherscan.io" + apiKey="$ETHERSCAN_API_KEY" + ;; +*) + echo "error: unknown network $network" + exit 1 +esac + +query="$url/api?module=contract&action=getabi&address=$address" +if [[ -n $apiKey ]] +then + query="$query&apikey=$apiKey" +fi + +result=$(curl -s "$query") +if [[ $(echo "$result" | jq -r .status) == 0 ]] +then + echo "error: contract not verified or does not exist" + abi="[]" +else + abi=$(echo "$result" | jq -r .result) +fi + +jq \ + --arg address "$address" \ + --argjson abi "$abi" \ + '{ "address": $address, "abi": $abi }' <<< '{}' + + diff --git a/contracts/scripts/generateDeploymentsMarkdown.sh b/contracts/scripts/generateDeploymentsMarkdown.sh index 0d673eb95..d7fae73a9 100755 --- a/contracts/scripts/generateDeploymentsMarkdown.sh +++ b/contracts/scripts/generateDeploymentsMarkdown.sh @@ -10,7 +10,12 @@ function generate() { #deploymentDir #explorerUrl address=$(cat $f | jq -r .address) echo "- [$contractName]($explorerUrl$address)" done +} +echo "#### Chiado" +echo +generate "$SCRIPT_DIR/../deployments/chiado" "https://blockscout.com/gnosis/chiado/address/" +echo echo "#### Goerli" echo echo "- [PNK](https://goerli.etherscan.io/token/0xA3B02bA6E10F55fb177637917B1b472da0110CcC)" @@ -19,5 +24,4 @@ echo echo "#### Arbitrum Goerli" echo echo "- [PNK](https://goerli.arbiscan.io/token/0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610/token-transfers)" -generate "$SCRIPT_DIR/../deployments/arbitrumGoerli" "https://goerli.arbiscan.io/address/" -echo \ No newline at end of file +generate "$SCRIPT_DIR/../deployments/arbitrumGoerli" "https://goerli.arbiscan.io/address/" \ No newline at end of file diff --git a/contracts/scripts/getCourtsV1.ts b/contracts/scripts/getCourtsV1.ts index 93056fdfa..389ba4ef6 100644 --- a/contracts/scripts/getCourtsV1.ts +++ b/contracts/scripts/getCourtsV1.ts @@ -1,6 +1,6 @@ -import { BigNumber } from "ethers"; import { ethers } from "hardhat"; import { IKlerosLiquid } from "../typechain-types"; +import hre = require("hardhat"); interface Court { id: number; @@ -13,14 +13,36 @@ interface Court { timesPerPeriod: number[]; } +interface Config { + courtAddress: string; + maxCourts: number; +} + +const configByChain = new Map([ + [ + 1, // mainnet + { + courtAddress: "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069", + maxCourts: 24, + }, + ], + [ + 100, // gnosis + { + courtAddress: "0x9C1dA9A04925bDfDedf0f6421bC7EEa8305F9002", + maxCourts: 15, + }, + ], +]); + async function main() { - const courtsV1 = (await ethers.getContractAt( - "IKlerosLiquid", - "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069" - )) as IKlerosLiquid; + const chainId = Number(await hre.getChainId()); + const courtAddress = configByChain.get(chainId)?.courtAddress ?? hre.ethers.constants.AddressZero; + const courtsV1 = (await ethers.getContractAt("IKlerosLiquid", courtAddress)) as IKlerosLiquid; const courts: Court[] = []; - for (let courtId = 0; courtId < 24; ++courtId) { + const maxCourts = configByChain.get(chainId)?.maxCourts ?? 0; + for (let courtId = 0; courtId < maxCourts; ++courtId) { const court: Court = await courtsV1.courts(courtId).then( (result) => ({ diff --git a/contracts/scripts/getPoliciesV1.ts b/contracts/scripts/getPoliciesV1.ts index 9b881629d..526a07207 100644 --- a/contracts/scripts/getPoliciesV1.ts +++ b/contracts/scripts/getPoliciesV1.ts @@ -1,5 +1,6 @@ import { ethers } from "hardhat"; import fetch from "node-fetch"; +import hre = require("hardhat"); interface Policy { court: number; @@ -10,8 +11,15 @@ interface Policy { requiredSkills: string; } +const policyRegistryByChain = new Map([ + [1, "0xCf1f07713d5193FaE5c1653C9f61953D048BECe4"], // mainnet + [100, "0x9d494768936b6bDaabc46733b8D53A937A6c6D7e"], // gnosis +]); + async function main() { - const policyRegistryV1 = await ethers.getContractAt("PolicyRegistry", "0xCf1f07713d5193FaE5c1653C9f61953D048BECe4"); + const chainId = Number(await hre.getChainId()); + const policyRegistryAddress = policyRegistryByChain.get(chainId) ?? hre.ethers.constants.AddressZero; + const policyRegistryV1 = await ethers.getContractAt("PolicyRegistry", policyRegistryAddress); const fetchPolicy = (url: string): Promise => { return fetch(url).then((response) => response.json()); diff --git a/contracts/scripts/populateCourts.ts b/contracts/scripts/populateCourts.ts index ab97c4c2e..1d9d97525 100644 --- a/contracts/scripts/populateCourts.ts +++ b/contracts/scripts/populateCourts.ts @@ -1,7 +1,8 @@ import { deployments, getNamedAccounts, getChainId, ethers } from "hardhat"; import { KlerosCore } from "../typechain-types"; import { BigNumber } from "ethers"; -import courtsV1 from "../courts.v1.json"; +import courtsV1Mainnet from "../config/courts.v1.mainnet.json"; +import courtsV1GnosisChain from "../config/courts.v1.gnosischain.json"; enum HomeChains { ARBITRUM_ONE = 42161, @@ -10,8 +11,11 @@ enum HomeChains { HARDHAT = 31337, } +const TESTING_PARAMETERS = true; +const FROM_GNOSIS = true; +const ETH_USD = BigNumber.from(1500); const DISPUTE_KIT_CLASSIC = BigNumber.from(1); -const TESTING_PARAMETERS = false; +const TEN_THOUSAND_GWEI = BigNumber.from(10).pow(13); async function main() { // fallback to hardhat node signers on local network @@ -25,15 +29,31 @@ async function main() { console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); } + const truncateWei = (x: BigNumber) => x.div(TEN_THOUSAND_GWEI).mul(TEN_THOUSAND_GWEI); + + const parametersUsdToEth = (court) => ({ + ...court, + minStake: truncateWei(BigNumber.from(court.minStake).div(ETH_USD)), + feeForJuror: truncateWei(BigNumber.from(court.feeForJuror).div(ETH_USD)), + }); + + const parametersProductionToTesting = (court) => ({ + ...court, + minStake: truncateWei(BigNumber.from(court.minStake).div(10000)), + feeForJuror: truncateWei(ethers.utils.parseEther("0.00001")), + timesPerPeriod: [120, 120, 120, 120], + }); + // WARNING: skip the Forking court at id 0, so the v1 courts are shifted by 1 - const courtsV2 = courtsV1.map((court) => ({ + const parametersV1ToV2 = (court) => ({ ...court, id: BigNumber.from(court.id).add(1), parent: BigNumber.from(court.parent).add(1), - minStake: TESTING_PARAMETERS ? BigNumber.from(court.minStake).div(100) : court.minStake, - feeForJuror: TESTING_PARAMETERS ? ethers.utils.parseEther("0.001") : court.feeForJuror, - timesPerPeriod: TESTING_PARAMETERS ? [120, 120, 120, 120] : court.timesPerPeriod, - })); + }); + + let courtsV1 = FROM_GNOSIS ? courtsV1GnosisChain.map(parametersUsdToEth) : courtsV1Mainnet; + courtsV1 = TESTING_PARAMETERS ? courtsV1.map(parametersProductionToTesting) : courtsV1; + const courtsV2 = courtsV1.map(parametersV1ToV2); console.log("courtsV2 = %O", courtsV2); diff --git a/contracts/scripts/populatePolicyRegistry.ts b/contracts/scripts/populatePolicyRegistry.ts index fc6a012ff..dda428032 100644 --- a/contracts/scripts/populatePolicyRegistry.ts +++ b/contracts/scripts/populatePolicyRegistry.ts @@ -1,6 +1,7 @@ import { deployments, getNamedAccounts, getChainId, ethers } from "hardhat"; import { PolicyRegistry } from "../typechain-types"; -import policiesV1 from "../policies.v1.json"; +import policiesV1Mainnet from "../config/policies.v1.mainnet.json"; +import policiesV1GnosisChain from "../config/policies.v1.gnosischain.json"; enum HomeChains { ARBITRUM_ONE = 42161, @@ -9,6 +10,8 @@ enum HomeChains { HARDHAT = 31337, } +const FROM_GNOSIS = true; + async function main() { // fallback to hardhat node signers on local network const deployer = (await getNamedAccounts()).deployer ?? (await ethers.getSigners())[0].address; @@ -21,6 +24,13 @@ async function main() { console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); } + const policiesV1 = FROM_GNOSIS + ? policiesV1GnosisChain.map((policy) => ({ + ...policy, + name: policy.name.replace("xDai ", ""), + })) + : policiesV1Mainnet; + // WARNING: skip the Forking court at id 0, so the v1 courts are shifted by 1 const policiesV2 = policiesV1.map((policy) => ({ ...policy, court: policy.court + 1 })); diff --git a/contracts/src/arbitration/IArbitrator.sol b/contracts/src/arbitration/IArbitrator.sol index 6d4e3953a..cc8abd1d9 100644 --- a/contracts/src/arbitration/IArbitrator.sol +++ b/contracts/src/arbitration/IArbitrator.sol @@ -21,6 +21,14 @@ interface IArbitrator { */ event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable); + /** + * @dev To be raised when a ruling is given. + * @param _arbitrable The arbitrable receiving the ruling. + * @param _disputeID ID of the dispute in the Arbitrator contract. + * @param _ruling The ruling which was given. + */ + event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling); + /** * @dev Create a dispute. Must be called by the arbitrable contract. * Must pay at least arbitrationCost(_extraData). diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 747235db4..1bd92eb5c 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -13,7 +13,7 @@ pragma solidity ^0.8; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IArbitrator.sol"; import "./IDisputeKit.sol"; -import {SortitionSumTreeFactory} from "../data-structures/SortitionSumTreeFactory.sol"; +import {SortitionSumTreeFactoryV2} from "../libraries/SortitionSumTreeFactoryV2.sol"; /** * @title KlerosCore @@ -21,7 +21,7 @@ import {SortitionSumTreeFactory} from "../data-structures/SortitionSumTreeFactor * Note that this contract trusts the token and the dispute kit contracts. */ contract KlerosCore is IArbitrator { - using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees; // Use library functions for sortition sum trees. + using SortitionSumTreeFactoryV2 for SortitionSumTreeFactoryV2.SortitionSumTrees; // Use library functions for sortition sum trees. // ************************************* // // * Enums / Structs * // @@ -120,7 +120,7 @@ contract KlerosCore is IArbitrator { uint256[] public disputesKitIDsThatNeedFreezing; // The disputeKitIDs that need switching to Freezing phase. Dispute[] public disputes; // The disputes. mapping(address => Juror) internal jurors; // The jurors. - SortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees. + SortitionSumTreeFactoryV2.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees. mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking. uint256 public delayedStakeWriteIndex; // The index of the last `delayedStake` item that was written to the array. 0 index is skipped. @@ -866,6 +866,7 @@ contract KlerosCore is IArbitrator { (uint256 winningChoice, , ) = currentRuling(_disputeID); dispute.ruled = true; + emit Ruling(dispute.arbitrated, _disputeID, winningChoice); dispute.arbitrated.rule(_disputeID, winningChoice); } @@ -1002,7 +1003,7 @@ contract KlerosCore is IArbitrator { bytes32 _key, uint256 _nodeIndex ) public view returns (uint256 K, uint256 length, bytes32 ID) { - SortitionSumTreeFactory.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key]; + SortitionSumTreeFactoryV2.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key]; K = tree.K; length = tree.nodes.length; ID = tree.nodeIndexesToIDs[_nodeIndex]; diff --git a/contracts/src/arbitration/arbitrables/ArbitrableExample.sol b/contracts/src/arbitration/arbitrables/ArbitrableExample.sol index 4b0925f26..c25e7f296 100644 --- a/contracts/src/arbitration/arbitrables/ArbitrableExample.sol +++ b/contracts/src/arbitration/arbitrables/ArbitrableExample.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "../IArbitrable.sol"; import "../../evidence/IMetaEvidence.sol"; @@ -16,44 +17,51 @@ contract ArbitrableExample is IArbitrable, IMetaEvidence { uint256 numberOfRulingOptions; // The number of choices the arbitrator can give. } - uint256 META_EVIDENCE_ID = 0; - address public governor; - IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed. + address public immutable governor; + IArbitrator public arbitrator; // Arbitrator is set in constructor and never changed. + ERC20 public immutable weth; // The WETH token. mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs. DisputeStruct[] public disputes; // Stores the disputes' info. disputes[disputeID]. /** @dev Constructor * @param _arbitrator The arbitrator to rule on created disputes. + * @param _metaEvidenceID Unique identifier of meta-evidence. * @param _metaEvidence The URI of the meta evidence object for evidence submissions requests. */ - constructor(IArbitrator _arbitrator, string memory _metaEvidence) { + constructor(IArbitrator _arbitrator, uint256 _metaEvidenceID, string memory _metaEvidence, ERC20 _weth) { governor = msg.sender; arbitrator = _arbitrator; - emit MetaEvidence(META_EVIDENCE_ID, _metaEvidence); + weth = _weth; + emit MetaEvidence(_metaEvidenceID, _metaEvidence); } /** @dev TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract. * @param _numberOfRulingOptions Number of ruling options. Must be greater than 1, otherwise there is nothing to choose from. * @param _arbitratorExtraData Extra data for the arbitrator. + * @param _metaEvidenceID Unique identifier of meta-evidence. * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute. + * @param _feeInWeth Amount of fees in WETH for the arbitrator. * @return disputeID Dispute id (on arbitrator side) of the dispute created. */ function createDispute( uint256 _numberOfRulingOptions, bytes calldata _arbitratorExtraData, - uint256 _evidenceGroupID + uint256 _metaEvidenceID, + uint256 _evidenceGroupID, + uint256 _feeInWeth ) external payable returns (uint256 disputeID) { require(_numberOfRulingOptions > 1, "Incorrect number of choices"); uint256 localDisputeID = disputes.length; disputes.push(DisputeStruct({isRuled: false, ruling: 0, numberOfRulingOptions: _numberOfRulingOptions})); - disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData); - + require(weth.transferFrom(msg.sender, address(this), _feeInWeth), "Not enough WETH for arbitration"); + weth.increaseAllowance(address(arbitrator), _feeInWeth); + disputeID = arbitrator.createDispute(_numberOfRulingOptions, _arbitratorExtraData); externalIDtoLocalID[disputeID] = localDisputeID; - emit Dispute(arbitrator, disputeID, META_EVIDENCE_ID, _evidenceGroupID); + emit Dispute(arbitrator, disputeID, _metaEvidenceID, _evidenceGroupID); } /** @dev To be called by the arbitrator of the dispute, to declare the winning ruling. @@ -73,8 +81,13 @@ contract ArbitrableExample is IArbitrable, IMetaEvidence { emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling); } - function changedMetaEvidence(string memory _metaEvidence) external { + function changeMetaEvidence(uint256 _metaEvidenceID, string memory _metaEvidence) external { require(msg.sender == governor, "Not authorized: governor only."); - emit MetaEvidence(++META_EVIDENCE_ID, _metaEvidence); + emit MetaEvidence(_metaEvidenceID, _metaEvidence); + } + + function changeArbitrator(IArbitrator _arbitrator) external { + require(msg.sender == governor, "Not authorized: governor only."); + arbitrator = _arbitrator; } } diff --git a/contracts/src/arbitration/arbitrables/ArbitrableExampleEthFee.sol b/contracts/src/arbitration/arbitrables/ArbitrableExampleEthFee.sol new file mode 100644 index 000000000..01a1af5d7 --- /dev/null +++ b/contracts/src/arbitration/arbitrables/ArbitrableExampleEthFee.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "../IArbitrable.sol"; +import "../../evidence/IMetaEvidence.sol"; + +/** + * @title ArbitrableExampleEthFee + * An example of an arbitrable contract which connects to the arbitator that implements the updated interface. + */ +contract ArbitrableExampleEthFee is IArbitrable, IMetaEvidence { + struct DisputeStruct { + bool isRuled; // Whether the dispute has been ruled or not. + uint256 ruling; // Ruling given by the arbitrator. + uint256 numberOfRulingOptions; // The number of choices the arbitrator can give. + } + + uint256 META_EVIDENCE_ID = 0; + address public governor; + IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed. + mapping(uint256 => uint256) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs. + DisputeStruct[] public disputes; // Stores the disputes' info. disputes[disputeID]. + + /** @dev Constructor + * @param _arbitrator The arbitrator to rule on created disputes. + * @param _metaEvidence The URI of the meta evidence object for evidence submissions requests. + */ + constructor(IArbitrator _arbitrator, string memory _metaEvidence) { + governor = msg.sender; + arbitrator = _arbitrator; + emit MetaEvidence(META_EVIDENCE_ID, _metaEvidence); + } + + /** @dev TRUSTED. Calls createDispute function of the specified arbitrator to create a dispute. + Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract. + * @param _numberOfRulingOptions Number of ruling options. Must be greater than 1, otherwise there is nothing to choose from. + * @param _arbitratorExtraData Extra data for the arbitrator. + * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute. + * @return disputeID Dispute id (on arbitrator side) of the dispute created. + */ + function createDispute( + uint256 _numberOfRulingOptions, + bytes calldata _arbitratorExtraData, + uint256 _evidenceGroupID + ) external payable returns (uint256 disputeID) { + require(_numberOfRulingOptions > 1, "Incorrect number of choices"); + + uint256 localDisputeID = disputes.length; + disputes.push(DisputeStruct({isRuled: false, ruling: 0, numberOfRulingOptions: _numberOfRulingOptions})); + + disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData); + + externalIDtoLocalID[disputeID] = localDisputeID; + + emit Dispute(arbitrator, disputeID, META_EVIDENCE_ID, _evidenceGroupID); + } + + /** @dev To be called by the arbitrator of the dispute, to declare the winning ruling. + * @param _externalDisputeID ID of the dispute in arbitrator contract. + * @param _ruling The ruling choice of the arbitration. + */ + function rule(uint256 _externalDisputeID, uint256 _ruling) external override { + uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID]; + DisputeStruct storage dispute = disputes[localDisputeID]; + require(msg.sender == address(arbitrator), "Only the arbitrator can execute this."); + require(_ruling <= dispute.numberOfRulingOptions, "Invalid ruling."); + require(dispute.isRuled == false, "This dispute has been ruled already."); + + dispute.isRuled = true; + dispute.ruling = _ruling; + + emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling); + } + + function changeMetaEvidence(string memory _metaEvidence) external { + require(msg.sender == governor, "Not authorized: governor only."); + emit MetaEvidence(++META_EVIDENCE_ID, _metaEvidence); + } +} diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol index 5cd3b055a..e7c54a3bf 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol @@ -482,7 +482,7 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. */ function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external { - emit Evidence(core, _evidenceGroupID, msg.sender, _evidence); + emit Evidence(_evidenceGroupID, msg.sender, _evidence); } // ************************************* // diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol index 0e1d37524..e2e447b92 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol @@ -508,7 +508,7 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. */ function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external { - emit Evidence(core, _evidenceGroupID, msg.sender, _evidence); + emit Evidence(_evidenceGroupID, msg.sender, _evidence); } // ************************************* // diff --git a/contracts/src/evidence/EvidenceModule.sol b/contracts/src/evidence/EvidenceModule.sol index 358405065..9858ac37f 100644 --- a/contracts/src/evidence/EvidenceModule.sol +++ b/contracts/src/evidence/EvidenceModule.sol @@ -16,12 +16,18 @@ pragma solidity ^0.8; // TODO: standard interfaces should be placed in a separated repo (?) -import "./IEvidence.sol"; import "../arbitration/IArbitrator.sol"; -contract EvidenceModule is IEvidence { +contract EvidenceModule { IArbitrator public arbitrator; + event Evidence( + IArbitrator indexed _arbitrator, + uint256 indexed _evidenceGroupID, + address indexed _party, + string _evidence + ); + constructor(IArbitrator _arbitrator) { arbitrator = _arbitrator; } diff --git a/contracts/src/evidence/IEvidence.sol b/contracts/src/evidence/IEvidence.sol index 7079556b6..f02494a49 100644 --- a/contracts/src/evidence/IEvidence.sol +++ b/contracts/src/evidence/IEvidence.sol @@ -5,20 +5,13 @@ pragma solidity ^0.8.0; import "../arbitration/IArbitrator.sol"; /** @title IEvidence - * ERC-1497: Evidence Standard */ interface IEvidence { /** * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations). - * @param _arbitrator The arbitrator of the contract. * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. * @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party. * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json' */ - event Evidence( - IArbitrator indexed _arbitrator, - uint256 indexed _evidenceGroupID, - address indexed _party, - string _evidence - ); + event Evidence(uint256 indexed _evidenceGroupID, address indexed _party, string _evidence); } diff --git a/contracts/src/evidence/IMetaEvidence.sol b/contracts/src/evidence/IMetaEvidence.sol index 44a707d06..7641bb2fc 100644 --- a/contracts/src/evidence/IMetaEvidence.sol +++ b/contracts/src/evidence/IMetaEvidence.sol @@ -3,12 +3,11 @@ pragma solidity ^0.8.0; import "../arbitration/IArbitrator.sol"; -import "./IEvidence.sol"; -/** @title IEvidence - * ERC-1497: Evidence Standard +/** @title IMetaEvidence + * ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator. */ -interface IMetaEvidence is IEvidence { +interface IMetaEvidence { /** * @dev To be emitted when meta-evidence is submitted. * @param _metaEvidenceID Unique identifier of meta-evidence. diff --git a/contracts/src/evidence/ModeratedEvidenceModule.sol b/contracts/src/evidence/ModeratedEvidenceModule.sol index 0340b9c23..5e389991e 100644 --- a/contracts/src/evidence/ModeratedEvidenceModule.sol +++ b/contracts/src/evidence/ModeratedEvidenceModule.sol @@ -81,6 +81,20 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence { /* Events */ + /** + * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations). + * @param _arbitrator The arbitrator of the contract. + * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. + * @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party. + * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json' + */ + event Evidence( + IArbitrator indexed _arbitrator, + uint256 indexed _evidenceGroupID, + address indexed _party, + string _evidence + ); + /** @dev Indicate that a party has to pay a fee or would otherwise be considered as losing. * @param _evidenceID The ID of the evidence being moderated. * @param _currentWinner The party who is currently winning. @@ -314,11 +328,10 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence { * @return taken The amount of ETH taken. * @return remainder The amount of ETH left from the contribution. */ - function calculateContribution(uint256 _available, uint256 _requiredAmount) - internal - pure - returns (uint256 taken, uint256 remainder) - { + function calculateContribution( + uint256 _available, + uint256 _requiredAmount + ) internal pure returns (uint256 taken, uint256 remainder) { if (_requiredAmount > _available) return (_available, 0); // Take whatever is available, return 0 as leftover ETH. remainder = _available - _requiredAmount; @@ -420,15 +433,10 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence { * @param _moderationID The ID of the moderation occurence. * @return paidFees currentWinner feeRewards The moderation information. */ - function getModerationInfo(bytes32 _evidenceID, uint256 _moderationID) - external - view - returns ( - uint256[3] memory paidFees, - Party currentWinner, - uint256 feeRewards - ) - { + function getModerationInfo( + bytes32 _evidenceID, + uint256 _moderationID + ) external view returns (uint256[3] memory paidFees, Party currentWinner, uint256 feeRewards) { EvidenceData storage evidenceData = evidences[_evidenceID]; Moderation storage moderation = evidenceData.moderations[_moderationID]; return (moderation.paidFees, moderation.currentWinner, moderation.feeRewards); diff --git a/contracts/src/gateway/ForeignGateway.sol b/contracts/src/gateway/ForeignGateway.sol index 6aaa93145..66c2e850f 100644 --- a/contracts/src/gateway/ForeignGateway.sol +++ b/contracts/src/gateway/ForeignGateway.sol @@ -155,6 +155,14 @@ contract ForeignGateway is IForeignGateway { emit DisputeCreation(disputeID, IArbitrable(msg.sender)); } + function createDisputeERC20( + uint256 /*_choices*/, + bytes calldata /*_extraData*/, + uint256 /*_amount*/ + ) external override returns (uint256 /*disputeID*/) { + revert("Not supported yet"); + } + function arbitrationCost(bytes calldata _extraData) public view override returns (uint256 cost) { (uint96 courtID, uint256 minJurors) = extraDataToCourtIDMinJurors(_extraData); cost = feeForJuror[courtID] * minJurors; diff --git a/contracts/src/gateway/ForeignGatewayOnGnosis.sol b/contracts/src/gateway/ForeignGatewayOnGnosis.sol new file mode 100644 index 000000000..8d413edae --- /dev/null +++ b/contracts/src/gateway/ForeignGatewayOnGnosis.sol @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: MIT + +/** + * @authors: [@jaybuidl, @shotaronowhere, @shalzz, @unknownunknown1] + * @reviewers: [] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ + +pragma solidity ^0.8.0; + +import "../arbitration/IArbitrable.sol"; +import "./interfaces/IForeignGateway.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +/** + * Foreign Gateway + * Counterpart of `HomeGateway` + */ +contract ForeignGatewayOnGnosis is IForeignGateway { + // ************************************* // + // * Enums / Structs * // + // ************************************* // + + struct DisputeData { + uint248 id; + bool ruled; + address arbitrable; + uint256 paid; + address relayer; + } + + // ************************************* // + // * Events * // + // ************************************* // + + event OutgoingDispute( + bytes32 disputeHash, + bytes32 blockhash, + uint256 localDisputeID, + uint256 _choices, + bytes _extraData, + address arbitrable + ); + + event ArbitrationCostModified(uint96 indexed _courtID, uint256 _feeForJuror); + + // ************************************* // + // * Storage * // + // ************************************* // + + uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute. + uint256 public immutable override senderChainID; + address public immutable override senderGateway; + IERC20 public immutable weth; // WETH token on xDai. + uint256 internal localDisputeID = 1; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero. + mapping(uint96 => uint256) public feeForJuror; // feeForJuror[courtID], it mirrors the value on KlerosCore. + address public governor; + IFastBridgeReceiver public fastBridgeReceiver; + IFastBridgeReceiver public depreciatedFastbridge; + uint256 public depreciatedFastBridgeExpiration; + mapping(bytes32 => DisputeData) public disputeHashtoDisputeData; + + // ************************************* // + // * Function Modifiers * // + // ************************************* // + + modifier onlyFromFastBridge() { + require( + address(fastBridgeReceiver) == msg.sender || + ((block.timestamp < depreciatedFastBridgeExpiration) && address(depreciatedFastbridge) == msg.sender), + "Access not allowed: Fast Bridge only." + ); + _; + } + + modifier onlyByGovernor() { + require(governor == msg.sender, "Access not allowed: Governor only."); + _; + } + + constructor( + address _governor, + IFastBridgeReceiver _fastBridgeReceiver, + address _senderGateway, + uint256 _senderChainID, + IERC20 _weth + ) { + governor = _governor; + fastBridgeReceiver = _fastBridgeReceiver; + senderGateway = _senderGateway; + senderChainID = _senderChainID; + weth = _weth; + } + + // ************************************* // + // * Governance * // + // ************************************* // + + /** + * @dev Changes the fastBridge, useful to increase the claim deposit. + * @param _fastBridgeReceiver The address of the new fastBridge. + * @param _gracePeriod The duration to accept messages from the deprecated bridge (if at all). + */ + function changeFastbridge(IFastBridgeReceiver _fastBridgeReceiver, uint256 _gracePeriod) external onlyByGovernor { + // grace period to relay remaining messages in the relay / bridging process + depreciatedFastBridgeExpiration = block.timestamp + _fastBridgeReceiver.epochPeriod() + _gracePeriod; // 2 weeks + depreciatedFastbridge = fastBridgeReceiver; + fastBridgeReceiver = _fastBridgeReceiver; + } + + /** + * @dev Changes the `feeForJuror` property value of a specified court. + * @param _courtID The ID of the court. + * @param _feeForJuror The new value for the `feeForJuror` property value. + */ + function changeCourtJurorFee(uint96 _courtID, uint256 _feeForJuror) external onlyByGovernor { + feeForJuror[_courtID] = _feeForJuror; + emit ArbitrationCostModified(_courtID, _feeForJuror); + } + + // ************************************* // + // * State Modifiers * // + // ************************************* // + + function createDispute( + uint256 /*_choices*/, + bytes calldata /*_extraData*/ + ) external payable override returns (uint256 disputeID) { + revert("Fees should be paid in WETH"); + } + + function createDisputeERC20( + uint256 _choices, + bytes calldata _extraData, + uint256 _amount + ) external override returns (uint256 disputeID) { + // This check is duplicated in xKlerosLiquid and transferred is done there as well. + require(_amount >= arbitrationCost(_extraData), "Not paid enough for arbitration"); + + disputeID = localDisputeID++; + uint256 chainID; + assembly { + chainID := chainid() + } + bytes32 disputeHash = keccak256( + abi.encodePacked( + chainID, + blockhash(block.number - 1), + "createDispute", + disputeID, + _choices, + _extraData, + msg.sender + ) + ); + + disputeHashtoDisputeData[disputeHash] = DisputeData({ + id: uint248(disputeID), + arbitrable: msg.sender, + paid: _amount, + relayer: address(0), + ruled: false + }); + + emit OutgoingDispute(disputeHash, blockhash(block.number - 1), disputeID, _choices, _extraData, msg.sender); + emit DisputeCreation(disputeID, IArbitrable(msg.sender)); + } + + function arbitrationCost(bytes calldata _extraData) public view override returns (uint256 cost) { + (uint96 courtID, uint256 minJurors) = extraDataToCourtIDMinJurors(_extraData); + cost = feeForJuror[courtID] * minJurors; + } + + /** + * Relay the rule call from the home gateway to the arbitrable. + */ + function relayRule( + address _messageSender, + bytes32 _disputeHash, + uint256 _ruling, + address _relayer + ) external override onlyFromFastBridge { + require(_messageSender == senderGateway, "Only the homegateway is allowed."); + DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash]; + + require(dispute.id != 0, "Dispute does not exist"); + require(!dispute.ruled, "Cannot rule twice"); + + dispute.ruled = true; + dispute.relayer = _relayer; + + IArbitrable arbitrable = IArbitrable(dispute.arbitrable); + arbitrable.rule(dispute.id, _ruling); + } + + function withdrawFees(bytes32 _disputeHash) external override { + DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash]; + require(dispute.id != 0, "Dispute does not exist"); + require(dispute.ruled, "Not ruled yet"); + + uint256 amount = dispute.paid; + dispute.paid = 0; + weth.transfer(dispute.relayer, amount); + } + + // ************************************* // + // * Public Views * // + // ************************************* // + + function disputeHashToForeignID(bytes32 _disputeHash) external view override returns (uint256) { + return disputeHashtoDisputeData[_disputeHash].id; + } + + // ************************ // + // * Internal * // + // ************************ // + + function extraDataToCourtIDMinJurors( + bytes memory _extraData + ) internal view returns (uint96 courtID, uint256 minJurors) { + // Note that here we ignore DisputeKitID + if (_extraData.length >= 64) { + assembly { + // solium-disable-line security/no-inline-assembly + courtID := mload(add(_extraData, 0x20)) + minJurors := mload(add(_extraData, 0x40)) + } + if (feeForJuror[courtID] == 0) courtID = 0; + if (minJurors == 0) minJurors = MIN_JURORS; + } else { + courtID = 0; + minJurors = MIN_JURORS; + } + } +} diff --git a/contracts/src/gateway/interfaces/IForeignGateway.sol b/contracts/src/gateway/interfaces/IForeignGateway.sol index 6a26e65fc..a73a95750 100644 --- a/contracts/src/gateway/interfaces/IForeignGateway.sol +++ b/contracts/src/gateway/interfaces/IForeignGateway.sol @@ -17,15 +17,16 @@ interface IForeignGateway is IArbitrator, IReceiverGateway { /** * Relay the rule call from the home gateway to the arbitrable. */ - function relayRule( - address _messageSender, - bytes32 _disputeHash, - uint256 _ruling, - address _forwarder - ) external; + function relayRule(address _messageSender, bytes32 _disputeHash, uint256 _ruling, address _forwarder) external; function withdrawFees(bytes32 _disputeHash) external; // For cross-chain Evidence standard function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256); + + function createDisputeERC20( + uint256 _choices, + bytes calldata _extraData, + uint256 _amount + ) external returns (uint256 disputeID); } diff --git a/contracts/src/kleros-v1/ITokenController.sol b/contracts/src/kleros-v1/ITokenController.sol deleted file mode 100644 index c837a9c99..000000000 --- a/contracts/src/kleros-v1/ITokenController.sol +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8; - -/// @dev The token controller contract must implement these functions. See https://github.com/Giveth/minime/blob/master/contracts/TokenController.sol -interface ITokenController { - /// @notice Called when `_owner` sends ether to the MiniMe Token contract - /// @param _owner The address that sent the ether to create tokens - /// @return True if the ether is accepted, false if it throws - function proxyPayment(address _owner) external payable returns (bool); - - /// @notice Notifies the controller about a token transfer allowing the - /// controller to react if desired - /// @param _from The origin of the transfer - /// @param _to The destination of the transfer - /// @param _amount The amount of the transfer - /// @return False if the controller does not authorize the transfer - function onTransfer( - address _from, - address _to, - uint256 _amount - ) external returns (bool); - - /// @notice Notifies the controller about an approval allowing the - /// controller to react if desired - /// @param _owner The address that calls `approve()` - /// @param _spender The spender in the `approve()` call - /// @param _amount The amount in the `approve()` call - /// @return False if the controller does not authorize the approval - function onApprove( - address _owner, - address _spender, - uint256 _amount - ) external returns (bool); -} diff --git a/contracts/src/kleros-v1/interfaces/IArbitrableV1.sol b/contracts/src/kleros-v1/interfaces/IArbitrableV1.sol new file mode 100644 index 000000000..fa64ffb1a --- /dev/null +++ b/contracts/src/kleros-v1/interfaces/IArbitrableV1.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT + +/** + * @authors: [@ferittuncer, @hbarcelos, @clesaege] + * @reviewers: [@remedcu] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ +pragma solidity ^0.8; + +import "./IArbitratorV1.sol"; + +/** + * @title IArbitrable + * Arbitrable interface compliant with ERC-792. + * When developing arbitrable contracts, we need to: + * - Define the action taken when a ruling is received by the contract. + * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData); + */ +interface IArbitrableV1 { + /** + * @dev To be raised when a ruling is given. + * @param _arbitrator The arbitrator giving the ruling. + * @param _disputeID ID of the dispute in the Arbitrator contract. + * @param _ruling The ruling which was given. + */ + event Ruling(IArbitratorV1 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling); + + /** + * @dev Give a ruling for a dispute. Must be called by the arbitrator. + * The purpose of this function is to ensure that the address calling it has the right to rule on the contract. + * @param _disputeID ID of the dispute in the Arbitrator contract. + * @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision". + */ + function rule(uint256 _disputeID, uint256 _ruling) external; +} diff --git a/contracts/src/kleros-v1/interfaces/IArbitratorV1.sol b/contracts/src/kleros-v1/interfaces/IArbitratorV1.sol new file mode 100644 index 000000000..50b2bb46d --- /dev/null +++ b/contracts/src/kleros-v1/interfaces/IArbitratorV1.sol @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: MIT + +/** + * @authors: [@ferittuncer, @hbarcelos, @clesaege] + * @reviewers: [@remedcu] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ + +pragma solidity ^0.8.0; + +import "./IArbitrableV1.sol"; + +/** + * @title Arbitrator + * Arbitrator abstract contract compliant with ERC-792. + * When developing arbitrator contracts we need to: + * - Define the functions for dispute creation (createDispute) and appeal (appeal). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes). + * - Define the functions for cost display (arbitrationCost and appealCost). + * - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling). + */ +interface IArbitratorV1 { + enum DisputeStatus { + Waiting, + Appealable, + Solved + } + + /** + * @dev To be emitted when a dispute is created. + * @param _disputeID ID of the dispute. + * @param _arbitrable The contract which created the dispute. + */ + event DisputeCreation(uint256 indexed _disputeID, IArbitrableV1 indexed _arbitrable); + + /** + * @dev To be emitted when a dispute can be appealed. + * @param _disputeID ID of the dispute. + * @param _arbitrable The contract which created the dispute. + */ + event AppealPossible(uint256 indexed _disputeID, IArbitrableV1 indexed _arbitrable); + + /** + * @dev To be emitted when the current ruling is appealed. + * @param _disputeID ID of the dispute. + * @param _arbitrable The contract which created the dispute. + */ + event AppealDecision(uint256 indexed _disputeID, IArbitrableV1 indexed _arbitrable); + + /** + * @dev Create a dispute. Must be called by the arbitrable contract. + * Must be paid at least arbitrationCost(_extraData). + * @param _choices Amount of choices the arbitrator can make in this dispute. + * @param _extraData Can be used to give additional info on the dispute to be created. + * @return disputeID ID of the dispute created. + */ + function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID); + + /** + * @dev Compute the cost of arbitration. 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. + * @param _extraData Can be used to give additional info on the dispute to be created. + * @return cost Amount to be paid. + */ + function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost); + + /** + * @dev Appeal a ruling. Note that it has to be called before the arbitrator contract calls rule. + * @param _disputeID ID of the dispute to be appealed. + * @param _extraData Can be used to give extra info on the appeal. + */ + function appeal(uint256 _disputeID, bytes calldata _extraData) external payable; + + /** + * @dev Compute the cost of appeal. It is recommended not to increase it often, as it can be higly time and gas consuming for the arbitrated contracts to cope with fee augmentation. + * @param _disputeID ID of the dispute to be appealed. + * @param _extraData Can be used to give additional info on the dispute to be created. + * @return cost Amount to be paid. + */ + function appealCost(uint256 _disputeID, bytes calldata _extraData) external view returns (uint256 cost); + + /** + * @dev Compute the start and end of the dispute's current or next appeal period, if possible. If not known or appeal is impossible: should return (0, 0). + * @param _disputeID ID of the dispute. + * @return start The start of the period. + * @return end The end of the period. + */ + function appealPeriod(uint256 _disputeID) external view returns (uint256 start, uint256 end); + + /** + * @dev Return the status of a dispute. + * @param _disputeID ID of the dispute to rule. + * @return status The status of the dispute. + */ + function disputeStatus(uint256 _disputeID) external view returns (DisputeStatus status); + + /** + * @dev Return the current ruling of a dispute. This is useful for parties to know if they should appeal. + * @param _disputeID ID of the dispute. + * @return ruling The ruling which has been given or the one which will be given if there is no appeal. + */ + function currentRuling(uint256 _disputeID) external view returns (uint256 ruling); +} diff --git a/contracts/src/kleros-v1/IKlerosLiquid.sol b/contracts/src/kleros-v1/interfaces/IKlerosLiquid.sol similarity index 85% rename from contracts/src/kleros-v1/IKlerosLiquid.sol rename to contracts/src/kleros-v1/interfaces/IKlerosLiquid.sol index f18396839..f134b2c5f 100644 --- a/contracts/src/kleros-v1/IKlerosLiquid.sol +++ b/contracts/src/kleros-v1/interfaces/IKlerosLiquid.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8; -import "../arbitration/IArbitrator.sol"; +import "./IArbitratorV1.sol"; -interface IKlerosLiquid is IArbitrator { +interface IKlerosLiquid is IArbitratorV1 { enum Period { evidence, // Evidence can be submitted. This is also when drawing has to take place. commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes. @@ -49,7 +49,9 @@ interface IKlerosLiquid is IArbitrator { uint256 lockedTokens; // The juror's total amount of tokens locked in disputes. } - function courts(uint256 _index) + function courts( + uint256 _index + ) external view returns ( @@ -75,28 +77,18 @@ interface IKlerosLiquid is IArbitrator { function changeSubcourtTimesPerPeriod(uint96 _subcourtID, uint256[4] calldata _timesPerPeriod) external; - function executeGovernorProposal( - address _destination, - uint256 _amount, - bytes calldata _data - ) external; + function executeGovernorProposal(address _destination, uint256 _amount, bytes calldata _data) external; // Getters function getVote( uint256 _disputeID, uint256 _appeal, uint256 _voteID - ) - external - view - returns ( - address account, - bytes32 commit, - uint256 choice, - bool voted - ); + ) external view returns (address account, bytes32 commit, uint256 choice, bool voted); - function getDispute(uint256 _disputeID) + function getDispute( + uint256 _disputeID + ) external view returns ( @@ -108,8 +100,7 @@ interface IKlerosLiquid is IArbitrator { uint256[] memory penaltiesInEachRound ); - function getSubcourt(uint96 _subcourtID) - external - view - returns (uint256[] memory children, uint256[4] memory timesPerPeriod); + function getSubcourt( + uint96 _subcourtID + ) external view returns (uint256[] memory children, uint256[4] memory timesPerPeriod); } diff --git a/contracts/src/kleros-v1/interfaces/ITokenController.sol b/contracts/src/kleros-v1/interfaces/ITokenController.sol new file mode 100644 index 000000000..dc392d76c --- /dev/null +++ b/contracts/src/kleros-v1/interfaces/ITokenController.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/** + * @dev The token controller contract must implement these functions. See https://github.com/Giveth/minime/blob/master/contracts/TokenController.sol + */ +interface ITokenController { + /** + * @notice Called when `_owner` sends ether to the MiniMe Token contract + * @param _owner The address that sent the ether to create tokens + * @return True if the ether is accepted, false if it throws + */ + function proxyPayment(address _owner) external payable returns (bool); + + /** + * @notice Notifies the controller about a token transfer allowing the controller to react if desired + * @param _from The origin of the transfer + * @param _to The destination of the transfer + * @param _amount The amount of the transfer + * @return False if the controller does not authorize the transfer + */ + function onTransfer(address _from, address _to, uint256 _amount) external returns (bool); + + /** + * @notice Notifies the controller about an approval allowing the controller to react if desired + * @param _owner The address that calls `approve()` + * @param _spender The spender in the `approve()` call + * @param _amount The amount in the `approve()` call + * @return False if the controller does not authorize the approval + */ + function onApprove(address _owner, address _spender, uint256 _amount) external returns (bool); +} diff --git a/contracts/src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol b/contracts/src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol new file mode 100644 index 000000000..cca8c0432 --- /dev/null +++ b/contracts/src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol @@ -0,0 +1,320 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "../interfaces/ITokenController.sol"; +import "./interfaces/ITokenBridge.sol"; +import "./interfaces/IERC677.sol"; + +contract WrappedPinakion is Initializable { + using SafeMath for uint256; + + /* Events */ + + /** + * @notice Emitted when `value` tokens are moved from one account (`from`) to another (`to`). + * @dev Notice that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @notice Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval(address indexed owner, address indexed spender, uint256 value); + + /* Storage */ + + mapping(address => uint256) private balances; + mapping(address => mapping(address => uint256)) public allowance; + + /// @notice Total supply of the token. Equals the total xPinakion deposit into the contract. + uint256 public totalSupply; + + /// @notice Name of the token. + string public name; + + /// @notice Symbol of the token. + string public symbol; + + /// @notice Number of decimals of the token. + uint8 public decimals; + + /// @notice The token's controller. + address public controller; + + /// @notice Bridged PNK on xDai to be wrapped. This token is upgradeable. + IERC677 public xPinakion; + + /// @notice xDai Token Bridge. The Token Bridge is upgradeable. + ITokenBridge public tokenBridge; + + /* Modifiers */ + + /// @dev Verifies that the sender has ability to modify controlled parameters. + modifier onlyController() { + require(controller == msg.sender, "The caller is not the controller."); + _; + } + + /* Initializer */ + + /** + * @dev Constructor. + * @param _name for the wrapped PNK on the home chain. + * @param _symbol for wrapped PNK ticker on the home chain. + * @param _xPinakion the home PNK contract which is already bridged to the foreign PNK contract. + * @param _tokenBridge the TokenBridge contract. + */ + function initialize( + string memory _name, + string memory _symbol, + IERC677 _xPinakion, + ITokenBridge _tokenBridge + ) public initializer { + name = _name; + symbol = _symbol; + decimals = 18; + xPinakion = _xPinakion; + tokenBridge = _tokenBridge; + controller = msg.sender; + } + + /* External */ + + /** + * @notice Changes `controller` to `_controller`. + * @param _controller The new controller of the contract + */ + function changeController(address _controller) external onlyController { + controller = _controller; + } + + /** + * @notice Converts bridged PNK (xPinakion) into wrapped PNK which can be staked in KlerosLiquid. + * @param _amount The amount of wrapped pinakions to mint. + */ + function deposit(uint256 _amount) external { + _mint(msg.sender, _amount); + require( + xPinakion.transferFrom(msg.sender, address(this), _amount), + "Sender does not have enough approved funds." + ); + } + + /** + * @notice IERC20 Receiver functionality. + * @dev Converts bridged PNK (xPinakion) into wrapped PNK which can be staked in KlerosLiquid. + * If the tokenBridge is calling this function, then this contract has already received + * the xPinakion tokens. Notice that the Home bridge calls onTokenBridge as a result of + * someone invoking `relayTokensAndCall()` on the Foreign bridge contract. + * @param _token The token address the _amount belongs to. + * @param _amount The amount of wrapped PNK to mint. + * @param _data Calldata containing the address of the recipient. + * Notice that the address has to be padded to the right 32 bytes. + */ + function onTokenBridged(address _token, uint256 _amount, bytes calldata _data) external { + require(msg.sender == address(tokenBridge), "Sender not authorized."); + require(_token == address(xPinakion), "Token bridged is not xPinakion."); + + address recipient; + assembly { + recipient := calldataload(0x84) + } + _mint(recipient, _amount); + } + + /** + * @notice Converts wrapped PNK back into bridged PNK (xPinakion). + * @param _amount The amount of bridged PNK to withdraw. + */ + function withdraw(uint256 _amount) external { + _burn(_amount); + require(xPinakion.transfer(msg.sender, _amount), "The `transfer` function must not fail."); + } + + /** + * @notice Converts wrapped PNK back into PNK using the Token Bridge. + * @dev This function is not strictly needed, but it provides a good UX to users who want to get their Mainnet's PNK back. + * What normally takes 3 transactions, here is done in one go. + * Notice that the PNK have to be claimed on Mainnet's TokenBridge by the receiver. + * @param _amount The amount of PNK to withdraw. + * @param _receiver The address which will receive the PNK back in the foreign chain. + */ + function withdrawAndConvertToPNK(uint256 _amount, address _receiver) external { + _burn(_amount); + // Using approve is safe here, because this contract approves the bridge to spend the tokens and triggers the relay immediately. + xPinakion.approve(address(tokenBridge), _amount); + tokenBridge.relayTokens(xPinakion, _receiver, _amount); + } + + /** + * @notice Moves `_amount` tokens from the caller's account to `_recipient`. + * @param _recipient The entity receiving the funds. + * @param _amount The amount to tranfer in base units. + * @return True on success. + */ + function transfer(address _recipient, uint256 _amount) public returns (bool) { + if (isContract(controller)) { + require( + ITokenController(controller).onTransfer(msg.sender, _recipient, _amount), + "Token controller rejects transfer." + ); + } + balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: transfer amount exceeds balance + balances[_recipient] = balances[_recipient].add(_amount); + emit Transfer(msg.sender, _recipient, _amount); + return true; + } + + /** + * @notice Moves `_amount` tokens from `_sender` to `_recipient` using the + * allowance mechanism. `_amount` is then deducted from the caller's allowance. + * @param _sender The entity to take the funds from. + * @param _recipient The entity receiving the funds. + * @param _amount The amount to tranfer in base units. + * @return True on success. + */ + function transferFrom(address _sender, address _recipient, uint256 _amount) public returns (bool) { + if (isContract(controller)) { + require( + ITokenController(controller).onTransfer(_sender, _recipient, _amount), + "Token controller rejects transfer." + ); + } + + /** The controller of this contract can move tokens around at will, + * this is important to recognize! Confirm that you trust the + * controller of this contract, which in most situations should be + * another open source smart contract or 0x0. + */ + if (msg.sender != controller) { + allowance[_sender][msg.sender] = allowance[_sender][msg.sender].sub(_amount); // ERC20: transfer amount exceeds allowance. + } + + balances[_sender] = balances[_sender].sub(_amount); // ERC20: transfer amount exceeds balance + balances[_recipient] = balances[_recipient].add(_amount); + emit Transfer(_sender, _recipient, _amount); + return true; + } + + /** + * @notice Approves `_spender` to spend `_amount`. + * @param _spender The entity allowed to spend funds. + * @param _amount The amount of base units the entity will be allowed to spend. + * @return True on success. + */ + function approve(address _spender, uint256 _amount) public returns (bool) { + // Alerts the token controller of the approve function call + if (isContract(controller)) { + require( + ITokenController(controller).onApprove(msg.sender, _spender, _amount), + "Token controller does not approve." + ); + } + + allowance[msg.sender][_spender] = _amount; + emit Approval(msg.sender, _spender, _amount); + return true; + } + + /** + * @notice Increases the `_spender` allowance by `_addedValue`. + * @param _spender The entity allowed to spend funds. + * @param _addedValue The amount of extra base units the entity will be allowed to spend. + * @return True on success. + */ + function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) { + uint256 newAllowance = allowance[msg.sender][_spender].add(_addedValue); + // Alerts the token controller of the approve function call + if (isContract(controller)) { + require( + ITokenController(controller).onApprove(msg.sender, _spender, newAllowance), + "Token controller does not approve." + ); + } + + allowance[msg.sender][_spender] = newAllowance; + emit Approval(msg.sender, _spender, newAllowance); + return true; + } + + /** + * @notice Decreases the `_spender` allowance by `_subtractedValue`. + * @param _spender The entity whose spending allocation will be reduced. + * @param _subtractedValue The reduction of spending allocation in base units. + * @return True on success. + */ + function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) { + uint256 newAllowance = allowance[msg.sender][_spender].sub(_subtractedValue); // ERC20: decreased allowance below zero + // Alerts the token controller of the approve function call + if (isContract(controller)) { + require( + ITokenController(controller).onApprove(msg.sender, _spender, newAllowance), + "Token controller does not approve." + ); + } + + allowance[msg.sender][_spender] = newAllowance; + emit Approval(msg.sender, _spender, newAllowance); + return true; + } + + /* Internal */ + + /** + * @dev Internal function that mints an amount of the token and assigns it to + * an account. This encapsulates the modification of balances such that the + * proper events are emitted. + * @param _recipient The address which will receive the minted tokens. + * @param _amount The amount that will be created. + */ + function _mint(address _recipient, uint256 _amount) internal { + totalSupply = totalSupply.add(_amount); + balances[_recipient] = balances[_recipient].add(_amount); + emit Transfer(address(0x0), _recipient, _amount); + } + + /** + * @dev Destroys `_amount` tokens from the caller. Cannot burn locked tokens. + * @param _amount The quantity of tokens to burn in base units. + */ + function _burn(uint256 _amount) internal { + if (isContract(controller)) { + require( + ITokenController(controller).onTransfer(msg.sender, address(0x0), _amount), + "Token controller rejects transfer." + ); + } + balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: burn amount exceeds balance + totalSupply = totalSupply.sub(_amount); + emit Transfer(msg.sender, address(0x0), _amount); + } + + /** + * @dev Internal function to determine if an address is a contract. + * @param _addr The address being queried. + * @return True if `_addr` is a contract. + */ + function isContract(address _addr) internal view returns (bool) { + uint256 size; + if (_addr == address(0)) return false; + assembly { + size := extcodesize(_addr) + } + return size > 0; + } + + /* Getters */ + + /** + * @dev Gets the balance of the specified address. + * @param _owner The address to query the balance of. + * @return uint256 value representing the amount owned by the passed address. + */ + function balanceOf(address _owner) public view returns (uint256) { + return balances[_owner]; + } +} diff --git a/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IERC677.sol b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IERC677.sol new file mode 100644 index 000000000..3a3f0b0d6 --- /dev/null +++ b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IERC677.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +interface IERC677 { + function transfer(address _to, uint256 _value) external returns (bool); + + function transferFrom(address _from, address _to, uint256 _value) external returns (bool); + + function approve(address _spender, uint256 _value) external returns (bool); +} diff --git a/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IRandomAuRa.sol b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IRandomAuRa.sol new file mode 100644 index 000000000..4212e0036 --- /dev/null +++ b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/IRandomAuRa.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +interface IRandomAuRa { + function currentSeed() external view returns (uint256); + + function isCommitPhase() external view returns (bool); + + function nextCommitPhaseStartBlock() external view returns (uint256); + + function collectRoundLength() external view returns (uint256); +} diff --git a/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/ITokenBridge.sol b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/ITokenBridge.sol new file mode 100644 index 000000000..768c5f87b --- /dev/null +++ b/contracts/src/kleros-v1/kleros-liquid-xdai/interfaces/ITokenBridge.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "./IERC677.sol"; + +interface ITokenBridge { + function relayTokens(IERC677 token, address _receiver, uint256 _value) external; +} diff --git a/contracts/src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol b/contracts/src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol new file mode 100644 index 000000000..6c33b6841 --- /dev/null +++ b/contracts/src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol @@ -0,0 +1,775 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {IArbitrator, IArbitrable} from "../../arbitration/IArbitrator.sol"; +import {ITokenController} from "../interfaces/ITokenController.sol"; +import {WrappedPinakion} from "./WrappedPinakion.sol"; +import {IRandomAuRa} from "./interfaces/IRandomAuRa.sol"; + +import {SortitionSumTreeFactory} from "../../libraries/SortitionSumTreeFactory.sol"; +import "../../gateway/interfaces/IForeignGateway.sol"; + +/** + * @title xKlerosLiquidV2 + * @dev This contract is an adaption of Mainnet's KlerosLiquid (https://github.com/kleros/kleros/blob/69cfbfb2128c29f1625b3a99a3183540772fda08/contracts/kleros/KlerosLiquid.sol) + * for xDai chain. Notice that variables referring to ETH values in this contract, will hold the native token values of the chain on which xKlerosLiquid is deployed. + * When this contract gets deployed on xDai chain, ETH variables will hold xDai values. + */ +contract xKlerosLiquidV2 is Initializable, ITokenController, IArbitrator { + /* Enums */ + + // General + enum Phase { + staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors. + generating, // Waiting for a random number. Pass as soon as it is ready. + drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes. + } + + // Dispute + enum Period { + evidence, // Evidence can be submitted. This is also when drawing has to take place. + commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes. + vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not. + appeal, // The dispute can be appealed. + execution // Tokens are redistributed and the ruling is executed. + } + + /* Structs */ + + // General + struct Court { + uint96 parent; // The parent court. + uint256[] children; // List of child courts. + bool hiddenVotes; // Whether to use commit and reveal or not. + uint256 minStake; // Minimum tokens needed to stake in the court. + uint256 alpha; // Basis point of tokens that are lost when incoherent. + uint256 feeForJuror; // Arbitration fee paid per juror. + // The appeal after the one that reaches this number of jurors will go to the parent court if any, otherwise, no more appeals are possible. + uint256 jurorsForCourtJump; + uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`. + } + struct DelayedSetStake { + address account; // The address of the juror. + uint96 subcourtID; // The ID of the subcourt. + uint128 stake; // The new stake. + } + + // Dispute + struct Vote { + address account; // The address of the juror. + bytes32 commit; // The commit of the juror. For courts with hidden votes. + uint256 choice; // The choice of the juror. + bool voted; // True if the vote has been cast or revealed, false otherwise. + } + struct VoteCounter { + // 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. + uint256 winningChoice; + mapping(uint256 => uint256) counts; // The sum of votes for each choice in the form `counts[choice]`. + bool tied; // True if there is a tie, false otherwise. + } + struct Dispute { + // Note that appeal `0` is equivalent to the first round of the dispute. + uint96 subcourtID; // The ID of the subcourt the dispute is in. + IArbitrable arbitrated; // The arbitrated arbitrable contract. + // The number of choices jurors have when voting. This does not include choice `0` which is reserved for "refuse to arbitrate"/"no ruling". + uint256 numberOfChoices; + Period period; // The current period of the dispute. + uint256 lastPeriodChange; // The last time the period was changed. + // The votes in the form `votes[appeal][voteID]`. On each round, a new list is pushed and packed with as many empty votes as there are draws. We use `dispute.votes.length` to get the number of appeals plus 1 for the first round. + Vote[][] votes; + VoteCounter[] voteCounters; // The vote counters in the form `voteCounters[appeal]`. + uint256[] tokensAtStakePerJuror; // The amount of tokens at stake for each juror in the form `tokensAtStakePerJuror[appeal]`. + uint256[] totalFeesForJurors; // The total juror fees paid in the form `totalFeesForJurors[appeal]`. + uint256 drawsInRound; // A counter of draws made in the current round. + uint256 commitsInRound; // A counter of commits made in the current round. + uint256[] votesInEachRound; // A counter of votes made in each round in the form `votesInEachRound[appeal]`. + // A counter of vote reward repartitions made in each round in the form `repartitionsInEachRound[appeal]`. + uint256[] repartitionsInEachRound; + uint256[] penaltiesInEachRound; // The amount of tokens collected from penalties in each round in the form `penaltiesInEachRound[appeal]`. + bool ruled; // True if the ruling has been executed, false otherwise. + } + + // Juror + struct Juror { + // The IDs of subcourts where the juror has stake path ends. A stake path is a path from the general court to a court the juror directly staked in using `_setStake`. + uint96[] subcourtIDs; + uint256 stakedTokens; // The juror's total amount of tokens staked in subcourts. + uint256 lockedTokens; // The juror's total amount of tokens locked in disputes. + } + + /* Events */ + + /** @dev Emitted when we pass to a new phase. + * @param _phase The new phase. + */ + event NewPhase(Phase _phase); + + /** @dev Emitted when a dispute passes to a new period. + * @param _disputeID The ID of the dispute. + * @param _period The new period. + */ + event NewPeriod(uint256 indexed _disputeID, Period _period); + + /** @dev Emitted when a juror's stake is set. + * @param _address The address of the juror. + * @param _subcourtID The ID of the subcourt at the end of the stake path. + * @param _stake The new stake. + * @param _newTotalStake The new total stake. + */ + event StakeSet(address indexed _address, uint256 _subcourtID, uint128 _stake, uint256 _newTotalStake); + + /** @dev Emitted when a juror is drawn. + * @param _address The drawn address. + * @param _disputeID The ID of the dispute. + * @param _appeal The appeal the draw is for. 0 is for the first round. + * @param _voteID The vote ID. + */ + event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _appeal, uint256 _voteID); + + /** @dev Emitted when a juror wins or loses tokens and ETH from a dispute. + * @param _address The juror affected. + * @param _disputeID The ID of the dispute. + * @param _tokenAmount The amount of tokens won or lost. + * @param _ETHAmount The amount of ETH won or lost. + */ + event TokenAndETHShift(address indexed _address, uint256 indexed _disputeID, int _tokenAmount, int _ETHAmount); + + /* Storage */ + + // General Constants + uint256 public constant MAX_STAKE_PATHS = 4; // The maximum number of stake paths a juror can have. + uint256 public constant MIN_JURORS = 3; // The global default minimum number of jurors in a dispute. + uint256 public constant NON_PAYABLE_AMOUNT = (2 ** 256 - 2) / 2; // An amount higher than the supply of ETH. + uint256 public constant ALPHA_DIVISOR = 1e4; // The number to divide `Court.alpha` by. + // General Contracts + address public governor; // The governor of the contract. + WrappedPinakion public pinakion; // The Pinakion token contract. + IRandomAuRa public RNGenerator; // The random number generator contract. + // General Dynamic + Phase public phase; // The current phase. + uint256 public lastPhaseChange; // The last time the phase was changed. + uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors. + // The block number to get the next random number from. Used so there is at least a 1 block difference from the staking phase. + uint256 public RNBlock; + uint256 public RN; // The current random number. + uint256 public minStakingTime; // The minimum staking time. + uint256 public maxDrawingTime; // The maximum drawing time. + // True if insolvent (`balance < stakedTokens || balance < lockedTokens`) token transfers should be blocked. Used to avoid blocking penalties. + bool public lockInsolventTransfers; + // General Storage + Court[] public courts; // The subcourts. + using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees; // Use library functions for sortition sum trees. + SortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees; // The sortition sum trees. + // The delayed calls to `_setStake`. Used to schedule `_setStake`s when not in the staking phase. + mapping(uint256 => DelayedSetStake) public delayedSetStakes; + // The index of the next `delayedSetStakes` item to execute. Starts at 1 because `lastDelayedSetStake` starts at 0. + uint256 public nextDelayedSetStake; + uint256 public lastDelayedSetStake; // The index of the last `delayedSetStakes` item. 0 is skipped because it is the initial value. + + // Dispute + // Use a mapping instead of an array so that upgrading (appending variables to) the Dispute struct is possible without big layout changes. + mapping(uint256 => Dispute) public disputes; // The disputes. + uint256 public totalDisputes; + + // Juror + mapping(address => Juror) public jurors; // The jurors. + + IForeignGateway public foreignGateway; // Foreign gateway contract. + IERC20 public weth; // WETH token address. + + mapping(uint256 => uint256) public disputesRuling; + + /* Modifiers */ + + /** @dev Requires a specific phase. + * @param _phase The required phase. + */ + modifier onlyDuringPhase(Phase _phase) { + require(phase == _phase); + _; + } + + /** @dev Requires a specific period in a dispute. + * @param _disputeID The ID of the dispute. + * @param _period The required period. + */ + modifier onlyDuringPeriod(uint256 _disputeID, Period _period) { + require(disputes[_disputeID].period == _period); + _; + } + + /** @dev Requires that the sender is the governor. Note that the governor is expected to not be malicious. */ + modifier onlyByGovernor() { + require(governor == msg.sender); + _; + } + + /* Constructor */ + + /** @dev Constructs the KlerosLiquid contract. + * @param _governor The governor's address. + * @param _pinakion The address of the token contract. + * @param _RNGenerator The address of the random number generator contract. + * @param _minStakingTime The minimum time that the staking phase should last. + * @param _maxDrawingTime The maximum time that the drawing phase should last. + * @param _hiddenVotes The `hiddenVotes` property value of the general court. + * @param _courtParameters MinStake, alpha, feeForJuror and jurorsForCourtJump respectively. + * @param _timesPerPeriod The `timesPerPeriod` property value of the general court. + * @param _sortitionSumTreeK The number of children per node of the general court's sortition sum tree. + * @param _foreignGateway Foreign gateway on xDai. + * @param _weth Weth contract. + */ + function initialize( + address _governor, + WrappedPinakion _pinakion, + IRandomAuRa _RNGenerator, + uint256 _minStakingTime, + uint256 _maxDrawingTime, + bool _hiddenVotes, + uint256[4] memory _courtParameters, + uint256[4] memory _timesPerPeriod, + uint256 _sortitionSumTreeK, + IForeignGateway _foreignGateway, + IERC20 _weth + ) public initializer { + // Initialize contract. + governor = _governor; + pinakion = _pinakion; + RNGenerator = _RNGenerator; + minStakingTime = _minStakingTime; + maxDrawingTime = _maxDrawingTime; + phase = Phase.staking; + lastPhaseChange = block.timestamp; + lockInsolventTransfers = true; + if (nextDelayedSetStake == 0) nextDelayedSetStake = 1; + foreignGateway = _foreignGateway; + weth = _weth; + + // Create the general court. + if (courts.length == 0) { + courts.push( + Court({ + parent: 0, + children: new uint256[](0), + hiddenVotes: _hiddenVotes, + minStake: _courtParameters[0], + alpha: _courtParameters[1], + feeForJuror: _courtParameters[2], + jurorsForCourtJump: _courtParameters[3], + timesPerPeriod: _timesPerPeriod + }) + ); + sortitionSumTrees.createTree(bytes32(0), _sortitionSumTreeK); + } + } + + /* External */ + + /** @dev Lets the governor call anything on behalf of the contract. + * @param _destination The destination of the call. + * @param _amount The value sent with the call. + * @param _data The data sent with the call. + */ + function executeGovernorProposal( + address _destination, + uint256 _amount, + bytes memory _data + ) external onlyByGovernor { + (bool success, ) = _destination.call{value: _amount}(_data); + require(success, "Unsuccessful call"); + } + + /** @dev Changes the `governor` storage variable. + * @param _governor The new value for the `governor` storage variable. + */ + function changeGovernor(address _governor) external onlyByGovernor { + governor = _governor; + } + + /** @dev Changes the `pinakion` storage variable. + * @param _pinakion The new value for the `pinakion` storage variable. + */ + function changePinakion(WrappedPinakion _pinakion) external onlyByGovernor { + pinakion = _pinakion; + } + + /** @dev Changes the `RNGenerator` storage variable. + * @param _RNGenerator The new value for the `RNGenerator` storage variable. + */ + function changeRNGenerator(IRandomAuRa _RNGenerator) external onlyByGovernor { + RNGenerator = _RNGenerator; + if (phase == Phase.generating) { + RNBlock = RNGenerator.nextCommitPhaseStartBlock() + RNGenerator.collectRoundLength(); + } + } + + /** @dev Changes the `minStakingTime` storage variable. + * @param _minStakingTime The new value for the `minStakingTime` storage variable. + */ + function changeMinStakingTime(uint256 _minStakingTime) external onlyByGovernor { + minStakingTime = _minStakingTime; + } + + /** @dev Changes the `maxDrawingTime` storage variable. + * @param _maxDrawingTime The new value for the `maxDrawingTime` storage variable. + */ + function changeMaxDrawingTime(uint256 _maxDrawingTime) external onlyByGovernor { + maxDrawingTime = _maxDrawingTime; + } + + /** @dev Changes the `foreignGateway` storage variable. + * @param _foreignGateway The new value for the `foreignGateway` storage variable. + */ + function changeForeignGateway(IForeignGateway _foreignGateway) external onlyByGovernor { + foreignGateway = _foreignGateway; + } + + /** @dev Changes the `weth` storage variable. + * @param _weth The new value for the `weth` storage variable. + */ + function changeWethAddress(IERC20 _weth) external onlyByGovernor { + weth = _weth; + } + + /** @dev Creates a subcourt under a specified parent court. + * @param _parent The `parent` property value of the subcourt. + * @param _hiddenVotes The `hiddenVotes` property value of the subcourt. + * @param _minStake The `minStake` property value of the subcourt. + * @param _alpha The `alpha` property value of the subcourt. + * @param _feeForJuror The `feeForJuror` property value of the subcourt. + * @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the subcourt. + * @param _timesPerPeriod The `timesPerPeriod` property value of the subcourt. + * @param _sortitionSumTreeK The number of children per node of the subcourt's sortition sum tree. + */ + function createSubcourt( + uint96 _parent, + bool _hiddenVotes, + uint256 _minStake, + uint256 _alpha, + uint256 _feeForJuror, + uint256 _jurorsForCourtJump, + uint256[4] memory _timesPerPeriod, + uint256 _sortitionSumTreeK + ) external onlyByGovernor { + require( + courts[_parent].minStake <= _minStake, + "A subcourt cannot be a child of a subcourt with a higher minimum stake." + ); + + // Create the subcourt. + uint256 subcourtID = courts.length; + Court storage subcourt = courts.push(); + subcourt.parent = _parent; + subcourt.children = new uint256[](0); + subcourt.hiddenVotes = _hiddenVotes; + subcourt.minStake = _minStake; + subcourt.alpha = _alpha; + subcourt.feeForJuror = _feeForJuror; + subcourt.jurorsForCourtJump = _jurorsForCourtJump; + subcourt.timesPerPeriod = _timesPerPeriod; + sortitionSumTrees.createTree(bytes32(subcourtID), _sortitionSumTreeK); + + // Update the parent. + courts[_parent].children.push(subcourtID); + } + + /** @dev Changes the `minStake` property value of a specified subcourt. Don't set to a value lower than its parent's `minStake` property value. + * @param _subcourtID The ID of the subcourt. + * @param _minStake The new value for the `minStake` property value. + */ + function changeSubcourtMinStake(uint96 _subcourtID, uint256 _minStake) external onlyByGovernor { + require(_subcourtID == 0 || courts[courts[_subcourtID].parent].minStake <= _minStake); + for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) { + require( + courts[courts[_subcourtID].children[i]].minStake >= _minStake, + "A subcourt cannot be the parent of a subcourt with a lower minimum stake." + ); + } + + courts[_subcourtID].minStake = _minStake; + } + + /** @dev Changes the `alpha` property value of a specified subcourt. + * @param _subcourtID The ID of the subcourt. + * @param _alpha The new value for the `alpha` property value. + */ + function changeSubcourtAlpha(uint96 _subcourtID, uint256 _alpha) external onlyByGovernor { + courts[_subcourtID].alpha = _alpha; + } + + /** @dev Changes the `feeForJuror` property value of a specified subcourt. + * @param _subcourtID The ID of the subcourt. + * @param _feeForJuror The new value for the `feeForJuror` property value. + */ + function changeSubcourtJurorFee(uint96 _subcourtID, uint256 _feeForJuror) external onlyByGovernor { + courts[_subcourtID].feeForJuror = _feeForJuror; + } + + /** @dev Changes the `jurorsForCourtJump` property value of a specified subcourt. + * @param _subcourtID The ID of the subcourt. + * @param _jurorsForCourtJump The new value for the `jurorsForCourtJump` property value. + */ + function changeSubcourtJurorsForJump(uint96 _subcourtID, uint256 _jurorsForCourtJump) external onlyByGovernor { + courts[_subcourtID].jurorsForCourtJump = _jurorsForCourtJump; + } + + /** @dev Changes the `timesPerPeriod` property value of a specified subcourt. + * @param _subcourtID The ID of the subcourt. + * @param _timesPerPeriod The new value for the `timesPerPeriod` property value. + */ + function changeSubcourtTimesPerPeriod( + uint96 _subcourtID, + uint256[4] memory _timesPerPeriod + ) external onlyByGovernor { + courts[_subcourtID].timesPerPeriod = _timesPerPeriod; + } + + /** @dev Sets the caller's stake in a subcourt. + * @param _subcourtID The ID of the subcourt. + * @param _stake The new stake. + */ + function setStake(uint96 _subcourtID, uint128 _stake) external { + require(_setStake(msg.sender, _subcourtID, _stake)); + } + + /** @dev Executes the next delayed set stakes. + * `O(n)` where `n` is the number of iterations to run. + * @param _iterations The number of delayed set stakes to execute. + */ + function executeDelayedSetStakes(uint256 _iterations) external onlyDuringPhase(Phase.staking) { + uint256 actualIterations = (nextDelayedSetStake + _iterations) - 1 > lastDelayedSetStake + ? (lastDelayedSetStake - nextDelayedSetStake) + 1 + : _iterations; + uint256 newNextDelayedSetStake = nextDelayedSetStake + actualIterations; + require(newNextDelayedSetStake >= nextDelayedSetStake); + for (uint256 i = nextDelayedSetStake; i < newNextDelayedSetStake; i++) { + DelayedSetStake storage delayedSetStake = delayedSetStakes[i]; + _setStake(delayedSetStake.account, delayedSetStake.subcourtID, delayedSetStake.stake); + delete delayedSetStakes[i]; + } + nextDelayedSetStake = newNextDelayedSetStake; + } + + /** @dev Receive the ruling from foreign gateway which technically is an arbitrator of this contract. + * @param _disputeID ID of the dispute. + * @param _ruling Ruling given by V2 court and relayed by foreign gateway. + */ + function rule(uint256 _disputeID, uint256 _ruling) external { + require(_disputeID < totalDisputes, "Dispute ID does not exist."); + require(msg.sender == address(foreignGateway), "Can only be called by gateway"); + + Dispute storage dispute = disputes[_disputeID]; + require(!dispute.ruled, "Ruling already executed."); + dispute.ruled = true; + disputesRuling[_disputeID] = _ruling; + + // Send the relayed ruling to the arbitrable while fully bypassing the dispute flow. + dispute.arbitrated.rule(_disputeID, _ruling); + + emit Ruling(dispute.arbitrated, _disputeID, _ruling); + } + + /* Public */ + + /** @dev Creates a dispute. Must be called by the arbitrable contract. + * @param _numberOfChoices Number of choices to choose from in the dispute to be created. + * @param _extraData Additional info about the dispute to be created. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes). + * @return disputeID The ID of the created dispute. + */ + function createDispute( + uint256 _numberOfChoices, + bytes memory _extraData + ) public payable override returns (uint256 disputeID) { + require(msg.value == 0, "Fees should be paid in WETH"); + uint256 fee = arbitrationCost(_extraData); + require(weth.transferFrom(msg.sender, address(this), fee), "Not enough WETH for arbitration"); + + disputeID = totalDisputes++; + Dispute storage dispute = disputes[disputeID]; + dispute.arbitrated = IArbitrable(msg.sender); + + // The V2 subcourtID is off by one + (uint96 subcourtID, uint256 minJurors) = extraDataToSubcourtIDAndMinJurors(_extraData); + bytes memory extraDataV2 = abi.encode(uint256(subcourtID + 1), minJurors); + + require(weth.transfer(address(foreignGateway), fee), "Fee transfer to gateway failed"); + foreignGateway.createDisputeERC20(_numberOfChoices, extraDataV2, fee); + + emit DisputeCreation(disputeID, IArbitrable(msg.sender)); + } + + /** @dev DEPRECATED. Called when `_owner` sends ETH to the Wrapped Token contract. + * @param _owner The address that sent the ETH to create tokens. + * @return allowed Whether the operation should be allowed or not. + */ + function proxyPayment(address _owner) public payable override returns (bool allowed) { + allowed = false; + } + + /** @dev Notifies the controller about a token transfer allowing the controller to react if desired. + * @param _from The origin of the transfer. + * @param _to The destination of the transfer. + * @param _amount The amount of the transfer. + * @return allowed Whether the operation should be allowed or not. + */ + function onTransfer(address _from, address _to, uint256 _amount) public override returns (bool allowed) { + if (lockInsolventTransfers) { + // Never block penalties or rewards. + uint256 newBalance = pinakion.balanceOf(_from) - _amount; + if (newBalance < jurors[_from].stakedTokens || newBalance < jurors[_from].lockedTokens) return false; + } + allowed = true; + } + + /** @dev Notifies the controller about an approval allowing the controller to react if desired. + * @param _owner The address that calls `approve()`. + * @param _spender The spender in the `approve()` call. + * @param _amount The amount in the `approve()` call. + * @return allowed Whether the operation should be allowed or not. + */ + function onApprove(address _owner, address _spender, uint256 _amount) public override returns (bool allowed) { + allowed = true; + } + + /* Public Views */ + + /** @dev Gets the cost of arbitration in a specified subcourt. + * @param _extraData Additional info about the dispute. We use it to pass the ID of the subcourt to create the dispute in (first 32 bytes) and the minimum number of jurors required (next 32 bytes). + * @return cost The cost. + */ + function arbitrationCost(bytes memory _extraData) public view override returns (uint256 cost) { + cost = foreignGateway.arbitrationCost(_extraData); + } + + /** @dev Gets the current ruling of a specified dispute. + * @param _disputeID The ID of the dispute. + * @return ruling The current ruling. + */ + function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) { + Dispute storage dispute = disputes[_disputeID]; + if (dispute.voteCounters.length == 0) { + ruling = disputesRuling[_disputeID]; + } else { + ruling = dispute.voteCounters[dispute.voteCounters.length - 1].tied + ? 0 + : dispute.voteCounters[dispute.voteCounters.length - 1].winningChoice; + } + } + + /* Internal */ + + /** @dev Sets the specified juror's stake in a subcourt. + * `O(n + p * log_k(j))` where + * `n` is the number of subcourts the juror has staked in, + * `p` is the depth of the subcourt tree, + * `k` is the minimum number of children per node of one of these subcourts' sortition sum tree, + * and `j` is the maximum number of jurors that ever staked in one of these subcourts simultaneously. + * @param _account The address of the juror. + * @param _subcourtID The ID of the subcourt. + * @param _stake The new stake. + * @return succeeded True if the call succeeded, false otherwise. + */ + function _setStake(address _account, uint96 _subcourtID, uint128 _stake) internal returns (bool succeeded) { + if (!(_subcourtID < courts.length)) return false; + + if (!(_stake == 0 || courts[_subcourtID].minStake <= _stake)) return false; // The juror's stake cannot be lower than the minimum stake for the subcourt. + Juror storage juror = jurors[_account]; + bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID); + uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID); + if (!(_stake == 0 || currentStake > 0 || juror.subcourtIDs.length < MAX_STAKE_PATHS)) return false; // Maximum stake paths reached. + uint256 newTotalStake = juror.stakedTokens - currentStake + _stake; // Can't overflow because _stake is a uint128. + if (!(_stake == 0 || pinakion.balanceOf(_account) >= newTotalStake)) return false; // The juror's total amount of staked tokens cannot be higher than the juror's balance. + + // Update juror's records. + juror.stakedTokens = newTotalStake; + if (_stake == 0) { + for (uint256 i = 0; i < juror.subcourtIDs.length; i++) + if (juror.subcourtIDs[i] == _subcourtID) { + juror.subcourtIDs[i] = juror.subcourtIDs[juror.subcourtIDs.length - 1]; + juror.subcourtIDs.pop(); + break; + } + } else if (currentStake == 0) juror.subcourtIDs.push(_subcourtID); + + // Update subcourt parents. + bool finished = false; + uint256 currentSubcourtID = _subcourtID; + while (!finished) { + sortitionSumTrees.set(bytes32(currentSubcourtID), _stake, stakePathID); + if (currentSubcourtID == 0) finished = true; + else currentSubcourtID = courts[currentSubcourtID].parent; + } + emit StakeSet(_account, _subcourtID, _stake, newTotalStake); + return true; + } + + /** @dev Gets a subcourt ID and the minimum number of jurors required from a specified extra data bytes array. + * @param _extraData The extra data bytes array. The first 32 bytes are the subcourt ID and the next 32 bytes are the minimum number of jurors. + * @return subcourtID The subcourt ID. + * @return minJurors The minimum number of jurors required. + */ + function extraDataToSubcourtIDAndMinJurors( + bytes memory _extraData + ) internal view returns (uint96 subcourtID, uint256 minJurors) { + if (_extraData.length >= 64) { + assembly { + // solium-disable-line security/no-inline-assembly + subcourtID := mload(add(_extraData, 0x20)) + minJurors := mload(add(_extraData, 0x40)) + } + if (subcourtID >= courts.length) subcourtID = 0; + if (minJurors == 0) minJurors = MIN_JURORS; + } else { + subcourtID = 0; + minJurors = MIN_JURORS; + } + } + + /** @dev Packs an account and a subcourt ID into a stake path ID. + * @param _account The account to pack. + * @param _subcourtID The subcourt ID to pack. + * @return stakePathID The stake path ID. + */ + function accountAndSubcourtIDToStakePathID( + address _account, + uint96 _subcourtID + ) internal pure returns (bytes32 stakePathID) { + assembly { + // solium-disable-line security/no-inline-assembly + let ptr := mload(0x40) + for { + let i := 0x00 + } lt(i, 0x14) { + i := add(i, 0x01) + } { + mstore8(add(ptr, i), byte(add(0x0c, i), _account)) + } + for { + let i := 0x14 + } lt(i, 0x20) { + i := add(i, 0x01) + } { + mstore8(add(ptr, i), byte(i, _subcourtID)) + } + stakePathID := mload(ptr) + } + } + + /* Interface Views */ + + /** @dev Gets a specified subcourt's non primitive properties. + * @param _subcourtID The ID of the subcourt. + * @return children The subcourt's child court list. + * @return timesPerPeriod The subcourt's time per period. + */ + function getSubcourt( + uint96 _subcourtID + ) external view returns (uint256[] memory children, uint256[4] memory timesPerPeriod) { + Court storage subcourt = courts[_subcourtID]; + children = subcourt.children; + timesPerPeriod = subcourt.timesPerPeriod; + } + + /** @dev Gets a specified vote for a specified appeal in a specified dispute. + * @param _disputeID The ID of the dispute. + * @param _appeal The appeal. + * @param _voteID The ID of the vote. + * @return account The account for vote. + * @return commit The commit for vote. + * @return choice The choice for vote. + * @return voted True if the account voted, False otherwise. + */ + function getVote( + uint256 _disputeID, + uint256 _appeal, + uint256 _voteID + ) external view returns (address account, bytes32 commit, uint256 choice, bool voted) { + Vote storage vote = disputes[_disputeID].votes[_appeal][_voteID]; + account = vote.account; + commit = vote.commit; + choice = vote.choice; + voted = vote.voted; + } + + /** @dev Gets the vote counter for a specified appeal in a specified dispute. + * Note: This function is only to be used by the interface and it won't work if the number of choices is too high. + * @param _disputeID The ID of the dispute. + * @param _appeal The appeal. + * @return winningChoice The winning choice. + * @return counts The count. + * @return tied Whether the vote tied. + * `O(n)` where + * `n` is the number of choices of the dispute. + */ + function getVoteCounter( + uint256 _disputeID, + uint256 _appeal + ) external view returns (uint256 winningChoice, uint256[] memory counts, bool tied) { + Dispute storage dispute = disputes[_disputeID]; + VoteCounter storage voteCounter = dispute.voteCounters[_appeal]; + winningChoice = voteCounter.winningChoice; + counts = new uint256[](dispute.numberOfChoices + 1); + for (uint256 i = 0; i <= dispute.numberOfChoices; i++) counts[i] = voteCounter.counts[i]; + tied = voteCounter.tied; + } + + /** @dev Gets a specified dispute's non primitive properties. + * @param _disputeID The ID of the dispute. + * @return votesLengths The dispute's vote length. + * @return tokensAtStakePerJuror The dispute's required tokens at stake per Juror. + * @return totalFeesForJurors The dispute's total fees for Jurors. + * @return votesInEachRound The dispute's counter of votes made in each round. + * @return repartitionsInEachRound The dispute's counter of vote reward repartitions made in each round. + * @return penaltiesInEachRound The dispute's amount of tokens collected from penalties in each round. + * `O(a)` where + * `a` is the number of appeals of the dispute. + */ + function getDispute( + uint256 _disputeID + ) + external + view + returns ( + uint256[] memory votesLengths, + uint256[] memory tokensAtStakePerJuror, + uint256[] memory totalFeesForJurors, + uint256[] memory votesInEachRound, + uint256[] memory repartitionsInEachRound, + uint256[] memory penaltiesInEachRound + ) + { + Dispute storage dispute = disputes[_disputeID]; + votesLengths = new uint256[](dispute.votes.length); + for (uint256 i = 0; i < dispute.votes.length; i++) votesLengths[i] = dispute.votes[i].length; + tokensAtStakePerJuror = dispute.tokensAtStakePerJuror; + totalFeesForJurors = dispute.totalFeesForJurors; + votesInEachRound = dispute.votesInEachRound; + repartitionsInEachRound = dispute.repartitionsInEachRound; + penaltiesInEachRound = dispute.penaltiesInEachRound; + } + + /** @dev Gets a specified juror's non primitive properties. + * @param _account The address of the juror. + * @return subcourtIDs The juror's IDs of subcourts where the juror has stake path. + */ + function getJuror(address _account) external view returns (uint96[] memory subcourtIDs) { + Juror storage juror = jurors[_account]; + subcourtIDs = juror.subcourtIDs; + } + + /** @dev Gets the stake of a specified juror in a specified subcourt. + * @param _account The address of the juror. + * @param _subcourtID The ID of the subcourt. + * @return stake The stake. + */ + function stakeOf(address _account, uint96 _subcourtID) external view returns (uint256 stake) { + return + sortitionSumTrees.stakeOf( + bytes32(uint256(_subcourtID)), + accountAndSubcourtIDToStakePathID(_account, _subcourtID) + ); + } +} diff --git a/contracts/src/kleros-v1/KlerosV1Governor.sol b/contracts/src/kleros-v1/kleros-liquid/KlerosLiquidToV2Governor.sol similarity index 92% rename from contracts/src/kleros-v1/KlerosV1Governor.sol rename to contracts/src/kleros-v1/kleros-liquid/KlerosLiquidToV2Governor.sol index 69a098b65..8a00905c8 100644 --- a/contracts/src/kleros-v1/KlerosV1Governor.sol +++ b/contracts/src/kleros-v1/kleros-liquid/KlerosLiquidToV2Governor.sol @@ -2,19 +2,16 @@ pragma solidity ^0.8; -import "./IKlerosLiquid.sol"; -import "./ITokenController.sol"; -import "../arbitration/IArbitrable.sol"; -import "../arbitration/IArbitrator.sol"; - -/** - * @title ERC20 interface - */ +import "../interfaces/IKlerosLiquid.sol"; +import "../interfaces/ITokenController.sol"; +import "../../arbitration/IArbitrable.sol"; +import "../../arbitration/IArbitrator.sol"; + interface IPinakion { function balanceOf(address who) external view returns (uint256); } -contract KlerosV1Governor is IArbitrable, ITokenController { +contract KlerosLiquidToV2Governor is IArbitrable, ITokenController { struct DisputeData { uint256 klerosLiquidDisputeID; bool ruled; @@ -39,11 +36,7 @@ contract KlerosV1Governor is IArbitrable, ITokenController { * @param _governor The trusted governor of the contract. * @param _foreignGateway The trusted gateway that acts as an arbitrator, relaying disputes to v2. */ - constructor( - IKlerosLiquid _klerosLiquid, - address _governor, - IArbitrator _foreignGateway - ) { + constructor(IKlerosLiquid _klerosLiquid, address _governor, IArbitrator _foreignGateway) { klerosLiquid = _klerosLiquid; governor = _governor; foreignGateway = _foreignGateway; @@ -161,11 +154,7 @@ contract KlerosV1Governor is IArbitrable, ITokenController { * @param _amount The amount of the transfer. * @return allowed Whether the operation should be allowed or not. */ - function onTransfer( - address _from, - address _to, - uint256 _amount - ) external returns (bool allowed) { + function onTransfer(address _from, address _to, uint256 _amount) external returns (bool allowed) { if (klerosLiquid.lockInsolventTransfers()) { // Never block penalties or rewards. IPinakion pinakion = IPinakion(klerosLiquid.pinakion()); @@ -185,11 +174,7 @@ contract KlerosV1Governor is IArbitrable, ITokenController { * @param _amount The amount in the `approve()` call. * @return allowed Whether the operation should be allowed or not. */ - function onApprove( - address _owner, - address _spender, - uint256 _amount - ) external returns (bool allowed) { + function onApprove(address _owner, address _spender, uint256 _amount) external returns (bool allowed) { allowed = true; } diff --git a/contracts/src/libraries/CappedMath.sol b/contracts/src/libraries/CappedMath.sol index e79f13ae3..0e11f7744 100644 --- a/contracts/src/libraries/CappedMath.sol +++ b/contracts/src/libraries/CappedMath.sol @@ -1,7 +1,5 @@ // SPDX-License-Identifier: MIT -// Use @kleros/ethereum-libraries once upgraded. - pragma solidity ^0.8.0; /** diff --git a/contracts/src/libraries/SortitionSumTreeFactory.sol b/contracts/src/libraries/SortitionSumTreeFactory.sol new file mode 100644 index 000000000..a0857a94b --- /dev/null +++ b/contracts/src/libraries/SortitionSumTreeFactory.sol @@ -0,0 +1,251 @@ +// SPDX-License-Identifier: MIT + +/** + * @authors: [@epiqueras, @unknownunknown1] + * @reviewers: [] + * @auditors: [] + * @bounties: [] + * @deployments: [] + */ + +pragma solidity ^0.8; + +/** + * @title SortitionSumTreeFactory + * @author Enrique Piqueras - + * @dev A factory of trees that keep track of staked values for sortition. + */ +library SortitionSumTreeFactory { + /* Structs */ + + struct SortitionSumTree { + uint K; // The maximum number of childs per node. + // We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possible without spending gas on moving nodes around. + uint[] stack; + uint[] nodes; + // Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node. + mapping(bytes32 => uint) IDsToNodeIndexes; + mapping(uint => bytes32) nodeIndexesToIDs; + } + + /* Storage */ + + struct SortitionSumTrees { + mapping(bytes32 => SortitionSumTree) sortitionSumTrees; + } + + /* Public */ + + /** + * @dev Create a sortition sum tree at the specified key. + * @param _key The key of the new tree. + * @param _K The number of children each node in the tree should have. + */ + function createTree(SortitionSumTrees storage self, bytes32 _key, uint _K) public { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + require(tree.K == 0, "Tree already exists."); + require(_K > 1, "K must be greater than one."); + tree.K = _K; + tree.nodes.push(0); + } + + /** + * @dev Set a value of a tree. + * @param _key The key of the tree. + * @param _value The new value. + * @param _ID The ID of the value. + * `O(log_k(n))` where + * `k` is the maximum number of childs per node in the tree, + * and `n` is the maximum number of nodes ever appended. + */ + function set(SortitionSumTrees storage self, bytes32 _key, uint _value, bytes32 _ID) public { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + uint treeIndex = tree.IDsToNodeIndexes[_ID]; + + if (treeIndex == 0) { + // No existing node. + if (_value != 0) { + // Non zero value. + // Append. + // Add node. + if (tree.stack.length == 0) { + // No vacant spots. + // Get the index and append the value. + treeIndex = tree.nodes.length; + tree.nodes.push(_value); + + // Potentially append a new node and make the parent a sum node. + if (treeIndex != 1 && (treeIndex - 1) % tree.K == 0) { + // Is first child. + uint parentIndex = treeIndex / tree.K; + bytes32 parentID = tree.nodeIndexesToIDs[parentIndex]; + uint newIndex = treeIndex + 1; + tree.nodes.push(tree.nodes[parentIndex]); + delete tree.nodeIndexesToIDs[parentIndex]; + tree.IDsToNodeIndexes[parentID] = newIndex; + tree.nodeIndexesToIDs[newIndex] = parentID; + } + } else { + // Some vacant spot. + // Pop the stack and append the value. + treeIndex = tree.stack[tree.stack.length - 1]; + tree.stack.pop(); + tree.nodes[treeIndex] = _value; + } + + // Add label. + tree.IDsToNodeIndexes[_ID] = treeIndex; + tree.nodeIndexesToIDs[treeIndex] = _ID; + + updateParents(self, _key, treeIndex, true, _value); + } + } else { + // Existing node. + if (_value == 0) { + // Zero value. + // Remove. + // Remember value and set to 0. + uint value = tree.nodes[treeIndex]; + tree.nodes[treeIndex] = 0; + + // Push to stack. + tree.stack.push(treeIndex); + + // Clear label. + delete tree.IDsToNodeIndexes[_ID]; + delete tree.nodeIndexesToIDs[treeIndex]; + + updateParents(self, _key, treeIndex, false, value); + } else if (_value != tree.nodes[treeIndex]) { + // New, non zero value. + // Set. + bool plusOrMinus = tree.nodes[treeIndex] <= _value; + uint plusOrMinusValue = plusOrMinus ? _value - tree.nodes[treeIndex] : tree.nodes[treeIndex] - _value; + tree.nodes[treeIndex] = _value; + + updateParents(self, _key, treeIndex, plusOrMinus, plusOrMinusValue); + } + } + } + + /* Public Views */ + + /** + * @dev Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned. + * @param _key The key of the tree to get the leaves from. + * @param _cursor The pagination cursor. + * @param _count The number of items to return. + * @return startIndex The index at which leaves start. + * @return values The values of the returned leaves. + * @return hasMore Whether there are more for pagination. + * `O(n)` where + * `n` is the maximum number of nodes ever appended. + */ + function queryLeafs( + SortitionSumTrees storage self, + bytes32 _key, + uint _cursor, + uint _count + ) public view returns (uint startIndex, uint[] memory values, bool hasMore) { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + + // Find the start index. + for (uint i = 0; i < tree.nodes.length; i++) { + if ((tree.K * i) + 1 >= tree.nodes.length) { + startIndex = i; + break; + } + } + + // Get the values. + uint loopStartIndex = startIndex + _cursor; + values = new uint[](loopStartIndex + _count > tree.nodes.length ? tree.nodes.length - loopStartIndex : _count); + uint valuesIndex = 0; + for (uint j = loopStartIndex; j < tree.nodes.length; j++) { + if (valuesIndex < _count) { + values[valuesIndex] = tree.nodes[j]; + valuesIndex++; + } else { + hasMore = true; + break; + } + } + } + + /** + * @dev Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0. + * @param _key The key of the tree. + * @param _drawnNumber The drawn number. + * @return ID The drawn ID. + * `O(k * log_k(n))` where + * `k` is the maximum number of childs per node in the tree, + * and `n` is the maximum number of nodes ever appended. + */ + function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) public view returns (bytes32 ID) { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + uint treeIndex = 0; + uint currentDrawnNumber = _drawnNumber % tree.nodes[0]; + + while ( + (tree.K * treeIndex) + 1 < tree.nodes.length // While it still has children. + ) + for (uint i = 1; i <= tree.K; i++) { + // Loop over children. + uint nodeIndex = (tree.K * treeIndex) + i; + uint nodeValue = tree.nodes[nodeIndex]; + + if (currentDrawnNumber >= nodeValue) + currentDrawnNumber -= nodeValue; // Go to the next child. + else { + // Pick this child. + treeIndex = nodeIndex; + break; + } + } + + ID = tree.nodeIndexesToIDs[treeIndex]; + } + + /** @dev Gets a specified ID's associated value. + * @param _key The key of the tree. + * @param _ID The ID of the value. + * @return value The associated value. + */ + function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) public view returns (uint value) { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + uint treeIndex = tree.IDsToNodeIndexes[_ID]; + + if (treeIndex == 0) value = 0; + else value = tree.nodes[treeIndex]; + } + + /* Private */ + + /** + * @dev Update all the parents of a node. + * @param _key The key of the tree to update. + * @param _treeIndex The index of the node to start from. + * @param _plusOrMinus Wether to add (true) or substract (false). + * @param _value The value to add or substract. + * `O(log_k(n))` where + * `k` is the maximum number of childs per node in the tree, + * and `n` is the maximum number of nodes ever appended. + */ + function updateParents( + SortitionSumTrees storage self, + bytes32 _key, + uint _treeIndex, + bool _plusOrMinus, + uint _value + ) private { + SortitionSumTree storage tree = self.sortitionSumTrees[_key]; + + uint parentIndex = _treeIndex; + while (parentIndex != 0) { + parentIndex = (parentIndex - 1) / tree.K; + tree.nodes[parentIndex] = _plusOrMinus + ? tree.nodes[parentIndex] + _value + : tree.nodes[parentIndex] - _value; + } + } +} diff --git a/contracts/src/data-structures/SortitionSumTreeFactory.sol b/contracts/src/libraries/SortitionSumTreeFactoryV2.sol similarity index 92% rename from contracts/src/data-structures/SortitionSumTreeFactory.sol rename to contracts/src/libraries/SortitionSumTreeFactoryV2.sol index 4c58af45b..58e979af9 100644 --- a/contracts/src/data-structures/SortitionSumTreeFactory.sol +++ b/contracts/src/libraries/SortitionSumTreeFactoryV2.sol @@ -11,10 +11,10 @@ pragma solidity ^0.8; /** - * @title SortitionSumTreeFactory + * @title SortitionSumTreeFactoryV2 * @dev A factory of trees that keeps track of staked values for sortition. This is the updated version for 0.8 compiler. */ -library SortitionSumTreeFactory { +library SortitionSumTreeFactoryV2 { /* Structs */ struct SortitionSumTree { @@ -40,11 +40,7 @@ library SortitionSumTreeFactory { * @param _key The key of the new tree. * @param _K The number of children each node in the tree should have. */ - function createTree( - SortitionSumTrees storage self, - bytes32 _key, - uint256 _K - ) external { + function createTree(SortitionSumTrees storage self, bytes32 _key, uint256 _K) external { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; require(tree.K == 0, "Tree already exists."); require(_K > 1, "K must be greater than one."); @@ -61,12 +57,7 @@ library SortitionSumTreeFactory { * `k` is the maximum number of childs per node in the tree, * and `n` is the maximum number of nodes ever appended. */ - function set( - SortitionSumTrees storage self, - bytes32 _key, - uint256 _value, - bytes32 _ID - ) external { + function set(SortitionSumTrees storage self, bytes32 _key, uint256 _value, bytes32 _ID) external { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; uint256 treeIndex = tree.IDsToNodeIndexes[_ID]; @@ -156,15 +147,7 @@ library SortitionSumTreeFactory { bytes32 _key, uint256 _cursor, uint256 _count - ) - external - view - returns ( - uint256 startIndex, - uint256[] memory values, - bool hasMore - ) - { + ) external view returns (uint256 startIndex, uint256[] memory values, bool hasMore) { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; // Find the start index. @@ -197,11 +180,7 @@ library SortitionSumTreeFactory { * @param _ID The ID of the value. * @return value The associated value. */ - function stakeOf( - SortitionSumTrees storage self, - bytes32 _key, - bytes32 _ID - ) external view returns (uint256 value) { + function stakeOf(SortitionSumTrees storage self, bytes32 _key, bytes32 _ID) external view returns (uint256 value) { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; uint256 treeIndex = tree.IDsToNodeIndexes[_ID]; diff --git a/contracts/src/libraries/gnosis-chain/Bytes.sol b/contracts/src/libraries/gnosis-chain/Bytes.sol deleted file mode 100644 index a87e6e30a..000000000 --- a/contracts/src/libraries/gnosis-chain/Bytes.sol +++ /dev/null @@ -1,37 +0,0 @@ -//https://github.com/poanetwork/tokenbridge-contracts/blob/master/contracts/libraries/Bytes.sol - -pragma solidity ^0.8.0; - -/** - * @title Bytes - * @dev Helper methods to transform bytes to other solidity types. - */ -library Bytes { - /** - * @dev Converts bytes array to bytes32. - * Truncates bytes array if its size is more than 32 bytes. - * NOTE: This function does not perform any checks on the received parameter. - * Make sure that the _bytes argument has a correct length, not less than 32 bytes. - * A case when _bytes has length less than 32 will lead to the undefined behaviour, - * since assembly will read data from memory that is not related to the _bytes argument. - * @param _bytes to be converted to bytes32 type - * @return result bytes32 type of the firsts 32 bytes array in parameter. - */ - function bytesToBytes32(bytes memory _bytes) internal pure returns (bytes32 result) { - assembly { - result := mload(add(_bytes, 32)) - } - } - - /** - * @dev Truncate bytes array if its size is more than 20 bytes. - * NOTE: Similar to the bytesToBytes32 function, make sure that _bytes is not shorter than 20 bytes. - * @param _bytes to be converted to address type - * @return addr address included in the firsts 20 bytes of the bytes array in parameter. - */ - function bytesToAddress(bytes memory _bytes) internal pure returns (address addr) { - assembly { - addr := mload(add(_bytes, 20)) - } - } -} diff --git a/contracts/src/rng/IRandomizer.sol b/contracts/src/rng/IRandomizer.sol index f72bf3588..63fe3123a 100644 --- a/contracts/src/rng/IRandomizer.sol +++ b/contracts/src/rng/IRandomizer.sol @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + // Randomizer protocol interface interface IRandomizer { function request(uint256 callbackGasLimit) external returns (uint256); diff --git a/contracts/src/rng/RandomizerRNG.sol b/contracts/src/rng/RandomizerRNG.sol index 985e4d0b9..b0fd3ea35 100644 --- a/contracts/src/rng/RandomizerRNG.sol +++ b/contracts/src/rng/RandomizerRNG.sol @@ -10,12 +10,16 @@ import "./IRandomizer.sol"; * https://randomizer.ai/ */ contract RandomizerRNG is RNG { - uint256 public constant CALLBACK_GAS_LIMIT = 50000; address public governor; // The address that can withdraw funds. + uint256 public callbackGasLimit = 50000; // Gas limit for the randomizer callback IRandomizer public randomizer; // Randomizer address. - mapping(uint128 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise. - mapping(address => uint128) public requesterToID; // Maps the requester to his latest request ID. + mapping(uint256 => uint256) public randomNumbers; // randomNumbers[requestID] is the random number for this request id, 0 otherwise. + mapping(address => uint256) public requesterToID; // Maps the requester to his latest request ID. + + // ************************************* // + // * Function Modifiers * // + // ************************************* // modifier onlyByGovernor() { require(governor == msg.sender, "Governor only"); @@ -31,6 +35,10 @@ contract RandomizerRNG is RNG { governor = _governor; } + // ************************ // + // * Governance * // + // ************************ // + /** @dev Changes the governor of the contract. * @param _governor The new governor. */ @@ -38,37 +46,59 @@ contract RandomizerRNG is RNG { governor = _governor; } + /** @dev Change the Randomizer callback gas limit. + * @param _callbackGasLimit the new limit. + */ + function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyByGovernor { + callbackGasLimit = _callbackGasLimit; + } + + /** @dev Change the Randomizer address. + * @param _randomizer the new Randomizer address. + */ + function setRandomizer(address _randomizer) external onlyByGovernor { + randomizer = IRandomizer(_randomizer); + } + /** - * @dev Request a random number. The id of the request is tied to the sender. + * @dev Allows the governor to withdraw randomizer funds. + * @param _amount Amount to withdraw in wei. */ - function requestRandomness(uint256 /*_block*/) external override { - uint128 id = uint128(randomizer.request(CALLBACK_GAS_LIMIT)); - requesterToID[msg.sender] = id; + function randomizerWithdraw(uint256 _amount) external onlyByGovernor { + randomizer.clientWithdrawTo(msg.sender, _amount); } + // ************************************* // + // * State Modifiers * // + // ************************************* // + /** - * @dev Return the random number. - * @return randomNumber The random number or 0 if it is not ready or has not been requested. + * @dev Request a random number. The id of the request is tied to the sender. */ - function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) { - // Get the latest request ID for this requester. - uint128 id = requesterToID[msg.sender]; - randomNumber = randomNumbers[id]; + function requestRandomness(uint256 /*_block*/) external override { + uint256 id = randomizer.request(callbackGasLimit); + requesterToID[msg.sender] = id; } /** * @dev Callback function called by the randomizer contract when the random value is generated. */ - function randomizerCallback(uint128 _id, bytes32 _value) external { - require(msg.sender == address(randomizer), "Caller not Randomizer"); + function randomizerCallback(uint256 _id, bytes32 _value) external { + require(msg.sender == address(randomizer), "Randomizer only"); randomNumbers[_id] = uint256(_value); } + // ************************************* // + // * Public Views * // + // ************************************* // + /** - * @dev Allows the governor to withdraw randomizer funds. - * @param _amount Amount to withdraw in wei. + * @dev Return the random number. + * @return randomNumber The random number or 0 if it is not ready or has not been requested. */ - function randomizerWithdraw(uint256 _amount) external onlyByGovernor { - randomizer.clientWithdrawTo(msg.sender, _amount); + function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) { + // Get the latest request ID for this requester. + uint256 id = requesterToID[msg.sender]; + randomNumber = randomNumbers[id]; } } diff --git a/contracts/src/rng/mock/RandomizerMock.sol b/contracts/src/rng/mock/RandomizerMock.sol index d89dcd66c..2e1692af9 100644 --- a/contracts/src/rng/mock/RandomizerMock.sol +++ b/contracts/src/rng/mock/RandomizerMock.sol @@ -15,7 +15,7 @@ contract RandomizerMock is IRandomizer { revert("Not Implemented"); } - function relay(RandomizerRNG _rng, uint128 _id, bytes32 _value) external { + function relay(RandomizerRNG _rng, uint256 _id, bytes32 _value) external { _rng.randomizerCallback(_id, _value); } } diff --git a/contracts/src/token/Faucet.sol b/contracts/src/token/Faucet.sol new file mode 100644 index 000000000..ad592046d --- /dev/null +++ b/contracts/src/token/Faucet.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +contract Faucet { + IERC20 public token; + mapping(address => bool) public withdrewAlready; + + constructor(IERC20 _token) { + token = _token; + } + + function balance() public view returns (uint) { + return token.balanceOf(address(this)); + } + + function request() public { + require( + !withdrewAlready[msg.sender], + "You have used this faucet already. If you need more tokens, please use another address." + ); + token.transfer(msg.sender, 10000 ether); + withdrewAlready[msg.sender] = true; + } +} diff --git a/contracts/src/arbitration/mock/PNK.sol b/contracts/src/token/PNK.sol similarity index 100% rename from contracts/src/arbitration/mock/PNK.sol rename to contracts/src/token/PNK.sol diff --git a/contracts/src/token/WETH.sol b/contracts/src/token/WETH.sol new file mode 100644 index 000000000..7f0a6ea15 --- /dev/null +++ b/contracts/src/token/WETH.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract WETH is ERC20 { + constructor() ERC20("Wrapped ETH", "WETH") { + _mint(msg.sender, 1000000 ether); + } +} diff --git a/contracts/src/token/WrappedPinakionV2.sol b/contracts/src/token/WrappedPinakionV2.sol new file mode 100644 index 000000000..2d0ebfe21 --- /dev/null +++ b/contracts/src/token/WrappedPinakionV2.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract WrappedPinakionV2 is ERC20 { + constructor() ERC20("Staking PNK on xDai", "stPNK") { + _mint(msg.sender, 1000000 ether); + } +} diff --git a/contracts/test/arbitration/draw.ts b/contracts/test/arbitration/draw.ts index f2c99a52d..6812f17aa 100644 --- a/contracts/test/arbitration/draw.ts +++ b/contracts/test/arbitration/draw.ts @@ -4,7 +4,7 @@ import { BigNumber } from "ethers"; import { PNK, KlerosCore, - ArbitrableExample, + ArbitrableExampleEthFee, HomeGatewayToEthereum, DisputeKitClassic, RandomizerRNG, @@ -64,7 +64,7 @@ describe("Draw Benchmark", async () => { pnk = (await ethers.getContract("PNK")) as PNK; core = (await ethers.getContract("KlerosCore")) as KlerosCore; homeGateway = (await ethers.getContract("HomeGatewayToEthereum")) as HomeGatewayToEthereum; - arbitrable = (await ethers.getContract("ArbitrableExample")) as ArbitrableExample; + arbitrable = (await ethers.getContract("ArbitrableExampleEthFee")) as ArbitrableExampleEthFee; rng = (await ethers.getContract("RandomizerRNG")) as RandomizerRNG; randomizer = (await ethers.getContract("RandomizerMock")) as RandomizerMock; }); diff --git a/contracts/test/arbitration/index.ts b/contracts/test/arbitration/index.ts index c9db56f35..5f83a3c8b 100644 --- a/contracts/test/arbitration/index.ts +++ b/contracts/test/arbitration/index.ts @@ -85,13 +85,13 @@ async function deployContracts(deployer) { ); await disputeKit.deployed(); - const sortitionSumTreeLibraryFactory = await ethers.getContractFactory("SortitionSumTreeFactory", deployer); + const sortitionSumTreeLibraryFactory = await ethers.getContractFactory("SortitionSumTreeFactoryV2", deployer); const library = await sortitionSumTreeLibraryFactory.deploy(); const klerosCoreFactory = await ethers.getContractFactory("KlerosCore", { signer: deployer, libraries: { - SortitionSumTreeFactory: library.address, + SortitionSumTreeFactoryV2: library.address, }, }); const core = await klerosCoreFactory.deploy( diff --git a/contracts/test/integration/index.ts b/contracts/test/integration/index.ts index a36bf95ee..6cb14d126 100644 --- a/contracts/test/integration/index.ts +++ b/contracts/test/integration/index.ts @@ -5,7 +5,7 @@ import { PNK, KlerosCore, ForeignGatewayOnEthereum, - ArbitrableExample, + ArbitrableExampleEthFee, HomeGatewayToEthereum, VeaMock, DisputeKitClassic, @@ -61,11 +61,11 @@ describe("Integration tests", async () => { core = (await ethers.getContract("KlerosCore")) as KlerosCore; vea = (await ethers.getContract("VeaMock")) as VeaMock; foreignGateway = (await ethers.getContract("ForeignGatewayOnEthereum")) as ForeignGatewayOnEthereum; - arbitrable = (await ethers.getContract("ArbitrableExample")) as ArbitrableExample; + arbitrable = (await ethers.getContract("ArbitrableExampleEthFee")) as ArbitrableExampleEthFee; homeGateway = (await ethers.getContract("HomeGatewayToEthereum")) as HomeGatewayToEthereum; }); - it("Honest Claim - No Challenge - Bridger paid", async () => { + it("Resolves a dispute on the home chain with no appeal", async () => { const arbitrationCost = ONE_TENTH_ETH.mul(3); const [bridger, challenger, relayer] = await ethers.getSigners(); @@ -170,7 +170,8 @@ describe("Integration tests", async () => { const tx4 = await core.executeRuling(0); console.log("Ruling executed on KlerosCore"); - expect(tx4).to.emit(arbitrable, "Ruling").withArgs(foreignGateway.address, 1, 0); + expect(tx4).to.emit(core, "Ruling").withArgs(homeGateway.address, 0, 0); + expect(tx4).to.emit(arbitrable, "Ruling").withArgs(foreignGateway.address, 1, 0); // The ForeignGateway starts counting disputeID from 1. }); async function mineBlocks(n) { diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index b6d89b846..c9abe1630 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -24,6 +24,7 @@ interface DisputeKitDispute { interface DisputeKitRound { id: ID! localDispute: DisputeKitDispute! + votes: [Vote!]! @derivedFrom(field: "localRound") } interface Vote { @@ -156,22 +157,6 @@ type DisputeKit @entity { courts: [Court!]! @derivedFrom(field: "supportedDisputeKits") } -type GatewayDispute @entity { - id: ID! - homeDispute: Dispute! - arbitrator: Bytes! - disputeHash: Bytes! - arbitrationCost: BigInt! - relayer: Bytes! -} - -type OutgoingBatch @entity { - id: ID! # messageHash - size: BigInt! - epoch: BigInt! - batchMerkleRoot: String! -} - type Counter @entity { id: ID! # Will be the timestamp except for the counter which will be 0 stakedPNK: BigInt! @@ -201,8 +186,8 @@ type ClassicDispute implements DisputeKitDispute @entity { type ClassicRound implements DisputeKitRound @entity { id: ID! # disputeKit.id-coreDispute-dispute.rounds.length localDispute: DisputeKitDispute! + votes: [Vote!]! @derivedFrom(field: "localRound") - votes: [ClassicVote!]! winningChoice: BigInt! counts: [BigInt!]! tied: Boolean! diff --git a/subgraph/src/DisputeKitClassic.ts b/subgraph/src/DisputeKitClassic.ts index 96e019f5d..6d0a7e9f4 100644 --- a/subgraph/src/DisputeKitClassic.ts +++ b/subgraph/src/DisputeKitClassic.ts @@ -20,6 +20,7 @@ import { ensureClassicEvidenceGroup } from "./entities/ClassicEvidenceGroup"; import { createClassicRound, updateChoiceFundingFromContributionEvent, + updateCounts, } from "./entities/ClassicRound"; import { createClassicVote } from "./entities/ClassicVote"; import { ONE, ZERO } from "./utils"; @@ -29,11 +30,12 @@ export const DISPUTEKIT_ID = "1"; export function handleDisputeCreation(event: DisputeCreation): void { const disputeID = event.params._coreDisputeID.toString(); createClassicDisputeFromEvent(event); - createClassicRound(disputeID, ZERO); + const numberOfChoices = event.params._numberOfChoices; + createClassicRound(disputeID, numberOfChoices, ZERO); } export function handleEvidenceEvent(event: EvidenceEvent): void { - const evidenceGroupID = event.params._evidenceGroupID.toHexString(); + const evidenceGroupID = event.params._evidenceGroupID.toString(); const evidenceGroup = ensureClassicEvidenceGroup(evidenceGroupID); const evidenceIndex = evidenceGroup.nextEvidenceIndex; evidenceGroup.nextEvidenceIndex = evidenceGroup.nextEvidenceIndex.plus(ONE); @@ -52,9 +54,9 @@ export function handleJustificationEvent(event: JustificationEvent): void { const classicDisputeID = `${DISPUTEKIT_ID}-${coreDisputeID}`; const classicDispute = ClassicDispute.load(classicDisputeID); if (!classicDispute) return; - const currentLocalRoundID = `${ - classicDispute.id - }-${classicDispute.currentLocalRoundIndex.toString()}`; + const currentLocalRoundID = + classicDispute.id + "-" + classicDispute.currentLocalRoundIndex.toString(); + updateCounts(currentLocalRoundID, event.params._choice); createClassicVote(currentLocalRoundID, event); } @@ -88,7 +90,8 @@ export function handleChoiceFunded(event: ChoiceFunded): void { ); if (!localDispute) return; const newRoundIndex = localDispute.currentLocalRoundIndex.plus(ONE); - createClassicRound(coreDisputeID, newRoundIndex); + const numberOfChoices = localDispute.numberOfChoices; + createClassicRound(coreDisputeID, numberOfChoices, newRoundIndex); } localRound.save(); diff --git a/subgraph/src/KlerosCore.ts b/subgraph/src/KlerosCore.ts index 7a1f8244a..4941ffcb7 100644 --- a/subgraph/src/KlerosCore.ts +++ b/subgraph/src/KlerosCore.ts @@ -10,6 +10,7 @@ import { NewPeriod, StakeSet, TokenAndETHShift as TokenAndETHShiftEvent, + Ruling, } from "../generated/KlerosCore/KlerosCore"; import { ZERO, ONE } from "./utils"; import { createCourtFromEvent, getFeeForJuror } from "./entities/Court"; @@ -24,9 +25,11 @@ import { updatePaidETH, updateStakedPNK, updateRedistributedPNK, + updateCasesRuled, + updateCasesVoting, getDelta, } from "./datapoint"; -import { ensureUser } from "./entities/Juror"; +import { ensureUser } from "./entities/User"; import { ensureJurorTokensPerCourt, updateJurorStake, @@ -35,6 +38,7 @@ import { createDrawFromEvent } from "./entities/Draw"; import { createTokenAndEthShiftFromEvent } from "./entities/TokenAndEthShift"; import { updateArbitrableCases } from "./entities/Arbitrable"; import { Court, Dispute } from "../generated/schema"; +import { BigInt } from "@graphprotocol/graph-ts"; function getPeriodName(index: i32): string { const periodArray = ["evidence", "commit", "vote", "appeal", "execution"]; @@ -95,11 +99,26 @@ export function handleNewPeriod(event: NewPeriod): void { const disputeID = event.params._disputeID.toString(); const dispute = Dispute.load(disputeID); if (!dispute) return; - dispute.period = getPeriodName(event.params._period); + const newPeriod = getPeriodName(event.params._period); + if (dispute.period === "vote") { + updateCasesVoting(BigInt.fromI32(-1), event.block.timestamp); + } else if (newPeriod === "vote") { + updateCasesVoting(ONE, event.block.timestamp); + } + dispute.period = newPeriod; dispute.lastPeriodChange = event.block.timestamp; dispute.save(); } +export function handleRuling(event: Ruling): void { + const disputeID = event.params._disputeID.toString(); + const dispute = Dispute.load(disputeID); + if (!dispute) return; + dispute.ruled = true; + dispute.save(); + updateCasesRuled(ONE, event.block.timestamp); +} + export function handleAppealDecision(event: AppealDecision): void { const contract = KlerosCore.bind(event.address); const disputeID = event.params._disputeID; @@ -133,8 +152,6 @@ export function handleStakeSet(event: StakeSet): void { const jurorAddress = event.params._address.toHexString(); ensureUser(jurorAddress); const courtID = event.params._courtID; - let jurorTokens = ensureJurorTokensPerCourt(jurorAddress, courtID.toString()); - const previousStake = jurorTokens.staked; updateJurorStake( jurorAddress, @@ -142,10 +159,6 @@ export function handleStakeSet(event: StakeSet): void { KlerosCore.bind(event.address), event.block.timestamp ); - - const amountStaked = event.params._newTotalStake; - - updateStakedPNK(getDelta(previousStake, amountStaked), event.block.timestamp); } export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void { @@ -169,6 +182,6 @@ export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void { event.block.timestamp ); court.paidETH = court.paidETH.plus(ethAmount); - court.paidPNK = court.paidETH.plus(tokenAmount); + court.paidPNK = court.paidPNK.plus(tokenAmount); court.save(); } diff --git a/subgraph/src/datapoint.ts b/subgraph/src/datapoint.ts index e08d8a357..63e8db1ee 100644 --- a/subgraph/src/datapoint.ts +++ b/subgraph/src/datapoint.ts @@ -20,19 +20,34 @@ function updateDataPoint( timestamp: BigInt, variable: string ): void { - let counter = store.get("Counter", "0"); - if (!counter) { - counter = new Entity(); - for (let i = 0; i < VARIABLES.length; i++) { - counter.set(VARIABLES[i], Value.fromBigInt(ZERO)); - } + const newCounter = new Entity(); + const counter = store.get("Counter", "0"); + for (let i = 0; i < VARIABLES.length; i++) { + const currentVar = VARIABLES[i]; + newCounter.set( + currentVar, + getNewValue(currentVar, variable, delta, counter) + ); } const dayID = timestamp.toI32() / 86400; const dayStartTimestamp = dayID * 86400; - const newValue = counter.get(variable)!.toBigInt().plus(delta); - counter.set(variable, Value.fromBigInt(newValue)); - store.set("Counter", dayStartTimestamp.toString(), counter); - store.set("Counter", "0", counter); + store.set("Counter", dayStartTimestamp.toString(), newCounter); + store.set("Counter", "0", newCounter); +} + +function getNewValue( + currentVar: string, + targetVar: string, + delta: BigInt, + counter: Entity | null +): Value { + if (currentVar === targetVar) { + return !counter + ? Value.fromBigInt(delta) + : Value.fromBigInt(counter.get(currentVar)!.toBigInt().plus(delta)); + } else { + return !counter ? Value.fromBigInt(ZERO) : counter.get(currentVar)!; + } } export function updateStakedPNK(delta: BigInt, timestamp: BigInt): void { diff --git a/subgraph/src/entities/ClassicRound.ts b/subgraph/src/entities/ClassicRound.ts index 9bfbbbd98..63b78e742 100644 --- a/subgraph/src/entities/ClassicRound.ts +++ b/subgraph/src/entities/ClassicRound.ts @@ -1,28 +1,58 @@ import { BigInt } from "@graphprotocol/graph-ts"; import { Contribution } from "../../generated/DisputeKitClassic/DisputeKitClassic"; import { ClassicRound } from "../../generated/schema"; -import { ZERO } from "../utils"; +import { ONE, ZERO } from "../utils"; export function createClassicRound( disputeID: string, + numberOfChoices: BigInt, roundIndex: BigInt ): void { + const choicesLength = numberOfChoices.plus(ONE); const localDisputeID = `1-${disputeID}`; const id = `${localDisputeID}-${roundIndex.toString()}`; const classicRound = new ClassicRound(id); classicRound.localDispute = localDisputeID; - classicRound.votes = []; classicRound.winningChoice = ZERO; - classicRound.counts = []; + classicRound.counts = new Array(choicesLength.toI32()).fill(ZERO); classicRound.tied = true; classicRound.totalVoted = ZERO; classicRound.totalCommited = ZERO; - classicRound.paidFees = []; + classicRound.paidFees = new Array(choicesLength.toI32()).fill(ZERO); classicRound.feeRewards = ZERO; classicRound.fundedChoices = []; classicRound.save(); } +export function updateCounts(id: string, choice: BigInt): void { + const round = ClassicRound.load(id); + if (!round) return; + const choiceNum = choice.toI32(); + const updatedCount = round.counts[choiceNum].plus(ONE); + let newCounts: BigInt[] = []; + for (let i = 0; i < round.counts.length; i++) { + if (BigInt.fromI32(i).equals(choice)) { + newCounts.push(round.counts[i].plus(ONE)); + } else { + newCounts.push(round.counts[i]); + } + } + round.counts = newCounts; + const currentWinningCount = round.counts[round.winningChoice.toI32()]; + if (choice.equals(round.winningChoice)) { + if (round.tied) round.tied = false; + } else { + if (updatedCount.equals(currentWinningCount)) { + if (!round.tied) round.tied = true; + } else if (updatedCount.gt(currentWinningCount)) { + round.winningChoice = choice; + round.tied = false; + } + } + round.totalVoted = round.totalVoted.plus(ONE); + round.save(); +} + export function updateChoiceFundingFromContributionEvent( event: Contribution ): void { @@ -37,6 +67,14 @@ export function updateChoiceFundingFromContributionEvent( const choice = event.params._choice; const amount = event.params._amount; const currentPaidFees = classicRound.paidFees[choice.toI32()]; - classicRound.paidFees[choice.toI32()] = currentPaidFees.plus(amount); + let newPaidFees: BigInt[] = []; + for (let i = 0; i < classicRound.paidFees.length; i++) { + if (BigInt.fromI32(i).equals(choice)) { + newPaidFees.push(currentPaidFees.plus(amount)); + } else { + newPaidFees.push(classicRound.paidFees[i]); + } + } + classicRound.paidFees = newPaidFees; classicRound.save(); } diff --git a/subgraph/src/entities/JurorTokensPerCourt.ts b/subgraph/src/entities/JurorTokensPerCourt.ts index be4d755ee..2241d4a3d 100644 --- a/subgraph/src/entities/JurorTokensPerCourt.ts +++ b/subgraph/src/entities/JurorTokensPerCourt.ts @@ -1,8 +1,8 @@ import { BigInt, Address } from "@graphprotocol/graph-ts"; import { KlerosCore } from "../../generated/KlerosCore/KlerosCore"; import { Court, JurorTokensPerCourt } from "../../generated/schema"; -import { updateActiveJurors, getDelta } from "../datapoint"; -import { ensureUser } from "./Juror"; +import { updateActiveJurors, getDelta, updateStakedPNK } from "../datapoint"; +import { ensureUser } from "./User"; import { ZERO } from "../utils"; export function ensureJurorTokensPerCourt( @@ -61,9 +61,10 @@ export function updateJurorStake( jurorTokens.staked = jurorBalance.value0; jurorTokens.locked = jurorBalance.value1; jurorTokens.save(); - const stakeDelta = getDelta(jurorTokens.staked, previousStake); + const stakeDelta = getDelta(previousStake, jurorTokens.staked); juror.totalStake = juror.totalStake.plus(stakeDelta); court.stake = court.stake.plus(stakeDelta); + updateStakedPNK(stakeDelta, timestamp); let activeJurorsDelta: BigInt; let numberStakedJurorsDelta: BigInt; if (previousTotalStake.equals(ZERO)) { diff --git a/subgraph/src/entities/Juror.ts b/subgraph/src/entities/User.ts similarity index 76% rename from subgraph/src/entities/Juror.ts rename to subgraph/src/entities/User.ts index 8db9d3790..6d49bb895 100644 --- a/subgraph/src/entities/Juror.ts +++ b/subgraph/src/entities/User.ts @@ -1,7 +1,8 @@ import { User } from "../../generated/schema"; +import { ZERO } from "../utils"; export function ensureUser(id: string): User { - let user = User.load(id); + const user = User.load(id); if (user) { return user; @@ -12,6 +13,7 @@ export function ensureUser(id: string): User { export function createUserFromAddress(id: string): User { const user = new User(id); + user.totalStake = ZERO; user.save(); return user; diff --git a/subgraph/subgraph.yaml b/subgraph/subgraph.yaml index ac9752492..a10916488 100644 --- a/subgraph/subgraph.yaml +++ b/subgraph/subgraph.yaml @@ -6,27 +6,24 @@ dataSources: name: KlerosCore network: arbitrum-goerli source: - address: "0x4d7858e73a8842b5e6422D08a3349924dD062AbB" + address: "0x3eED6aaCa43f4Bb98C591e4A0d2C4a124efF9C24" abi: KlerosCore - startBlock: 4027978 + startBlock: 6456845 mapping: kind: ethereum/events apiVersion: 0.0.6 language: wasm/assemblyscript entities: - - Court - - Juror + - User + - Arbitrable - TokenAndETHShift - JurorTokensPerCourt + - Court + - Dispute - Round - Draw - - Dispute - DisputeKit - - PNKStakedDataPoint - - ETHPaidDataPoint - - PNKRedistributedDataPoint - - ActiveJurorsDataPoint - - CasesDataPoint + - Counter abis: - name: KlerosCore file: ../contracts/deployments/arbitrumGoerli/KlerosCore.json @@ -51,14 +48,16 @@ dataSources: handler: handleStakeSet - event: TokenAndETHShift(indexed address,indexed uint256,int256,int256) handler: handleTokenAndETHShift + - event: Ruling(indexed address,indexed uint256,uint256) + handler: handleRuling file: ./src/KlerosCore.ts - kind: ethereum name: PolicyRegistry network: arbitrum-goerli source: - address: "0xAF0F49Fe110b48bd512F00d51D141F023c9a9106" + address: "0xC5655728387Ce5E2aAA22138114E5777370aBDae" abi: PolicyRegistry - startBlock: 4027973 + startBlock: 6456907 mapping: kind: ethereum/events apiVersion: 0.0.6 @@ -76,16 +75,20 @@ dataSources: name: DisputeKitClassic network: arbitrum-goerli source: - address: "0xde31F2245d164620d08f5b0f8D43dCe8B9708373" + address: "0x86734488ABF0E1AD40bc4DE4F820e808f39Bea09" abi: DisputeKitClassic - startBlock: 4027976 + startBlock: 6456825 mapping: kind: ethereum/events apiVersion: 0.0.6 language: wasm/assemblyscript entities: - - EvidenceGroup - - Evidence + - ClassicDispute + - ClassicRound + - ClassicVote + - ClassicEvidenceGroup + - ClassicEvidence + - ClassicContribution abis: - name: DisputeKitClassic file: ../contracts/deployments/arbitrumGoerli/DisputeKitClassic.json @@ -94,11 +97,11 @@ dataSources: 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: Withdrawal(indexed uint256,indexed uint256,uint256,indexed address,uint256) + handler: handleWithdrawal - event: ChoiceFunded(indexed uint256,indexed uint256,indexed uint256) handler: handleChoiceFunded - - event: Evidence(indexed address,indexed uint256,indexed address,string) + - event: Evidence(indexed uint256,indexed address,string) handler: handleEvidenceEvent - event: Justification(indexed uint256,indexed address,indexed uint256,string) handler: handleJustificationEvent diff --git a/web/codegen.yaml b/web/codegen.yaml index 9a47307ab..e865e7646 100644 --- a/web/codegen.yaml +++ b/web/codegen.yaml @@ -1,4 +1,4 @@ -schema: https://api.thegraph.com/subgraphs/name/alcercu/kleros-core +schema: https://api.thegraph.com/subgraphs/name/alcercu/kleroscoretest documents: './src/hooks/queries/*.ts' generates: src/graphql/generated.ts: diff --git a/web/netlify.toml b/web/netlify.toml index 68fbd9418..8cf55aefd 100644 --- a/web/netlify.toml +++ b/web/netlify.toml @@ -6,3 +6,6 @@ NETLIFY_YARN_WORKSPACES = "true" YARN_ENABLE_GLOBAL_CACHE = "true" # YARN_CACHE_FOLDER = "$HOME/.yarn_cache" # YARN_VERSION = "3.2.0" + +[functions] +directory = "web/netlify/functions/" diff --git a/web/netlify/functions/uploadToIPFS.ts b/web/netlify/functions/uploadToIPFS.ts new file mode 100644 index 000000000..dba1562fb --- /dev/null +++ b/web/netlify/functions/uploadToIPFS.ts @@ -0,0 +1,31 @@ +import { Handler } from "@netlify/functions"; +import fetch from "node-fetch"; + +const ESTUARI_API_KEY = process.env["ESTUARY_API_KEY"]; +const ESTUARI_URL = process.env["ESTUARY_GATEWAY"]; + +export const handler: Handler = async (event, context) => { + context.callbackWaitsForEmptyEventLoop = false; + if (event.body) { + const newHeaders = event.headers; + delete newHeaders.host; + const response = await fetch(ESTUARI_URL, { + method: "POST", + headers: { + Authorization: `Bearer ${ESTUARI_API_KEY}`, + ...newHeaders, + }, + body: Buffer.from(event.body, "base64"), + }); + + const parsedResponse = await response.json(); + return { + statusCode: response.status, + body: JSON.stringify(parsedResponse), + }; + } + return { + statusCode: 500, + body: JSON.stringify({ message: "Invalid body format" }), + }; +}; diff --git a/web/package.json b/web/package.json index 590eb7fd9..3a53125c3 100644 --- a/web/package.json +++ b/web/package.json @@ -32,9 +32,11 @@ "generate": "graphql-codegen" }, "devDependencies": { - "@parcel/transformer-svg-react": "^2.7.0", - "@types/react": "^18.0.24", - "@types/react-dom": "^18.0.6", + "@netlify/functions": "^1.4.0", + "@parcel/transformer-svg-react": "~2.7.0", + "@parcel/watcher": "~2.0.0", + "@types/react": "^18.0.25", + "@types/react-dom": "^18.0.9", "@types/styled-components": "^5.1.26", "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", @@ -49,7 +51,6 @@ "eslint-plugin-security": "^1.4.0", "eslint-utils": "^3.0.0", "lru-cache": "^7.8.0", - "parcel": "^2.7.0", "prettier": "^2.5.1", "typescript": "^4.5.5" }, @@ -58,7 +59,9 @@ "@graphql-codegen/typescript": "^2.8.1", "@graphql-codegen/typescript-operations": "^2.5.6", "@kleros/kleros-v2-contracts": "workspace:^", - "@kleros/ui-components-library": "^1.9.0", + "@kleros/ui-components-library": "^1.9.2", + "@sentry/react": "^7.37.2", + "@sentry/tracing": "^7.37.2", "@types/react-modal": "^3.13.1", "@web3-react/core": "^6.1.9", "@web3-react/injected-connector": "^6.0.7", @@ -70,6 +73,7 @@ "graphql": "^16.4.0", "graphql-request": "^5.0.0", "moment": "^2.29.4", + "parcel": "~2.7.0", "react": "^18.2.0", "react-chartjs-2": "^4.3.1", "react-dom": "^18.2.0", @@ -77,8 +81,12 @@ "react-is": "^18.2.0", "react-jazzicon": "^1.0.4", "react-loading-skeleton": "^3.1.0", + "react-markdown": "^8.0.3", "react-modal": "^3.16.1", "react-router-dom": "^6.4.2", + "react-scripts": "^5.0.1", + "react-toastify": "^9.1.1", + "react-use": "^17.4.0", "styled-components": "^5.3.6", "swr": "^1.3.0" }, diff --git a/web/scripts/sentry-release.sh b/web/scripts/sentry-release.sh new file mode 100755 index 000000000..5f0630240 --- /dev/null +++ b/web/scripts/sentry-release.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +cd $SCRIPT_DIR/.. + +version="court-v2@v$(cat package.json | jq -r .version)-$(git rev-parse --short HEAD)" +sentry-cli releases new "$version" +sentry-cli releases set-commits "$version" --auto + +rm -rf dist/ +yarn build +sentry-cli releases files $version upload-sourcemaps dist/ + +sentry-cli releases finalize "$version" + +cd - diff --git a/web/src/app.tsx b/web/src/app.tsx index c45c47017..77c139b3f 100644 --- a/web/src/app.tsx +++ b/web/src/app.tsx @@ -10,11 +10,14 @@ import Layout from "layout/index"; import Home from "./pages/Home"; import Cases from "./pages/Cases"; import Dashboard from "./pages/Dashboard"; +import Courts from "./pages/Courts"; + +import "react-toastify/dist/ReactToastify.css"; const fetcherBuilder = (url: string) => ({ query, variables }: { query: string; variables?: any }) => { - console.log("fetching subgraph"); + console.log("fetching subgraph", query, variables); return request(url, query, variables); }; @@ -24,7 +27,7 @@ const App: React.FC = () => { @@ -34,7 +37,7 @@ const App: React.FC = () => { }> } /> } /> - Courts} /> + } /> } /> - - + + + - - + diff --git a/web/src/assets/svgs/icons/dice.svg b/web/src/assets/svgs/icons/dice.svg new file mode 100644 index 000000000..afe49f09d --- /dev/null +++ b/web/src/assets/svgs/icons/dice.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/src/assets/svgs/icons/gavel.svg b/web/src/assets/svgs/icons/gavel.svg new file mode 100644 index 000000000..09a015734 --- /dev/null +++ b/web/src/assets/svgs/icons/gavel.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/src/assets/svgs/icons/hourglass.svg b/web/src/assets/svgs/icons/hourglass.svg new file mode 100644 index 000000000..7b2102723 --- /dev/null +++ b/web/src/assets/svgs/icons/hourglass.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/web/src/assets/svgs/icons/locker.svg b/web/src/assets/svgs/icons/locker.svg new file mode 100644 index 000000000..5047c6ba3 --- /dev/null +++ b/web/src/assets/svgs/icons/locker.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/src/assets/svgs/icons/min-stake.svg b/web/src/assets/svgs/icons/min-stake.svg new file mode 100644 index 000000000..02ad227ba --- /dev/null +++ b/web/src/assets/svgs/icons/min-stake.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/web/src/assets/svgs/icons/vote-stake.svg b/web/src/assets/svgs/icons/vote-stake.svg new file mode 100644 index 000000000..945ad28ed --- /dev/null +++ b/web/src/assets/svgs/icons/vote-stake.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/web/src/components/CasesDisplay/index.tsx b/web/src/components/CasesDisplay/index.tsx index bb6ae4b21..a02a5e4fc 100644 --- a/web/src/components/CasesDisplay/index.tsx +++ b/web/src/components/CasesDisplay/index.tsx @@ -28,15 +28,19 @@ const CasesDisplay: React.FC = ({ - + {disputes.length > 0 ? ( + + ) : ( +

wow no cases

+ )} ); diff --git a/web/src/components/ConnectButton.tsx b/web/src/components/ConnectButton.tsx index 8f539c856..86c9a765b 100644 --- a/web/src/components/ConnectButton.tsx +++ b/web/src/components/ConnectButton.tsx @@ -4,7 +4,7 @@ import { shortenAddress } from "utils/shortenAddress"; import { Button } from "@kleros/ui-components-library"; import { useWeb3 } from "hooks/useWeb3"; import { useConnect } from "hooks/useConnect"; -import { SUPPORTED_CHAINS } from "consts/supportedChains"; +import { SUPPORTED_CHAINS } from "consts/chains"; const AccountDisplay: React.FC = () => { const { account, chainId } = useWeb3(); diff --git a/web/src/components/DisputeCard/DisputeInfo.tsx b/web/src/components/DisputeCard/DisputeInfo.tsx index 327096d96..0371db5bf 100644 --- a/web/src/components/DisputeCard/DisputeInfo.tsx +++ b/web/src/components/DisputeCard/DisputeInfo.tsx @@ -5,37 +5,7 @@ import LawBalanceIcon from "svgs/icons/law-balance.svg"; import BookmarkIcon from "svgs/icons/bookmark.svg"; import PileCoinsIcon from "svgs/icons/pile-coins.svg"; import CalendarIcon from "svgs/icons/calendar.svg"; - -const FieldContainer = styled.div` - width: 100%; - display: flex; - align-items: center; - justify-content: flex-start; - .value { - flex-grow: 1; - text-align: end; - color: ${({ theme }) => theme.primaryText}; - } - svg { - fill: ${({ theme }) => theme.secondaryPurple}; - margin-right: 8px; - width: 15px; - } -`; - -interface IField { - icon: React.FunctionComponent>; - name: string; - value: string; -} - -const Field: React.FC = ({ icon: Icon, name, value }) => ( - - {} - - - -); +import Field from "../Field"; const Container = styled.div` display: flex; @@ -45,11 +15,11 @@ const Container = styled.div` const getPeriodPhrase = (period: Periods) => { switch (period) { - case Periods.Evidence: + case Periods.evidence: return "Voting Starts"; - case Periods.Appeal: + case Periods.appeal: return "Appeal Deadline"; - case Periods.Execution: + case Periods.execution: return "Final Decision"; default: return "Voting Deadline"; @@ -57,6 +27,7 @@ const getPeriodPhrase = (period: Periods) => { }; export interface IDisputeInfo { + courtId?: string; court?: string; category?: string; rewards?: string; @@ -65,26 +36,37 @@ export interface IDisputeInfo { } const DisputeInfo: React.FC = ({ + courtId, court, category, rewards, period, date, -}) => ( - - {category && } - {court && } - {rewards && ( - - )} - {typeof period !== "undefined" && date && ( - - )} - -); - +}) => { + return ( + + {category && ( + + )} + {court && courtId && ( + + )} + {rewards && ( + + )} + {typeof period !== "undefined" && date && ( + + )} + + ); +}; export default DisputeInfo; diff --git a/web/src/components/DisputeCard/PeriodBanner.tsx b/web/src/components/DisputeCard/PeriodBanner.tsx index 4d22fa41e..7e1ee779f 100644 --- a/web/src/components/DisputeCard/PeriodBanner.tsx +++ b/web/src/components/DisputeCard/PeriodBanner.tsx @@ -9,9 +9,9 @@ export interface IPeriodBanner { const getPeriodColors = (period: Periods, theme: Theme): [string, string] => { switch (period) { - case Periods.Appeal: + case Periods.appeal: return [theme.tint, theme.tintMedium]; - case Periods.Execution: + case Periods.execution: return [theme.secondaryPurple, theme.mediumPurple]; default: return [theme.primaryBlue, theme.mediumBlue]; @@ -56,9 +56,9 @@ const Container = styled.div>` const getPeriodLabel = (period: Periods) => { switch (period) { - case Periods.Appeal: + case Periods.appeal: return "Crowdfunding Appeal"; - case Periods.Execution: + case Periods.execution: return "Closed"; default: return "In Progress"; diff --git a/web/src/components/DisputeCard/index.tsx b/web/src/components/DisputeCard/index.tsx index 5d0cfd234..109901646 100644 --- a/web/src/components/DisputeCard/index.tsx +++ b/web/src/components/DisputeCard/index.tsx @@ -7,7 +7,6 @@ import { Card } from "@kleros/ui-components-library"; import { Periods } from "consts/periods"; import { useGetMetaEvidence } from "queries/useGetMetaEvidence"; import { useCourtPolicy } from "queries/useCourtPolicy"; -import { useIPFSQuery } from "hooks/useIPFSQuery"; import { CasesPageQuery } from "queries/useCasesQuery"; import PeriodBanner from "./PeriodBanner"; import DisputeInfo from "./DisputeInfo"; @@ -30,7 +29,7 @@ const Container = styled.div` } `; -const getTimeLeft = ( +const getPeriodEndTimestamp = ( lastPeriodChange: string, currentPeriodIndex: number, timesPerPeriod: string[] @@ -44,22 +43,21 @@ const DisputeCard: React.FC = ({ arbitrated, period, lastPeriodChange, - courtID, + court, }) => { const currentPeriodIndex = Periods[period]; - const rewards = `≥ ${utils.formatEther(courtID.feeForJuror)} ETH`; + const rewards = `≥ ${utils.formatEther(court.feeForJuror)} ETH`; const date = currentPeriodIndex === 4 ? lastPeriodChange - : getTimeLeft( + : getPeriodEndTimestamp( lastPeriodChange, currentPeriodIndex, - courtID.timesPerPeriod + court.timesPerPeriod ); - const { data: metaEvidence } = useGetMetaEvidence(id, arbitrated); + const { data: metaEvidence } = useGetMetaEvidence(id, arbitrated.id); const title = metaEvidence ? metaEvidence.title : ; - const { data: courtPolicyPath } = useCourtPolicy(parseInt(courtID.id)); - const { data: courtPolicy } = useIPFSQuery(courtPolicyPath?.args._policy); + const { data: courtPolicy } = useCourtPolicy(court.id); const courtName = courtPolicy?.name; const category = metaEvidence ? metaEvidence.category : undefined; const navigate = useNavigate(); @@ -69,6 +67,7 @@ const DisputeCard: React.FC = ({

{title}

= ({ evidence, sender, index }) => {

{shortenAddress(sender)}

- {data && ( + {data && typeof data.fileURI !== "undefined" && ( diff --git a/web/src/components/Field.tsx b/web/src/components/Field.tsx new file mode 100644 index 000000000..7bdecf0d4 --- /dev/null +++ b/web/src/components/Field.tsx @@ -0,0 +1,54 @@ +import React from "react"; +import { Link } from "react-router-dom"; +import styled from "styled-components"; + +interface IField { + icon: React.FunctionComponent>; + name: string; + value: string; + link?: string; + width?: string; +} + +type FieldContainerProps = { + width?: string; +}; + +const Field: React.FC = ({ icon: Icon, name, value, link, width }) => ( + + {} + + {link ? ( + + {value} + + ) : ( + + )} + +); + +export default Field; + +const FieldContainer = styled.div` + width: ${({ width = "100%" }) => width}; + display: flex; + align-items: center; + justify-content: flex-start; + .value { + flex-grow: 1; + text-align: end; + color: ${({ theme }) => theme.primaryText}; + } + svg { + fill: ${({ theme }) => theme.secondaryPurple}; + margin-right: 8px; + width: 15px; + } + .link { + color: ${({ theme }) => theme.primaryBlue}; + :hover { + cursor: pointer; + } + } +`; diff --git a/web/src/components/Tag.tsx b/web/src/components/Tag.tsx new file mode 100644 index 000000000..c7c3942fb --- /dev/null +++ b/web/src/components/Tag.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import { Tag as BaseTag } from "@kleros/ui-components-library"; + +interface ITag { + text: string; + active: boolean; + onClick: () => void; +} +const Tag: React.FC = ({ text, active, onClick }) => { + return ( +
+ +
+ ); +}; + +export default Tag; diff --git a/web/src/components/WrongChainBoundary.tsx b/web/src/components/WrongChainBoundary.tsx index 4232a0228..895ed2dcb 100644 --- a/web/src/components/WrongChainBoundary.tsx +++ b/web/src/components/WrongChainBoundary.tsx @@ -3,7 +3,7 @@ import styled from "styled-components"; import { ErrorBoundary } from "react-error-boundary"; import { Button } from "@kleros/ui-components-library"; import { switchChain } from "utils/switchChain"; -import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from "consts/supportedChains"; +import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from "consts/chains"; const WrongChainRecovery: React.FC<{ resetErrorBoundary: () => void }> = ({ resetErrorBoundary, diff --git a/web/src/connectors/injected.ts b/web/src/connectors/injected.ts index ecebb57a5..38e978555 100644 --- a/web/src/connectors/injected.ts +++ b/web/src/connectors/injected.ts @@ -1,5 +1,5 @@ import { InjectedConnector } from "@web3-react/injected-connector"; -import { SUPPORTED_CHAINIDS } from "consts/supportedChains"; +import { SUPPORTED_CHAINIDS } from "consts/chains"; export const injected = new InjectedConnector({ supportedChainIds: SUPPORTED_CHAINIDS, diff --git a/web/src/consts/supportedChains.ts b/web/src/consts/chains.ts similarity index 51% rename from web/src/consts/supportedChains.ts rename to web/src/consts/chains.ts index 2fc3bb1fe..873488022 100644 --- a/web/src/consts/supportedChains.ts +++ b/web/src/consts/chains.ts @@ -12,3 +12,14 @@ export const DEFAULT_CHAIN = 421613; export const SUPPORTED_CHAINIDS = Object.keys(SUPPORTED_CHAINS).map((x) => parseInt(x) ); + +export const QUERY_CHAINS = { + 10200: { + chainName: "Chiado Testnet", + nativeCurrency: { name: "xDAI", symbol: "xDAI", decimals: 18 }, + rpcUrls: ["https://rpc.eu-central-2.gateway.fm/v3/gnosis/archival/chiado"], + blockExplorerUrls: ["https://blockscout.chiadochain.net"], + }, +}; + +export const QUERY_CHAINIDS = Object.keys(QUERY_CHAINS).map((x) => parseInt(x)); diff --git a/web/src/consts/index.ts b/web/src/consts/index.ts new file mode 100644 index 000000000..5b21a577f --- /dev/null +++ b/web/src/consts/index.ts @@ -0,0 +1,3 @@ +import { BigNumber } from "ethers"; + +export const ONE_BASIS_POINT = BigNumber.from("10000"); diff --git a/web/src/consts/periods.ts b/web/src/consts/periods.ts index 0923f101b..7a6a1b56d 100644 --- a/web/src/consts/periods.ts +++ b/web/src/consts/periods.ts @@ -1,7 +1,7 @@ export enum Periods { - Evidence, - Commit, - Vote, - Appeal, - Execution, + evidence, + commit, + vote, + appeal, + execution, } diff --git a/web/src/favicon.ico b/web/src/favicon.ico new file mode 100644 index 000000000..16a8426ee Binary files /dev/null and b/web/src/favicon.ico differ diff --git a/web/src/graphql/generated.ts b/web/src/graphql/generated.ts index 0af901d08..9bb847625 100644 --- a/web/src/graphql/generated.ts +++ b/web/src/graphql/generated.ts @@ -21,15 +21,25 @@ export type Scalars = { Bytes: any; }; -export type ActiveJurorsDataPoint = { - __typename?: "ActiveJurorsDataPoint"; +export type Arbitrable = { + __typename?: "Arbitrable"; + disputes: Array; id: Scalars["ID"]; - value: Scalars["BigInt"]; + totalDisputes: Scalars["BigInt"]; +}; + +export type ArbitrableDisputesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; }; -export type ActiveJurorsDataPoint_Filter = { +export type Arbitrable_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; + disputes_?: InputMaybe; id?: InputMaybe; id_gt?: InputMaybe; id_gte?: InputMaybe; @@ -38,19 +48,20 @@ export type ActiveJurorsDataPoint_Filter = { id_lte?: InputMaybe; id_not?: InputMaybe; id_not_in?: InputMaybe>; - value?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not?: InputMaybe; - value_not_in?: InputMaybe>; + totalDisputes?: InputMaybe; + totalDisputes_gt?: InputMaybe; + totalDisputes_gte?: InputMaybe; + totalDisputes_in?: InputMaybe>; + totalDisputes_lt?: InputMaybe; + totalDisputes_lte?: InputMaybe; + totalDisputes_not?: InputMaybe; + totalDisputes_not_in?: InputMaybe>; }; -export enum ActiveJurorsDataPoint_OrderBy { +export enum Arbitrable_OrderBy { + Disputes = "disputes", Id = "id", - Value = "value", + TotalDisputes = "totalDisputes", } export type BlockChangedFilter = { @@ -63,15 +74,244 @@ export type Block_Height = { number_gte?: InputMaybe; }; -export type CasesDataPoint = { - __typename?: "CasesDataPoint"; +export type ClassicContribution = Contribution & { + __typename?: "ClassicContribution"; + amount: Scalars["BigInt"]; + choice: Scalars["BigInt"]; + contributor: User; + coreDispute: Dispute; + id: Scalars["ID"]; + localRound: ClassicRound; + rewardWithdrawn: Scalars["Boolean"]; +}; + +export type ClassicContribution_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + amount?: InputMaybe; + amount_gt?: InputMaybe; + amount_gte?: InputMaybe; + amount_in?: InputMaybe>; + amount_lt?: InputMaybe; + amount_lte?: InputMaybe; + amount_not?: InputMaybe; + amount_not_in?: InputMaybe>; + choice?: InputMaybe; + choice_gt?: InputMaybe; + choice_gte?: InputMaybe; + choice_in?: InputMaybe>; + choice_lt?: InputMaybe; + choice_lte?: InputMaybe; + choice_not?: InputMaybe; + choice_not_in?: InputMaybe>; + contributor?: InputMaybe; + contributor_?: InputMaybe; + contributor_contains?: InputMaybe; + contributor_contains_nocase?: InputMaybe; + contributor_ends_with?: InputMaybe; + contributor_ends_with_nocase?: InputMaybe; + contributor_gt?: InputMaybe; + contributor_gte?: InputMaybe; + contributor_in?: InputMaybe>; + contributor_lt?: InputMaybe; + contributor_lte?: InputMaybe; + contributor_not?: InputMaybe; + contributor_not_contains?: InputMaybe; + contributor_not_contains_nocase?: InputMaybe; + contributor_not_ends_with?: InputMaybe; + contributor_not_ends_with_nocase?: InputMaybe; + contributor_not_in?: InputMaybe>; + contributor_not_starts_with?: InputMaybe; + contributor_not_starts_with_nocase?: InputMaybe; + contributor_starts_with?: InputMaybe; + contributor_starts_with_nocase?: InputMaybe; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + localRound?: InputMaybe; + localRound_?: InputMaybe; + localRound_contains?: InputMaybe; + localRound_contains_nocase?: InputMaybe; + localRound_ends_with?: InputMaybe; + localRound_ends_with_nocase?: InputMaybe; + localRound_gt?: InputMaybe; + localRound_gte?: InputMaybe; + localRound_in?: InputMaybe>; + localRound_lt?: InputMaybe; + localRound_lte?: InputMaybe; + localRound_not?: InputMaybe; + localRound_not_contains?: InputMaybe; + localRound_not_contains_nocase?: InputMaybe; + localRound_not_ends_with?: InputMaybe; + localRound_not_ends_with_nocase?: InputMaybe; + localRound_not_in?: InputMaybe>; + localRound_not_starts_with?: InputMaybe; + localRound_not_starts_with_nocase?: InputMaybe; + localRound_starts_with?: InputMaybe; + localRound_starts_with_nocase?: InputMaybe; + rewardWithdrawn?: InputMaybe; + rewardWithdrawn_in?: InputMaybe>; + rewardWithdrawn_not?: InputMaybe; + rewardWithdrawn_not_in?: InputMaybe>; +}; + +export enum ClassicContribution_OrderBy { + Amount = "amount", + Choice = "choice", + Contributor = "contributor", + CoreDispute = "coreDispute", + Id = "id", + LocalRound = "localRound", + RewardWithdrawn = "rewardWithdrawn", +} + +export type ClassicDispute = DisputeKitDispute & { + __typename?: "ClassicDispute"; + coreDispute: Dispute; + currentLocalRoundIndex: Scalars["BigInt"]; + extraData: Scalars["Bytes"]; + id: Scalars["ID"]; + jumped: Scalars["Boolean"]; + localRounds: Array; + numberOfChoices: Scalars["BigInt"]; +}; + +export type ClassicDisputeLocalRoundsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type ClassicDispute_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; + currentLocalRoundIndex?: InputMaybe; + currentLocalRoundIndex_gt?: InputMaybe; + currentLocalRoundIndex_gte?: InputMaybe; + currentLocalRoundIndex_in?: InputMaybe>; + currentLocalRoundIndex_lt?: InputMaybe; + currentLocalRoundIndex_lte?: InputMaybe; + currentLocalRoundIndex_not?: InputMaybe; + currentLocalRoundIndex_not_in?: InputMaybe>; + extraData?: InputMaybe; + extraData_contains?: InputMaybe; + extraData_gt?: InputMaybe; + extraData_gte?: InputMaybe; + extraData_in?: InputMaybe>; + extraData_lt?: InputMaybe; + extraData_lte?: InputMaybe; + extraData_not?: InputMaybe; + extraData_not_contains?: InputMaybe; + extraData_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + jumped?: InputMaybe; + jumped_in?: InputMaybe>; + jumped_not?: InputMaybe; + jumped_not_in?: InputMaybe>; + localRounds_?: InputMaybe; + numberOfChoices?: InputMaybe; + numberOfChoices_gt?: InputMaybe; + numberOfChoices_gte?: InputMaybe; + numberOfChoices_in?: InputMaybe>; + numberOfChoices_lt?: InputMaybe; + numberOfChoices_lte?: InputMaybe; + numberOfChoices_not?: InputMaybe; + numberOfChoices_not_in?: InputMaybe>; +}; + +export enum ClassicDispute_OrderBy { + CoreDispute = "coreDispute", + CurrentLocalRoundIndex = "currentLocalRoundIndex", + ExtraData = "extraData", + Id = "id", + Jumped = "jumped", + LocalRounds = "localRounds", + NumberOfChoices = "numberOfChoices", +} + +export type ClassicEvidence = Evidence & { + __typename?: "ClassicEvidence"; + evidence: Scalars["String"]; + evidenceGroup: EvidenceGroup; + id: Scalars["ID"]; + sender: User; +}; + +export type ClassicEvidenceGroup = EvidenceGroup & { + __typename?: "ClassicEvidenceGroup"; + evidences: Array; id: Scalars["ID"]; - value: Scalars["BigInt"]; + nextEvidenceIndex: Scalars["BigInt"]; }; -export type CasesDataPoint_Filter = { +export type ClassicEvidenceGroupEvidencesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type ClassicEvidenceGroup_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; + evidences_?: InputMaybe; id?: InputMaybe; id_gt?: InputMaybe; id_gte?: InputMaybe; @@ -80,19 +320,521 @@ export type CasesDataPoint_Filter = { id_lte?: InputMaybe; id_not?: InputMaybe; id_not_in?: InputMaybe>; - value?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not?: InputMaybe; - value_not_in?: InputMaybe>; + nextEvidenceIndex?: InputMaybe; + nextEvidenceIndex_gt?: InputMaybe; + nextEvidenceIndex_gte?: InputMaybe; + nextEvidenceIndex_in?: InputMaybe>; + nextEvidenceIndex_lt?: InputMaybe; + nextEvidenceIndex_lte?: InputMaybe; + nextEvidenceIndex_not?: InputMaybe; + nextEvidenceIndex_not_in?: InputMaybe>; }; -export enum CasesDataPoint_OrderBy { +export enum ClassicEvidenceGroup_OrderBy { + Evidences = "evidences", Id = "id", - Value = "value", + NextEvidenceIndex = "nextEvidenceIndex", +} + +export type ClassicEvidence_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + evidence?: InputMaybe; + evidenceGroup?: InputMaybe; + evidenceGroup_?: InputMaybe; + evidenceGroup_contains?: InputMaybe; + evidenceGroup_contains_nocase?: InputMaybe; + evidenceGroup_ends_with?: InputMaybe; + evidenceGroup_ends_with_nocase?: InputMaybe; + evidenceGroup_gt?: InputMaybe; + evidenceGroup_gte?: InputMaybe; + evidenceGroup_in?: InputMaybe>; + evidenceGroup_lt?: InputMaybe; + evidenceGroup_lte?: InputMaybe; + evidenceGroup_not?: InputMaybe; + evidenceGroup_not_contains?: InputMaybe; + evidenceGroup_not_contains_nocase?: InputMaybe; + evidenceGroup_not_ends_with?: InputMaybe; + evidenceGroup_not_ends_with_nocase?: InputMaybe; + evidenceGroup_not_in?: InputMaybe>; + evidenceGroup_not_starts_with?: InputMaybe; + evidenceGroup_not_starts_with_nocase?: InputMaybe; + evidenceGroup_starts_with?: InputMaybe; + evidenceGroup_starts_with_nocase?: InputMaybe; + evidence_contains?: InputMaybe; + evidence_contains_nocase?: InputMaybe; + evidence_ends_with?: InputMaybe; + evidence_ends_with_nocase?: InputMaybe; + evidence_gt?: InputMaybe; + evidence_gte?: InputMaybe; + evidence_in?: InputMaybe>; + evidence_lt?: InputMaybe; + evidence_lte?: InputMaybe; + evidence_not?: InputMaybe; + evidence_not_contains?: InputMaybe; + evidence_not_contains_nocase?: InputMaybe; + evidence_not_ends_with?: InputMaybe; + evidence_not_ends_with_nocase?: InputMaybe; + evidence_not_in?: InputMaybe>; + evidence_not_starts_with?: InputMaybe; + evidence_not_starts_with_nocase?: InputMaybe; + evidence_starts_with?: InputMaybe; + evidence_starts_with_nocase?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + sender?: InputMaybe; + sender_?: InputMaybe; + sender_contains?: InputMaybe; + sender_contains_nocase?: InputMaybe; + sender_ends_with?: InputMaybe; + sender_ends_with_nocase?: InputMaybe; + sender_gt?: InputMaybe; + sender_gte?: InputMaybe; + sender_in?: InputMaybe>; + sender_lt?: InputMaybe; + sender_lte?: InputMaybe; + sender_not?: InputMaybe; + sender_not_contains?: InputMaybe; + sender_not_contains_nocase?: InputMaybe; + sender_not_ends_with?: InputMaybe; + sender_not_ends_with_nocase?: InputMaybe; + sender_not_in?: InputMaybe>; + sender_not_starts_with?: InputMaybe; + sender_not_starts_with_nocase?: InputMaybe; + sender_starts_with?: InputMaybe; + sender_starts_with_nocase?: InputMaybe; +}; + +export enum ClassicEvidence_OrderBy { + Evidence = "evidence", + EvidenceGroup = "evidenceGroup", + Id = "id", + Sender = "sender", +} + +export type ClassicRound = DisputeKitRound & { + __typename?: "ClassicRound"; + contributions: Array; + counts: Array; + feeRewards: Scalars["BigInt"]; + fundedChoices: Array; + id: Scalars["ID"]; + localDispute: DisputeKitDispute; + paidFees: Array; + tied: Scalars["Boolean"]; + totalCommited: Scalars["BigInt"]; + totalVoted: Scalars["BigInt"]; + votes: Array; + winningChoice: Scalars["BigInt"]; +}; + +export type ClassicRoundContributionsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type ClassicRoundVotesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type ClassicRound_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + contributions_?: InputMaybe; + counts?: InputMaybe>; + counts_contains?: InputMaybe>; + counts_contains_nocase?: InputMaybe>; + counts_not?: InputMaybe>; + counts_not_contains?: InputMaybe>; + counts_not_contains_nocase?: InputMaybe>; + feeRewards?: InputMaybe; + feeRewards_gt?: InputMaybe; + feeRewards_gte?: InputMaybe; + feeRewards_in?: InputMaybe>; + feeRewards_lt?: InputMaybe; + feeRewards_lte?: InputMaybe; + feeRewards_not?: InputMaybe; + feeRewards_not_in?: InputMaybe>; + fundedChoices?: InputMaybe>; + fundedChoices_contains?: InputMaybe>; + fundedChoices_contains_nocase?: InputMaybe>; + fundedChoices_not?: InputMaybe>; + fundedChoices_not_contains?: InputMaybe>; + fundedChoices_not_contains_nocase?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + localDispute?: InputMaybe; + localDispute_?: InputMaybe; + localDispute_contains?: InputMaybe; + localDispute_contains_nocase?: InputMaybe; + localDispute_ends_with?: InputMaybe; + localDispute_ends_with_nocase?: InputMaybe; + localDispute_gt?: InputMaybe; + localDispute_gte?: InputMaybe; + localDispute_in?: InputMaybe>; + localDispute_lt?: InputMaybe; + localDispute_lte?: InputMaybe; + localDispute_not?: InputMaybe; + localDispute_not_contains?: InputMaybe; + localDispute_not_contains_nocase?: InputMaybe; + localDispute_not_ends_with?: InputMaybe; + localDispute_not_ends_with_nocase?: InputMaybe; + localDispute_not_in?: InputMaybe>; + localDispute_not_starts_with?: InputMaybe; + localDispute_not_starts_with_nocase?: InputMaybe; + localDispute_starts_with?: InputMaybe; + localDispute_starts_with_nocase?: InputMaybe; + paidFees?: InputMaybe>; + paidFees_contains?: InputMaybe>; + paidFees_contains_nocase?: InputMaybe>; + paidFees_not?: InputMaybe>; + paidFees_not_contains?: InputMaybe>; + paidFees_not_contains_nocase?: InputMaybe>; + tied?: InputMaybe; + tied_in?: InputMaybe>; + tied_not?: InputMaybe; + tied_not_in?: InputMaybe>; + totalCommited?: InputMaybe; + totalCommited_gt?: InputMaybe; + totalCommited_gte?: InputMaybe; + totalCommited_in?: InputMaybe>; + totalCommited_lt?: InputMaybe; + totalCommited_lte?: InputMaybe; + totalCommited_not?: InputMaybe; + totalCommited_not_in?: InputMaybe>; + totalVoted?: InputMaybe; + totalVoted_gt?: InputMaybe; + totalVoted_gte?: InputMaybe; + totalVoted_in?: InputMaybe>; + totalVoted_lt?: InputMaybe; + totalVoted_lte?: InputMaybe; + totalVoted_not?: InputMaybe; + totalVoted_not_in?: InputMaybe>; + votes_?: InputMaybe; + winningChoice?: InputMaybe; + winningChoice_gt?: InputMaybe; + winningChoice_gte?: InputMaybe; + winningChoice_in?: InputMaybe>; + winningChoice_lt?: InputMaybe; + winningChoice_lte?: InputMaybe; + winningChoice_not?: InputMaybe; + winningChoice_not_in?: InputMaybe>; +}; + +export enum ClassicRound_OrderBy { + Contributions = "contributions", + Counts = "counts", + FeeRewards = "feeRewards", + FundedChoices = "fundedChoices", + Id = "id", + LocalDispute = "localDispute", + PaidFees = "paidFees", + Tied = "tied", + TotalCommited = "totalCommited", + TotalVoted = "totalVoted", + Votes = "votes", + WinningChoice = "winningChoice", +} + +export type ClassicVote = Vote & { + __typename?: "ClassicVote"; + choice: Scalars["BigInt"]; + coreDispute: Dispute; + id: Scalars["ID"]; + juror: User; + justification: Scalars["String"]; + localRound: DisputeKitRound; +}; + +export type ClassicVote_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + choice?: InputMaybe; + choice_gt?: InputMaybe; + choice_gte?: InputMaybe; + choice_in?: InputMaybe>; + choice_lt?: InputMaybe; + choice_lte?: InputMaybe; + choice_not?: InputMaybe; + choice_not_in?: InputMaybe>; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + juror?: InputMaybe; + juror_?: InputMaybe; + juror_contains?: InputMaybe; + juror_contains_nocase?: InputMaybe; + juror_ends_with?: InputMaybe; + juror_ends_with_nocase?: InputMaybe; + juror_gt?: InputMaybe; + juror_gte?: InputMaybe; + juror_in?: InputMaybe>; + juror_lt?: InputMaybe; + juror_lte?: InputMaybe; + juror_not?: InputMaybe; + juror_not_contains?: InputMaybe; + juror_not_contains_nocase?: InputMaybe; + juror_not_ends_with?: InputMaybe; + juror_not_ends_with_nocase?: InputMaybe; + juror_not_in?: InputMaybe>; + juror_not_starts_with?: InputMaybe; + juror_not_starts_with_nocase?: InputMaybe; + juror_starts_with?: InputMaybe; + juror_starts_with_nocase?: InputMaybe; + justification?: InputMaybe; + justification_contains?: InputMaybe; + justification_contains_nocase?: InputMaybe; + justification_ends_with?: InputMaybe; + justification_ends_with_nocase?: InputMaybe; + justification_gt?: InputMaybe; + justification_gte?: InputMaybe; + justification_in?: InputMaybe>; + justification_lt?: InputMaybe; + justification_lte?: InputMaybe; + justification_not?: InputMaybe; + justification_not_contains?: InputMaybe; + justification_not_contains_nocase?: InputMaybe; + justification_not_ends_with?: InputMaybe; + justification_not_ends_with_nocase?: InputMaybe; + justification_not_in?: InputMaybe>; + justification_not_starts_with?: InputMaybe; + justification_not_starts_with_nocase?: InputMaybe; + justification_starts_with?: InputMaybe; + justification_starts_with_nocase?: InputMaybe; + localRound?: InputMaybe; + localRound_?: InputMaybe; + localRound_contains?: InputMaybe; + localRound_contains_nocase?: InputMaybe; + localRound_ends_with?: InputMaybe; + localRound_ends_with_nocase?: InputMaybe; + localRound_gt?: InputMaybe; + localRound_gte?: InputMaybe; + localRound_in?: InputMaybe>; + localRound_lt?: InputMaybe; + localRound_lte?: InputMaybe; + localRound_not?: InputMaybe; + localRound_not_contains?: InputMaybe; + localRound_not_contains_nocase?: InputMaybe; + localRound_not_ends_with?: InputMaybe; + localRound_not_ends_with_nocase?: InputMaybe; + localRound_not_in?: InputMaybe>; + localRound_not_starts_with?: InputMaybe; + localRound_not_starts_with_nocase?: InputMaybe; + localRound_starts_with?: InputMaybe; + localRound_starts_with_nocase?: InputMaybe; +}; + +export enum ClassicVote_OrderBy { + Choice = "choice", + CoreDispute = "coreDispute", + Id = "id", + Juror = "juror", + Justification = "justification", + LocalRound = "localRound", +} + +export type Contribution = { + contributor: User; + coreDispute: Dispute; + id: Scalars["ID"]; +}; + +export type Contribution_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + contributor?: InputMaybe; + contributor_?: InputMaybe; + contributor_contains?: InputMaybe; + contributor_contains_nocase?: InputMaybe; + contributor_ends_with?: InputMaybe; + contributor_ends_with_nocase?: InputMaybe; + contributor_gt?: InputMaybe; + contributor_gte?: InputMaybe; + contributor_in?: InputMaybe>; + contributor_lt?: InputMaybe; + contributor_lte?: InputMaybe; + contributor_not?: InputMaybe; + contributor_not_contains?: InputMaybe; + contributor_not_contains_nocase?: InputMaybe; + contributor_not_ends_with?: InputMaybe; + contributor_not_ends_with_nocase?: InputMaybe; + contributor_not_in?: InputMaybe>; + contributor_not_starts_with?: InputMaybe; + contributor_not_starts_with_nocase?: InputMaybe; + contributor_starts_with?: InputMaybe; + contributor_starts_with_nocase?: InputMaybe; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; +}; + +export enum Contribution_OrderBy { + Contributor = "contributor", + CoreDispute = "coreDispute", + Id = "id", +} + +export type Counter = { + __typename?: "Counter"; + activeJurors: Scalars["BigInt"]; + cases: Scalars["BigInt"]; + casesRuled: Scalars["BigInt"]; + casesVoting: Scalars["BigInt"]; + id: Scalars["ID"]; + paidETH: Scalars["BigInt"]; + redistributedPNK: Scalars["BigInt"]; + stakedPNK: Scalars["BigInt"]; +}; + +export type Counter_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + activeJurors?: InputMaybe; + activeJurors_gt?: InputMaybe; + activeJurors_gte?: InputMaybe; + activeJurors_in?: InputMaybe>; + activeJurors_lt?: InputMaybe; + activeJurors_lte?: InputMaybe; + activeJurors_not?: InputMaybe; + activeJurors_not_in?: InputMaybe>; + cases?: InputMaybe; + casesRuled?: InputMaybe; + casesRuled_gt?: InputMaybe; + casesRuled_gte?: InputMaybe; + casesRuled_in?: InputMaybe>; + casesRuled_lt?: InputMaybe; + casesRuled_lte?: InputMaybe; + casesRuled_not?: InputMaybe; + casesRuled_not_in?: InputMaybe>; + casesVoting?: InputMaybe; + casesVoting_gt?: InputMaybe; + casesVoting_gte?: InputMaybe; + casesVoting_in?: InputMaybe>; + casesVoting_lt?: InputMaybe; + casesVoting_lte?: InputMaybe; + casesVoting_not?: InputMaybe; + casesVoting_not_in?: InputMaybe>; + cases_gt?: InputMaybe; + cases_gte?: InputMaybe; + cases_in?: InputMaybe>; + cases_lt?: InputMaybe; + cases_lte?: InputMaybe; + cases_not?: InputMaybe; + cases_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + paidETH?: InputMaybe; + paidETH_gt?: InputMaybe; + paidETH_gte?: InputMaybe; + paidETH_in?: InputMaybe>; + paidETH_lt?: InputMaybe; + paidETH_lte?: InputMaybe; + paidETH_not?: InputMaybe; + paidETH_not_in?: InputMaybe>; + redistributedPNK?: InputMaybe; + redistributedPNK_gt?: InputMaybe; + redistributedPNK_gte?: InputMaybe; + redistributedPNK_in?: InputMaybe>; + redistributedPNK_lt?: InputMaybe; + redistributedPNK_lte?: InputMaybe; + redistributedPNK_not?: InputMaybe; + redistributedPNK_not_in?: InputMaybe>; + stakedPNK?: InputMaybe; + stakedPNK_gt?: InputMaybe; + stakedPNK_gte?: InputMaybe; + stakedPNK_in?: InputMaybe>; + stakedPNK_lt?: InputMaybe; + stakedPNK_lte?: InputMaybe; + stakedPNK_not?: InputMaybe; + stakedPNK_not_in?: InputMaybe>; +}; + +export enum Counter_OrderBy { + ActiveJurors = "activeJurors", + Cases = "cases", + CasesRuled = "casesRuled", + CasesVoting = "casesVoting", + Id = "id", + PaidEth = "paidETH", + RedistributedPnk = "redistributedPNK", + StakedPnk = "stakedPNK", } export type Court = { @@ -105,12 +847,17 @@ export type Court = { id: Scalars["ID"]; jurorsForCourtJump: Scalars["BigInt"]; minStake: Scalars["BigInt"]; + name?: Maybe; + numberDisputes: Scalars["BigInt"]; + numberStakedJurors: Scalars["BigInt"]; + paidETH: Scalars["BigInt"]; + paidPNK: Scalars["BigInt"]; parent?: Maybe; policy?: Maybe; - stakedJurors: Array; + stake: Scalars["BigInt"]; + stakedJurors: Array; supportedDisputeKits: Array; timesPerPeriod: Array; - tokens: Array; }; export type CourtChildrenArgs = { @@ -131,10 +878,10 @@ export type CourtDisputesArgs = { export type CourtStakedJurorsArgs = { first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; - where?: InputMaybe; + where?: InputMaybe; }; export type CourtSupportedDisputeKitsArgs = { @@ -145,14 +892,6 @@ export type CourtSupportedDisputeKitsArgs = { where?: InputMaybe; }; -export type CourtTokensArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - export type Court_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; @@ -202,6 +941,58 @@ export type Court_Filter = { minStake_lte?: InputMaybe; minStake_not?: InputMaybe; minStake_not_in?: InputMaybe>; + name?: InputMaybe; + name_contains?: InputMaybe; + name_contains_nocase?: InputMaybe; + name_ends_with?: InputMaybe; + name_ends_with_nocase?: InputMaybe; + name_gt?: InputMaybe; + name_gte?: InputMaybe; + name_in?: InputMaybe>; + name_lt?: InputMaybe; + name_lte?: InputMaybe; + name_not?: InputMaybe; + name_not_contains?: InputMaybe; + name_not_contains_nocase?: InputMaybe; + name_not_ends_with?: InputMaybe; + name_not_ends_with_nocase?: InputMaybe; + name_not_in?: InputMaybe>; + name_not_starts_with?: InputMaybe; + name_not_starts_with_nocase?: InputMaybe; + name_starts_with?: InputMaybe; + name_starts_with_nocase?: InputMaybe; + numberDisputes?: InputMaybe; + numberDisputes_gt?: InputMaybe; + numberDisputes_gte?: InputMaybe; + numberDisputes_in?: InputMaybe>; + numberDisputes_lt?: InputMaybe; + numberDisputes_lte?: InputMaybe; + numberDisputes_not?: InputMaybe; + numberDisputes_not_in?: InputMaybe>; + numberStakedJurors?: InputMaybe; + numberStakedJurors_gt?: InputMaybe; + numberStakedJurors_gte?: InputMaybe; + numberStakedJurors_in?: InputMaybe>; + numberStakedJurors_lt?: InputMaybe; + numberStakedJurors_lte?: InputMaybe; + numberStakedJurors_not?: InputMaybe; + numberStakedJurors_not_in?: InputMaybe>; + paidETH?: InputMaybe; + paidETH_gt?: InputMaybe; + paidETH_gte?: InputMaybe; + paidETH_in?: InputMaybe>; + paidETH_lt?: InputMaybe; + paidETH_lte?: InputMaybe; + paidETH_not?: InputMaybe; + paidETH_not_in?: InputMaybe>; + paidPNK?: InputMaybe; + paidPNK_gt?: InputMaybe; + paidPNK_gte?: InputMaybe; + paidPNK_in?: InputMaybe>; + paidPNK_lt?: InputMaybe; + paidPNK_lte?: InputMaybe; + paidPNK_not?: InputMaybe; + paidPNK_not_in?: InputMaybe>; parent?: InputMaybe; parent_?: InputMaybe; parent_contains?: InputMaybe; @@ -243,7 +1034,15 @@ export type Court_Filter = { policy_not_starts_with_nocase?: InputMaybe; policy_starts_with?: InputMaybe; policy_starts_with_nocase?: InputMaybe; - stakedJurors_?: InputMaybe; + stake?: InputMaybe; + stake_gt?: InputMaybe; + stake_gte?: InputMaybe; + stake_in?: InputMaybe>; + stake_lt?: InputMaybe; + stake_lte?: InputMaybe; + stake_not?: InputMaybe; + stake_not_in?: InputMaybe>; + stakedJurors_?: InputMaybe; supportedDisputeKits?: InputMaybe>; supportedDisputeKits_?: InputMaybe; supportedDisputeKits_contains?: InputMaybe>; @@ -259,7 +1058,6 @@ export type Court_Filter = { timesPerPeriod_not?: InputMaybe>; timesPerPeriod_not_contains?: InputMaybe>; timesPerPeriod_not_contains_nocase?: InputMaybe>; - tokens_?: InputMaybe; }; export enum Court_OrderBy { @@ -271,36 +1069,32 @@ export enum Court_OrderBy { Id = "id", JurorsForCourtJump = "jurorsForCourtJump", MinStake = "minStake", + Name = "name", + NumberDisputes = "numberDisputes", + NumberStakedJurors = "numberStakedJurors", + PaidEth = "paidETH", + PaidPnk = "paidPNK", Parent = "parent", Policy = "policy", + Stake = "stake", StakedJurors = "stakedJurors", SupportedDisputeKits = "supportedDisputeKits", TimesPerPeriod = "timesPerPeriod", - Tokens = "tokens", } export type Dispute = { __typename?: "Dispute"; - arbitrated: Scalars["Bytes"]; - currentRound: Scalars["Int"]; - draws: Array; - gatewayDispute: GatewayDispute; + arbitrated: Arbitrable; + court: Court; + currentRound: Round; + currentRoundIndex: Scalars["BigInt"]; + disputeKitDispute?: Maybe; id: Scalars["ID"]; lastPeriodChange: Scalars["BigInt"]; period: Period; rounds: Array; ruled: Scalars["Boolean"]; shifts: Array; - subcourtID: Court; - votes: Array; -}; - -export type DisputeDrawsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; }; export type DisputeRoundsArgs = { @@ -319,14 +1113,6 @@ export type DisputeShiftsArgs = { where?: InputMaybe; }; -export type DisputeVotesArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - export type DisputeKit = { __typename?: "DisputeKit"; address?: Maybe; @@ -363,12 +1149,136 @@ export type DisputeKitRoundsArgs = { where?: InputMaybe; }; +export type DisputeKitDispute = { + coreDispute: Dispute; + currentLocalRoundIndex: Scalars["BigInt"]; + id: Scalars["ID"]; + localRounds: Array; +}; + +export type DisputeKitDisputeLocalRoundsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type DisputeKitDispute_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; + currentLocalRoundIndex?: InputMaybe; + currentLocalRoundIndex_gt?: InputMaybe; + currentLocalRoundIndex_gte?: InputMaybe; + currentLocalRoundIndex_in?: InputMaybe>; + currentLocalRoundIndex_lt?: InputMaybe; + currentLocalRoundIndex_lte?: InputMaybe; + currentLocalRoundIndex_not?: InputMaybe; + currentLocalRoundIndex_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + localRounds_?: InputMaybe; +}; + +export enum DisputeKitDispute_OrderBy { + CoreDispute = "coreDispute", + CurrentLocalRoundIndex = "currentLocalRoundIndex", + Id = "id", + LocalRounds = "localRounds", +} + +export type DisputeKitRound = { + id: Scalars["ID"]; + localDispute: DisputeKitDispute; + votes: Array; +}; + +export type DisputeKitRoundVotesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type DisputeKitRound_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + localDispute?: InputMaybe; + localDispute_?: InputMaybe; + localDispute_contains?: InputMaybe; + localDispute_contains_nocase?: InputMaybe; + localDispute_ends_with?: InputMaybe; + localDispute_ends_with_nocase?: InputMaybe; + localDispute_gt?: InputMaybe; + localDispute_gte?: InputMaybe; + localDispute_in?: InputMaybe>; + localDispute_lt?: InputMaybe; + localDispute_lte?: InputMaybe; + localDispute_not?: InputMaybe; + localDispute_not_contains?: InputMaybe; + localDispute_not_contains_nocase?: InputMaybe; + localDispute_not_ends_with?: InputMaybe; + localDispute_not_ends_with_nocase?: InputMaybe; + localDispute_not_in?: InputMaybe>; + localDispute_not_starts_with?: InputMaybe; + localDispute_not_starts_with_nocase?: InputMaybe; + localDispute_starts_with?: InputMaybe; + localDispute_starts_with_nocase?: InputMaybe; + votes_?: InputMaybe; +}; + +export enum DisputeKitRound_OrderBy { + Id = "id", + LocalDispute = "localDispute", + Votes = "votes", +} + export type DisputeKit_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; address?: InputMaybe; address_contains?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; address_in?: InputMaybe>; + address_lt?: InputMaybe; + address_lte?: InputMaybe; address_not?: InputMaybe; address_not_contains?: InputMaybe; address_not_in?: InputMaybe>; @@ -432,22 +1342,78 @@ export enum DisputeKit_OrderBy { export type Dispute_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; - arbitrated?: InputMaybe; - arbitrated_contains?: InputMaybe; - arbitrated_in?: InputMaybe>; - arbitrated_not?: InputMaybe; - arbitrated_not_contains?: InputMaybe; - arbitrated_not_in?: InputMaybe>; - currentRound?: InputMaybe; - currentRound_gt?: InputMaybe; - currentRound_gte?: InputMaybe; - currentRound_in?: InputMaybe>; - currentRound_lt?: InputMaybe; - currentRound_lte?: InputMaybe; - currentRound_not?: InputMaybe; - currentRound_not_in?: InputMaybe>; - draws_?: InputMaybe; - gatewayDispute_?: InputMaybe; + arbitrated?: InputMaybe; + arbitrated_?: InputMaybe; + arbitrated_contains?: InputMaybe; + arbitrated_contains_nocase?: InputMaybe; + arbitrated_ends_with?: InputMaybe; + arbitrated_ends_with_nocase?: InputMaybe; + arbitrated_gt?: InputMaybe; + arbitrated_gte?: InputMaybe; + arbitrated_in?: InputMaybe>; + arbitrated_lt?: InputMaybe; + arbitrated_lte?: InputMaybe; + arbitrated_not?: InputMaybe; + arbitrated_not_contains?: InputMaybe; + arbitrated_not_contains_nocase?: InputMaybe; + arbitrated_not_ends_with?: InputMaybe; + arbitrated_not_ends_with_nocase?: InputMaybe; + arbitrated_not_in?: InputMaybe>; + arbitrated_not_starts_with?: InputMaybe; + arbitrated_not_starts_with_nocase?: InputMaybe; + arbitrated_starts_with?: InputMaybe; + arbitrated_starts_with_nocase?: InputMaybe; + court?: InputMaybe; + court_?: InputMaybe; + court_contains?: InputMaybe; + court_contains_nocase?: InputMaybe; + court_ends_with?: InputMaybe; + court_ends_with_nocase?: InputMaybe; + court_gt?: InputMaybe; + court_gte?: InputMaybe; + court_in?: InputMaybe>; + court_lt?: InputMaybe; + court_lte?: InputMaybe; + court_not?: InputMaybe; + court_not_contains?: InputMaybe; + court_not_contains_nocase?: InputMaybe; + court_not_ends_with?: InputMaybe; + court_not_ends_with_nocase?: InputMaybe; + court_not_in?: InputMaybe>; + court_not_starts_with?: InputMaybe; + court_not_starts_with_nocase?: InputMaybe; + court_starts_with?: InputMaybe; + court_starts_with_nocase?: InputMaybe; + currentRound?: InputMaybe; + currentRoundIndex?: InputMaybe; + currentRoundIndex_gt?: InputMaybe; + currentRoundIndex_gte?: InputMaybe; + currentRoundIndex_in?: InputMaybe>; + currentRoundIndex_lt?: InputMaybe; + currentRoundIndex_lte?: InputMaybe; + currentRoundIndex_not?: InputMaybe; + currentRoundIndex_not_in?: InputMaybe>; + currentRound_?: InputMaybe; + currentRound_contains?: InputMaybe; + currentRound_contains_nocase?: InputMaybe; + currentRound_ends_with?: InputMaybe; + currentRound_ends_with_nocase?: InputMaybe; + currentRound_gt?: InputMaybe; + currentRound_gte?: InputMaybe; + currentRound_in?: InputMaybe>; + currentRound_lt?: InputMaybe; + currentRound_lte?: InputMaybe; + currentRound_not?: InputMaybe; + currentRound_not_contains?: InputMaybe; + currentRound_not_contains_nocase?: InputMaybe; + currentRound_not_ends_with?: InputMaybe; + currentRound_not_ends_with_nocase?: InputMaybe; + currentRound_not_in?: InputMaybe>; + currentRound_not_starts_with?: InputMaybe; + currentRound_not_starts_with_nocase?: InputMaybe; + currentRound_starts_with?: InputMaybe; + currentRound_starts_with_nocase?: InputMaybe; + disputeKitDispute_?: InputMaybe; id?: InputMaybe; id_gt?: InputMaybe; id_gte?: InputMaybe; @@ -474,50 +1440,27 @@ export type Dispute_Filter = { ruled_not?: InputMaybe; ruled_not_in?: InputMaybe>; shifts_?: InputMaybe; - subcourtID?: InputMaybe; - subcourtID_?: InputMaybe; - subcourtID_contains?: InputMaybe; - subcourtID_contains_nocase?: InputMaybe; - subcourtID_ends_with?: InputMaybe; - subcourtID_ends_with_nocase?: InputMaybe; - subcourtID_gt?: InputMaybe; - subcourtID_gte?: InputMaybe; - subcourtID_in?: InputMaybe>; - subcourtID_lt?: InputMaybe; - subcourtID_lte?: InputMaybe; - subcourtID_not?: InputMaybe; - subcourtID_not_contains?: InputMaybe; - subcourtID_not_contains_nocase?: InputMaybe; - subcourtID_not_ends_with?: InputMaybe; - subcourtID_not_ends_with_nocase?: InputMaybe; - subcourtID_not_in?: InputMaybe>; - subcourtID_not_starts_with?: InputMaybe; - subcourtID_not_starts_with_nocase?: InputMaybe; - subcourtID_starts_with?: InputMaybe; - subcourtID_starts_with_nocase?: InputMaybe; - votes_?: InputMaybe; }; export enum Dispute_OrderBy { Arbitrated = "arbitrated", + Court = "court", CurrentRound = "currentRound", - Draws = "draws", - GatewayDispute = "gatewayDispute", + CurrentRoundIndex = "currentRoundIndex", + DisputeKitDispute = "disputeKitDispute", Id = "id", LastPeriodChange = "lastPeriodChange", Period = "period", Rounds = "rounds", Ruled = "ruled", Shifts = "shifts", - SubcourtId = "subcourtID", - Votes = "votes", } export type Draw = { __typename?: "Draw"; dispute: Dispute; id: Scalars["ID"]; - juror: Juror; + juror: User; round: Round; voteID: Scalars["BigInt"]; }; @@ -555,7 +1498,7 @@ export type Draw_Filter = { id_not?: InputMaybe; id_not_in?: InputMaybe>; juror?: InputMaybe; - juror_?: InputMaybe; + juror_?: InputMaybe; juror_contains?: InputMaybe; juror_contains_nocase?: InputMaybe; juror_ends_with?: InputMaybe; @@ -614,51 +1557,17 @@ export enum Draw_OrderBy { VoteId = "voteID", } -export type EthPaidDataPoint = { - __typename?: "ETHPaidDataPoint"; - id: Scalars["ID"]; - value: Scalars["BigInt"]; -}; - -export type EthPaidDataPoint_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - value?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not?: InputMaybe; - value_not_in?: InputMaybe>; -}; - -export enum EthPaidDataPoint_OrderBy { - Id = "id", - Value = "value", -} - export type Evidence = { - __typename?: "Evidence"; evidence: Scalars["String"]; evidenceGroup: EvidenceGroup; id: Scalars["ID"]; - sender: Scalars["Bytes"]; + sender: User; }; export type EvidenceGroup = { - __typename?: "EvidenceGroup"; evidences: Array; id: Scalars["ID"]; - lastEvidenceID: Scalars["BigInt"]; + nextEvidenceIndex: Scalars["BigInt"]; }; export type EvidenceGroupEvidencesArgs = { @@ -681,20 +1590,20 @@ export type EvidenceGroup_Filter = { id_lte?: InputMaybe; id_not?: InputMaybe; id_not_in?: InputMaybe>; - lastEvidenceID?: InputMaybe; - lastEvidenceID_gt?: InputMaybe; - lastEvidenceID_gte?: InputMaybe; - lastEvidenceID_in?: InputMaybe>; - lastEvidenceID_lt?: InputMaybe; - lastEvidenceID_lte?: InputMaybe; - lastEvidenceID_not?: InputMaybe; - lastEvidenceID_not_in?: InputMaybe>; + nextEvidenceIndex?: InputMaybe; + nextEvidenceIndex_gt?: InputMaybe; + nextEvidenceIndex_gte?: InputMaybe; + nextEvidenceIndex_in?: InputMaybe>; + nextEvidenceIndex_lt?: InputMaybe; + nextEvidenceIndex_lte?: InputMaybe; + nextEvidenceIndex_not?: InputMaybe; + nextEvidenceIndex_not_in?: InputMaybe>; }; export enum EvidenceGroup_OrderBy { Evidences = "evidences", Id = "id", - LastEvidenceId = "lastEvidenceID", + NextEvidenceIndex = "nextEvidenceIndex", } export type Evidence_Filter = { @@ -748,154 +1657,70 @@ export type Evidence_Filter = { id_lt?: InputMaybe; id_lte?: InputMaybe; id_not?: InputMaybe; - id_not_in?: InputMaybe>; - sender?: InputMaybe; - sender_contains?: InputMaybe; - sender_in?: InputMaybe>; - sender_not?: InputMaybe; - sender_not_contains?: InputMaybe; - sender_not_in?: InputMaybe>; -}; - -export enum Evidence_OrderBy { - Evidence = "evidence", - EvidenceGroup = "evidenceGroup", - Id = "id", - Sender = "sender", -} - -export type GatewayDispute = { - __typename?: "GatewayDispute"; - arbitrationCost: Scalars["BigInt"]; - arbitrator: Scalars["Bytes"]; - disputeHash: Scalars["Bytes"]; - homeDispute: Dispute; - id: Scalars["ID"]; - relayer: Scalars["Bytes"]; -}; - -export type GatewayDispute_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - arbitrationCost?: InputMaybe; - arbitrationCost_gt?: InputMaybe; - arbitrationCost_gte?: InputMaybe; - arbitrationCost_in?: InputMaybe>; - arbitrationCost_lt?: InputMaybe; - arbitrationCost_lte?: InputMaybe; - arbitrationCost_not?: InputMaybe; - arbitrationCost_not_in?: InputMaybe>; - arbitrator?: InputMaybe; - arbitrator_contains?: InputMaybe; - arbitrator_in?: InputMaybe>; - arbitrator_not?: InputMaybe; - arbitrator_not_contains?: InputMaybe; - arbitrator_not_in?: InputMaybe>; - disputeHash?: InputMaybe; - disputeHash_contains?: InputMaybe; - disputeHash_in?: InputMaybe>; - disputeHash_not?: InputMaybe; - disputeHash_not_contains?: InputMaybe; - disputeHash_not_in?: InputMaybe>; - homeDispute?: InputMaybe; - homeDispute_?: InputMaybe; - homeDispute_contains?: InputMaybe; - homeDispute_contains_nocase?: InputMaybe; - homeDispute_ends_with?: InputMaybe; - homeDispute_ends_with_nocase?: InputMaybe; - homeDispute_gt?: InputMaybe; - homeDispute_gte?: InputMaybe; - homeDispute_in?: InputMaybe>; - homeDispute_lt?: InputMaybe; - homeDispute_lte?: InputMaybe; - homeDispute_not?: InputMaybe; - homeDispute_not_contains?: InputMaybe; - homeDispute_not_contains_nocase?: InputMaybe; - homeDispute_not_ends_with?: InputMaybe; - homeDispute_not_ends_with_nocase?: InputMaybe; - homeDispute_not_in?: InputMaybe>; - homeDispute_not_starts_with?: InputMaybe; - homeDispute_not_starts_with_nocase?: InputMaybe; - homeDispute_starts_with?: InputMaybe; - homeDispute_starts_with_nocase?: InputMaybe; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - relayer?: InputMaybe; - relayer_contains?: InputMaybe; - relayer_in?: InputMaybe>; - relayer_not?: InputMaybe; - relayer_not_contains?: InputMaybe; - relayer_not_in?: InputMaybe>; -}; - -export enum GatewayDispute_OrderBy { - ArbitrationCost = "arbitrationCost", - Arbitrator = "arbitrator", - DisputeHash = "disputeHash", - HomeDispute = "homeDispute", - Id = "id", - Relayer = "relayer", -} - -export type Juror = { - __typename?: "Juror"; - draws: Array; - id: Scalars["ID"]; - shifts: Array; - tokens: Array; - votes: Array; -}; - -export type JurorDrawsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type JurorShiftsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type JurorTokensArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type JurorVotesArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; + id_not_in?: InputMaybe>; + sender?: InputMaybe; + sender_?: InputMaybe; + sender_contains?: InputMaybe; + sender_contains_nocase?: InputMaybe; + sender_ends_with?: InputMaybe; + sender_ends_with_nocase?: InputMaybe; + sender_gt?: InputMaybe; + sender_gte?: InputMaybe; + sender_in?: InputMaybe>; + sender_lt?: InputMaybe; + sender_lte?: InputMaybe; + sender_not?: InputMaybe; + sender_not_contains?: InputMaybe; + sender_not_contains_nocase?: InputMaybe; + sender_not_ends_with?: InputMaybe; + sender_not_ends_with_nocase?: InputMaybe; + sender_not_in?: InputMaybe>; + sender_not_starts_with?: InputMaybe; + sender_not_starts_with_nocase?: InputMaybe; + sender_starts_with?: InputMaybe; + sender_starts_with_nocase?: InputMaybe; }; -export type JurorTokensPerSubcourt = { - __typename?: "JurorTokensPerSubcourt"; +export enum Evidence_OrderBy { + Evidence = "evidence", + EvidenceGroup = "evidenceGroup", + Id = "id", + Sender = "sender", +} + +export type JurorTokensPerCourt = { + __typename?: "JurorTokensPerCourt"; + court: Court; id: Scalars["ID"]; - juror: Juror; + juror: User; locked: Scalars["BigInt"]; staked: Scalars["BigInt"]; - subcourt: Court; }; -export type JurorTokensPerSubcourt_Filter = { +export type JurorTokensPerCourt_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; + court?: InputMaybe; + court_?: InputMaybe; + court_contains?: InputMaybe; + court_contains_nocase?: InputMaybe; + court_ends_with?: InputMaybe; + court_ends_with_nocase?: InputMaybe; + court_gt?: InputMaybe; + court_gte?: InputMaybe; + court_in?: InputMaybe>; + court_lt?: InputMaybe; + court_lte?: InputMaybe; + court_not?: InputMaybe; + court_not_contains?: InputMaybe; + court_not_contains_nocase?: InputMaybe; + court_not_ends_with?: InputMaybe; + court_not_ends_with_nocase?: InputMaybe; + court_not_in?: InputMaybe>; + court_not_starts_with?: InputMaybe; + court_not_starts_with_nocase?: InputMaybe; + court_starts_with?: InputMaybe; + court_starts_with_nocase?: InputMaybe; id?: InputMaybe; id_gt?: InputMaybe; id_gte?: InputMaybe; @@ -905,7 +1730,7 @@ export type JurorTokensPerSubcourt_Filter = { id_not?: InputMaybe; id_not_in?: InputMaybe>; juror?: InputMaybe; - juror_?: InputMaybe; + juror_?: InputMaybe; juror_contains?: InputMaybe; juror_contains_nocase?: InputMaybe; juror_ends_with?: InputMaybe; @@ -941,60 +1766,14 @@ export type JurorTokensPerSubcourt_Filter = { staked_lte?: InputMaybe; staked_not?: InputMaybe; staked_not_in?: InputMaybe>; - subcourt?: InputMaybe; - subcourt_?: InputMaybe; - subcourt_contains?: InputMaybe; - subcourt_contains_nocase?: InputMaybe; - subcourt_ends_with?: InputMaybe; - subcourt_ends_with_nocase?: InputMaybe; - subcourt_gt?: InputMaybe; - subcourt_gte?: InputMaybe; - subcourt_in?: InputMaybe>; - subcourt_lt?: InputMaybe; - subcourt_lte?: InputMaybe; - subcourt_not?: InputMaybe; - subcourt_not_contains?: InputMaybe; - subcourt_not_contains_nocase?: InputMaybe; - subcourt_not_ends_with?: InputMaybe; - subcourt_not_ends_with_nocase?: InputMaybe; - subcourt_not_in?: InputMaybe>; - subcourt_not_starts_with?: InputMaybe; - subcourt_not_starts_with_nocase?: InputMaybe; - subcourt_starts_with?: InputMaybe; - subcourt_starts_with_nocase?: InputMaybe; -}; - -export enum JurorTokensPerSubcourt_OrderBy { +}; + +export enum JurorTokensPerCourt_OrderBy { + Court = "court", Id = "id", Juror = "juror", Locked = "locked", Staked = "staked", - Subcourt = "subcourt", -} - -export type Juror_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - draws_?: InputMaybe; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - shifts_?: InputMaybe; - tokens_?: InputMaybe; - votes_?: InputMaybe; -}; - -export enum Juror_OrderBy { - Draws = "draws", - Id = "id", - Shifts = "shifts", - Tokens = "tokens", - Votes = "votes", } /** Defines the order direction, either ascending or descending */ @@ -1003,180 +1782,60 @@ export enum OrderDirection { Desc = "desc", } -export type OutgoingBatch = { - __typename?: "OutgoingBatch"; - batchMerkleRoot: Scalars["String"]; - epoch: Scalars["BigInt"]; - id: Scalars["ID"]; - size: Scalars["BigInt"]; -}; - -export type OutgoingBatch_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - batchMerkleRoot?: InputMaybe; - batchMerkleRoot_contains?: InputMaybe; - batchMerkleRoot_contains_nocase?: InputMaybe; - batchMerkleRoot_ends_with?: InputMaybe; - batchMerkleRoot_ends_with_nocase?: InputMaybe; - batchMerkleRoot_gt?: InputMaybe; - batchMerkleRoot_gte?: InputMaybe; - batchMerkleRoot_in?: InputMaybe>; - batchMerkleRoot_lt?: InputMaybe; - batchMerkleRoot_lte?: InputMaybe; - batchMerkleRoot_not?: InputMaybe; - batchMerkleRoot_not_contains?: InputMaybe; - batchMerkleRoot_not_contains_nocase?: InputMaybe; - batchMerkleRoot_not_ends_with?: InputMaybe; - batchMerkleRoot_not_ends_with_nocase?: InputMaybe; - batchMerkleRoot_not_in?: InputMaybe>; - batchMerkleRoot_not_starts_with?: InputMaybe; - batchMerkleRoot_not_starts_with_nocase?: InputMaybe; - batchMerkleRoot_starts_with?: InputMaybe; - batchMerkleRoot_starts_with_nocase?: InputMaybe; - epoch?: InputMaybe; - epoch_gt?: InputMaybe; - epoch_gte?: InputMaybe; - epoch_in?: InputMaybe>; - epoch_lt?: InputMaybe; - epoch_lte?: InputMaybe; - epoch_not?: InputMaybe; - epoch_not_in?: InputMaybe>; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - size?: InputMaybe; - size_gt?: InputMaybe; - size_gte?: InputMaybe; - size_in?: InputMaybe>; - size_lt?: InputMaybe; - size_lte?: InputMaybe; - size_not?: InputMaybe; - size_not_in?: InputMaybe>; -}; - -export enum OutgoingBatch_OrderBy { - BatchMerkleRoot = "batchMerkleRoot", - Epoch = "epoch", - Id = "id", - Size = "size", -} - -export type PnkRedistributedDataPoint = { - __typename?: "PNKRedistributedDataPoint"; - id: Scalars["ID"]; - value: Scalars["BigInt"]; -}; - -export type PnkRedistributedDataPoint_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - value?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not?: InputMaybe; - value_not_in?: InputMaybe>; -}; - -export enum PnkRedistributedDataPoint_OrderBy { - Id = "id", - Value = "value", -} - -export type PnkStakedDataPoint = { - __typename?: "PNKStakedDataPoint"; - id: Scalars["ID"]; - value: Scalars["BigInt"]; -}; - -export type PnkStakedDataPoint_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - value?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not?: InputMaybe; - value_not_in?: InputMaybe>; -}; - -export enum PnkStakedDataPoint_OrderBy { - Id = "id", - Value = "value", -} - export enum Period { - Appeal = "Appeal", - Commit = "Commit", - Evidence = "Evidence", - Execution = "Execution", - Vote = "Vote", + Appeal = "appeal", + Commit = "commit", + Evidence = "evidence", + Execution = "execution", + Vote = "vote", } export type Query = { __typename?: "Query"; /** Access to subgraph metadata */ _meta?: Maybe<_Meta_>; - activeJurorsDataPoint?: Maybe; - activeJurorsDataPoints: Array; - casesDataPoint?: Maybe; - casesDataPoints: Array; + arbitrable?: Maybe; + arbitrables: Array; + classicContribution?: Maybe; + classicContributions: Array; + classicDispute?: Maybe; + classicDisputes: Array; + classicEvidence?: Maybe; + classicEvidenceGroup?: Maybe; + classicEvidenceGroups: Array; + classicEvidences: Array; + classicRound?: Maybe; + classicRounds: Array; + classicVote?: Maybe; + classicVotes: Array; + contribution?: Maybe; + contributions: Array; + counter?: Maybe; + counters: Array; court?: Maybe; courts: Array; dispute?: Maybe; disputeKit?: Maybe; + disputeKitDispute?: Maybe; + disputeKitDisputes: Array; + disputeKitRound?: Maybe; + disputeKitRounds: Array; disputeKits: Array; disputes: Array; draw?: Maybe; draws: Array; - ethpaidDataPoint?: Maybe; - ethpaidDataPoints: Array; evidence?: Maybe; evidenceGroup?: Maybe; evidenceGroups: Array; evidences: Array; - gatewayDispute?: Maybe; - gatewayDisputes: Array; - juror?: Maybe; - jurorTokensPerSubcourt?: Maybe; - jurorTokensPerSubcourts: Array; - jurors: Array; - outgoingBatch?: Maybe; - outgoingBatches: Array; - pnkredistributedDataPoint?: Maybe; - pnkredistributedDataPoints: Array; - pnkstakedDataPoint?: Maybe; - pnkstakedDataPoints: Array; + jurorTokensPerCourt?: Maybe; + jurorTokensPerCourts: Array; round?: Maybe; rounds: Array; tokenAndETHShift?: Maybe; tokenAndETHShifts: Array; + user?: Maybe; + users: Array; vote?: Maybe; votes: Array; }; @@ -1185,244 +1844,292 @@ export type Query_MetaArgs = { block?: InputMaybe; }; -export type QueryActiveJurorsDataPointArgs = { +export type QueryArbitrableArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryActiveJurorsDataPointsArgs = { +export type QueryArbitrablesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryCasesDataPointArgs = { +export type QueryClassicContributionArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryCasesDataPointsArgs = { +export type QueryClassicContributionsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryCourtArgs = { +export type QueryClassicDisputeArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryCourtsArgs = { +export type QueryClassicDisputesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryDisputeArgs = { +export type QueryClassicEvidenceArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryDisputeKitArgs = { +export type QueryClassicEvidenceGroupArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryDisputeKitsArgs = { +export type QueryClassicEvidenceGroupsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryDisputesArgs = { +export type QueryClassicEvidencesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryDrawArgs = { +export type QueryClassicRoundArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryDrawsArgs = { +export type QueryClassicRoundsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryEthpaidDataPointArgs = { +export type QueryClassicVoteArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryEthpaidDataPointsArgs = { +export type QueryClassicVotesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryEvidenceArgs = { +export type QueryContributionArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryEvidenceGroupArgs = { +export type QueryContributionsArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + +export type QueryCounterArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryEvidenceGroupsArgs = { +export type QueryCountersArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryEvidencesArgs = { +export type QueryCourtArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type QueryCourtsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; +}; + +export type QueryDisputeArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type QueryDisputeKitArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryGatewayDisputeArgs = { +export type QueryDisputeKitDisputeArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryGatewayDisputesArgs = { +export type QueryDisputeKitDisputesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryJurorArgs = { +export type QueryDisputeKitRoundArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryJurorTokensPerSubcourtArgs = { +export type QueryDisputeKitRoundsArgs = { block?: InputMaybe; - id: Scalars["ID"]; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; }; -export type QueryJurorTokensPerSubcourtsArgs = { +export type QueryDisputeKitsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryJurorsArgs = { +export type QueryDisputesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryOutgoingBatchArgs = { +export type QueryDrawArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryOutgoingBatchesArgs = { +export type QueryDrawsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; +}; + +export type QueryEvidenceArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryPnkredistributedDataPointArgs = { +export type QueryEvidenceGroupArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryPnkredistributedDataPointsArgs = { +export type QueryEvidenceGroupsArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + +export type QueryEvidencesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type QueryPnkstakedDataPointArgs = { +export type QueryJurorTokensPerCourtArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type QueryPnkstakedDataPointsArgs = { +export type QueryJurorTokensPerCourtsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; export type QueryRoundArgs = { @@ -1457,6 +2164,22 @@ export type QueryTokenAndEthShiftsArgs = { where?: InputMaybe; }; +export type QueryUserArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type QueryUsersArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + export type QueryVoteArgs = { block?: InputMaybe; id: Scalars["ID"]; @@ -1476,7 +2199,7 @@ export type QueryVotesArgs = { export type Round = { __typename?: "Round"; dispute: Dispute; - disputeKitID: DisputeKit; + disputeKit: DisputeKit; drawnJurors: Array; id: Scalars["ID"]; nbVotes: Scalars["BigInt"]; @@ -1484,8 +2207,6 @@ export type Round = { repartitions: Scalars["BigInt"]; tokensAtStakePerJuror: Scalars["BigInt"]; totalFeesForJurors: Scalars["BigInt"]; - totalVoted: Scalars["BigInt"]; - votes: Array; }; export type RoundDrawnJurorsArgs = { @@ -1496,39 +2217,31 @@ export type RoundDrawnJurorsArgs = { where?: InputMaybe; }; -export type RoundVotesArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - export type Round_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; dispute?: InputMaybe; - disputeKitID?: InputMaybe; - disputeKitID_?: InputMaybe; - disputeKitID_contains?: InputMaybe; - disputeKitID_contains_nocase?: InputMaybe; - disputeKitID_ends_with?: InputMaybe; - disputeKitID_ends_with_nocase?: InputMaybe; - disputeKitID_gt?: InputMaybe; - disputeKitID_gte?: InputMaybe; - disputeKitID_in?: InputMaybe>; - disputeKitID_lt?: InputMaybe; - disputeKitID_lte?: InputMaybe; - disputeKitID_not?: InputMaybe; - disputeKitID_not_contains?: InputMaybe; - disputeKitID_not_contains_nocase?: InputMaybe; - disputeKitID_not_ends_with?: InputMaybe; - disputeKitID_not_ends_with_nocase?: InputMaybe; - disputeKitID_not_in?: InputMaybe>; - disputeKitID_not_starts_with?: InputMaybe; - disputeKitID_not_starts_with_nocase?: InputMaybe; - disputeKitID_starts_with?: InputMaybe; - disputeKitID_starts_with_nocase?: InputMaybe; + disputeKit?: InputMaybe; + disputeKit_?: InputMaybe; + disputeKit_contains?: InputMaybe; + disputeKit_contains_nocase?: InputMaybe; + disputeKit_ends_with?: InputMaybe; + disputeKit_ends_with_nocase?: InputMaybe; + disputeKit_gt?: InputMaybe; + disputeKit_gte?: InputMaybe; + disputeKit_in?: InputMaybe>; + disputeKit_lt?: InputMaybe; + disputeKit_lte?: InputMaybe; + disputeKit_not?: InputMaybe; + disputeKit_not_contains?: InputMaybe; + disputeKit_not_contains_nocase?: InputMaybe; + disputeKit_not_ends_with?: InputMaybe; + disputeKit_not_ends_with_nocase?: InputMaybe; + disputeKit_not_in?: InputMaybe>; + disputeKit_not_starts_with?: InputMaybe; + disputeKit_not_starts_with_nocase?: InputMaybe; + disputeKit_starts_with?: InputMaybe; + disputeKit_starts_with_nocase?: InputMaybe; dispute_?: InputMaybe; dispute_contains?: InputMaybe; dispute_contains_nocase?: InputMaybe; @@ -1598,20 +2311,11 @@ export type Round_Filter = { totalFeesForJurors_lte?: InputMaybe; totalFeesForJurors_not?: InputMaybe; totalFeesForJurors_not_in?: InputMaybe>; - totalVoted?: InputMaybe; - totalVoted_gt?: InputMaybe; - totalVoted_gte?: InputMaybe; - totalVoted_in?: InputMaybe>; - totalVoted_lt?: InputMaybe; - totalVoted_lte?: InputMaybe; - totalVoted_not?: InputMaybe; - totalVoted_not_in?: InputMaybe>; - votes_?: InputMaybe; }; export enum Round_OrderBy { Dispute = "dispute", - DisputeKitId = "disputeKitID", + DisputeKit = "disputeKit", DrawnJurors = "drawnJurors", Id = "id", NbVotes = "nbVotes", @@ -1619,48 +2323,54 @@ export enum Round_OrderBy { Repartitions = "repartitions", TokensAtStakePerJuror = "tokensAtStakePerJuror", TotalFeesForJurors = "totalFeesForJurors", - TotalVoted = "totalVoted", - Votes = "votes", } export type Subscription = { __typename?: "Subscription"; /** Access to subgraph metadata */ _meta?: Maybe<_Meta_>; - activeJurorsDataPoint?: Maybe; - activeJurorsDataPoints: Array; - casesDataPoint?: Maybe; - casesDataPoints: Array; + arbitrable?: Maybe; + arbitrables: Array; + classicContribution?: Maybe; + classicContributions: Array; + classicDispute?: Maybe; + classicDisputes: Array; + classicEvidence?: Maybe; + classicEvidenceGroup?: Maybe; + classicEvidenceGroups: Array; + classicEvidences: Array; + classicRound?: Maybe; + classicRounds: Array; + classicVote?: Maybe; + classicVotes: Array; + contribution?: Maybe; + contributions: Array; + counter?: Maybe; + counters: Array; court?: Maybe; courts: Array; dispute?: Maybe; disputeKit?: Maybe; + disputeKitDispute?: Maybe; + disputeKitDisputes: Array; + disputeKitRound?: Maybe; + disputeKitRounds: Array; disputeKits: Array; disputes: Array; draw?: Maybe; draws: Array; - ethpaidDataPoint?: Maybe; - ethpaidDataPoints: Array; evidence?: Maybe; evidenceGroup?: Maybe; evidenceGroups: Array; evidences: Array; - gatewayDispute?: Maybe; - gatewayDisputes: Array; - juror?: Maybe; - jurorTokensPerSubcourt?: Maybe; - jurorTokensPerSubcourts: Array; - jurors: Array; - outgoingBatch?: Maybe; - outgoingBatches: Array; - pnkredistributedDataPoint?: Maybe; - pnkredistributedDataPoints: Array; - pnkstakedDataPoint?: Maybe; - pnkstakedDataPoints: Array; + jurorTokensPerCourt?: Maybe; + jurorTokensPerCourts: Array; round?: Maybe; rounds: Array; tokenAndETHShift?: Maybe; tokenAndETHShifts: Array; + user?: Maybe; + users: Array; vote?: Maybe; votes: Array; }; @@ -1669,244 +2379,292 @@ export type Subscription_MetaArgs = { block?: InputMaybe; }; -export type SubscriptionActiveJurorsDataPointArgs = { +export type SubscriptionArbitrableArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionActiveJurorsDataPointsArgs = { +export type SubscriptionArbitrablesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionCasesDataPointArgs = { +export type SubscriptionClassicContributionArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionCasesDataPointsArgs = { +export type SubscriptionClassicContributionsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionCourtArgs = { +export type SubscriptionClassicDisputeArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionCourtsArgs = { +export type SubscriptionClassicDisputesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionDisputeArgs = { +export type SubscriptionClassicEvidenceArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionDisputeKitArgs = { +export type SubscriptionClassicEvidenceGroupArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionDisputeKitsArgs = { +export type SubscriptionClassicEvidenceGroupsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionDisputesArgs = { +export type SubscriptionClassicEvidencesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionDrawArgs = { +export type SubscriptionClassicRoundArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionDrawsArgs = { +export type SubscriptionClassicRoundsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; +}; + +export type SubscriptionClassicVoteArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionEthpaidDataPointArgs = { +export type SubscriptionClassicVotesArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + +export type SubscriptionContributionArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type SubscriptionContributionsArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + +export type SubscriptionCounterArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type SubscriptionCountersArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + +export type SubscriptionCourtArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionEthpaidDataPointsArgs = { +export type SubscriptionCourtsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionEvidenceArgs = { +export type SubscriptionDisputeArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionEvidenceGroupArgs = { +export type SubscriptionDisputeKitArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionEvidenceGroupsArgs = { +export type SubscriptionDisputeKitDisputeArgs = { block?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; + id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; }; -export type SubscriptionEvidencesArgs = { +export type SubscriptionDisputeKitDisputesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionGatewayDisputeArgs = { +export type SubscriptionDisputeKitRoundArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionGatewayDisputesArgs = { +export type SubscriptionDisputeKitRoundsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionJurorArgs = { +export type SubscriptionDisputeKitsArgs = { block?: InputMaybe; - id: Scalars["ID"]; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; }; -export type SubscriptionJurorTokensPerSubcourtArgs = { +export type SubscriptionDisputesArgs = { block?: InputMaybe; - id: Scalars["ID"]; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; }; -export type SubscriptionJurorTokensPerSubcourtsArgs = { +export type SubscriptionDrawArgs = { block?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; + id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; }; -export type SubscriptionJurorsArgs = { +export type SubscriptionDrawsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionOutgoingBatchArgs = { +export type SubscriptionEvidenceArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionOutgoingBatchesArgs = { +export type SubscriptionEvidenceGroupArgs = { block?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; + id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; }; -export type SubscriptionPnkredistributedDataPointArgs = { +export type SubscriptionEvidenceGroupsArgs = { block?: InputMaybe; - id: Scalars["ID"]; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; }; -export type SubscriptionPnkredistributedDataPointsArgs = { +export type SubscriptionEvidencesArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; -export type SubscriptionPnkstakedDataPointArgs = { +export type SubscriptionJurorTokensPerCourtArgs = { block?: InputMaybe; id: Scalars["ID"]; subgraphError?: _SubgraphErrorPolicy_; }; -export type SubscriptionPnkstakedDataPointsArgs = { +export type SubscriptionJurorTokensPerCourtsArgs = { block?: InputMaybe; first?: InputMaybe; - orderBy?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; + where?: InputMaybe; }; export type SubscriptionRoundArgs = { @@ -1941,6 +2699,22 @@ export type SubscriptionTokenAndEthShiftsArgs = { where?: InputMaybe; }; +export type SubscriptionUserArgs = { + block?: InputMaybe; + id: Scalars["ID"]; + subgraphError?: _SubgraphErrorPolicy_; +}; + +export type SubscriptionUsersArgs = { + block?: InputMaybe; + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + subgraphError?: _SubgraphErrorPolicy_; + where?: InputMaybe; +}; + export type SubscriptionVoteArgs = { block?: InputMaybe; id: Scalars["ID"]; @@ -1962,7 +2736,7 @@ export type TokenAndEthShift = { dispute: Dispute; ethAmount: Scalars["BigInt"]; id: Scalars["ID"]; - juror: Juror; + juror: User; tokenAmount: Scalars["BigInt"]; }; @@ -2007,7 +2781,7 @@ export type TokenAndEthShift_Filter = { id_not?: InputMaybe; id_not_in?: InputMaybe>; juror?: InputMaybe; - juror_?: InputMaybe; + juror_?: InputMaybe; juror_contains?: InputMaybe; juror_contains_nocase?: InputMaybe; juror_ends_with?: InputMaybe; @@ -2045,48 +2819,135 @@ export enum TokenAndEthShift_OrderBy { TokenAmount = "tokenAmount", } +export type User = { + __typename?: "User"; + contributions: Array; + draws: Array; + evidences: Array; + id: Scalars["ID"]; + shifts: Array; + tokens: Array; + totalStake: Scalars["BigInt"]; + votes: Array; +}; + +export type UserContributionsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type UserDrawsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type UserEvidencesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type UserShiftsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type UserTokensArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type UserVotesArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type User_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + contributions_?: InputMaybe; + draws_?: InputMaybe; + evidences_?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + shifts_?: InputMaybe; + tokens_?: InputMaybe; + totalStake?: InputMaybe; + totalStake_gt?: InputMaybe; + totalStake_gte?: InputMaybe; + totalStake_in?: InputMaybe>; + totalStake_lt?: InputMaybe; + totalStake_lte?: InputMaybe; + totalStake_not?: InputMaybe; + totalStake_not_in?: InputMaybe>; + votes_?: InputMaybe; +}; + +export enum User_OrderBy { + Contributions = "contributions", + Draws = "draws", + Evidences = "evidences", + Id = "id", + Shifts = "shifts", + Tokens = "tokens", + TotalStake = "totalStake", + Votes = "votes", +} + export type Vote = { - __typename?: "Vote"; - choice?: Maybe; - dispute: Dispute; + coreDispute: Dispute; id: Scalars["ID"]; - juror: Juror; - justification?: Maybe; - round: Round; + juror: User; + localRound: DisputeKitRound; }; export type Vote_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; - choice?: InputMaybe; - choice_gt?: InputMaybe; - choice_gte?: InputMaybe; - choice_in?: InputMaybe>; - choice_lt?: InputMaybe; - choice_lte?: InputMaybe; - choice_not?: InputMaybe; - choice_not_in?: InputMaybe>; - dispute?: InputMaybe; - dispute_?: InputMaybe; - dispute_contains?: InputMaybe; - dispute_contains_nocase?: InputMaybe; - dispute_ends_with?: InputMaybe; - dispute_ends_with_nocase?: InputMaybe; - dispute_gt?: InputMaybe; - dispute_gte?: InputMaybe; - dispute_in?: InputMaybe>; - dispute_lt?: InputMaybe; - dispute_lte?: InputMaybe; - dispute_not?: InputMaybe; - dispute_not_contains?: InputMaybe; - dispute_not_contains_nocase?: InputMaybe; - dispute_not_ends_with?: InputMaybe; - dispute_not_ends_with_nocase?: InputMaybe; - dispute_not_in?: InputMaybe>; - dispute_not_starts_with?: InputMaybe; - dispute_not_starts_with_nocase?: InputMaybe; - dispute_starts_with?: InputMaybe; - dispute_starts_with_nocase?: InputMaybe; + coreDispute?: InputMaybe; + coreDispute_?: InputMaybe; + coreDispute_contains?: InputMaybe; + coreDispute_contains_nocase?: InputMaybe; + coreDispute_ends_with?: InputMaybe; + coreDispute_ends_with_nocase?: InputMaybe; + coreDispute_gt?: InputMaybe; + coreDispute_gte?: InputMaybe; + coreDispute_in?: InputMaybe>; + coreDispute_lt?: InputMaybe; + coreDispute_lte?: InputMaybe; + coreDispute_not?: InputMaybe; + coreDispute_not_contains?: InputMaybe; + coreDispute_not_contains_nocase?: InputMaybe; + coreDispute_not_ends_with?: InputMaybe; + coreDispute_not_ends_with_nocase?: InputMaybe; + coreDispute_not_in?: InputMaybe>; + coreDispute_not_starts_with?: InputMaybe; + coreDispute_not_starts_with_nocase?: InputMaybe; + coreDispute_starts_with?: InputMaybe; + coreDispute_starts_with_nocase?: InputMaybe; id?: InputMaybe; id_gt?: InputMaybe; id_gte?: InputMaybe; @@ -2096,7 +2957,7 @@ export type Vote_Filter = { id_not?: InputMaybe; id_not_in?: InputMaybe>; juror?: InputMaybe; - juror_?: InputMaybe; + juror_?: InputMaybe; juror_contains?: InputMaybe; juror_contains_nocase?: InputMaybe; juror_ends_with?: InputMaybe; @@ -2116,56 +2977,34 @@ export type Vote_Filter = { juror_not_starts_with_nocase?: InputMaybe; juror_starts_with?: InputMaybe; juror_starts_with_nocase?: InputMaybe; - justification?: InputMaybe; - justification_contains?: InputMaybe; - justification_contains_nocase?: InputMaybe; - justification_ends_with?: InputMaybe; - justification_ends_with_nocase?: InputMaybe; - justification_gt?: InputMaybe; - justification_gte?: InputMaybe; - justification_in?: InputMaybe>; - justification_lt?: InputMaybe; - justification_lte?: InputMaybe; - justification_not?: InputMaybe; - justification_not_contains?: InputMaybe; - justification_not_contains_nocase?: InputMaybe; - justification_not_ends_with?: InputMaybe; - justification_not_ends_with_nocase?: InputMaybe; - justification_not_in?: InputMaybe>; - justification_not_starts_with?: InputMaybe; - justification_not_starts_with_nocase?: InputMaybe; - justification_starts_with?: InputMaybe; - justification_starts_with_nocase?: InputMaybe; - round?: InputMaybe; - round_?: InputMaybe; - round_contains?: InputMaybe; - round_contains_nocase?: InputMaybe; - round_ends_with?: InputMaybe; - round_ends_with_nocase?: InputMaybe; - round_gt?: InputMaybe; - round_gte?: InputMaybe; - round_in?: InputMaybe>; - round_lt?: InputMaybe; - round_lte?: InputMaybe; - round_not?: InputMaybe; - round_not_contains?: InputMaybe; - round_not_contains_nocase?: InputMaybe; - round_not_ends_with?: InputMaybe; - round_not_ends_with_nocase?: InputMaybe; - round_not_in?: InputMaybe>; - round_not_starts_with?: InputMaybe; - round_not_starts_with_nocase?: InputMaybe; - round_starts_with?: InputMaybe; - round_starts_with_nocase?: InputMaybe; + localRound?: InputMaybe; + localRound_?: InputMaybe; + localRound_contains?: InputMaybe; + localRound_contains_nocase?: InputMaybe; + localRound_ends_with?: InputMaybe; + localRound_ends_with_nocase?: InputMaybe; + localRound_gt?: InputMaybe; + localRound_gte?: InputMaybe; + localRound_in?: InputMaybe>; + localRound_lt?: InputMaybe; + localRound_lte?: InputMaybe; + localRound_not?: InputMaybe; + localRound_not_contains?: InputMaybe; + localRound_not_contains_nocase?: InputMaybe; + localRound_not_ends_with?: InputMaybe; + localRound_not_ends_with_nocase?: InputMaybe; + localRound_not_in?: InputMaybe>; + localRound_not_starts_with?: InputMaybe; + localRound_not_starts_with_nocase?: InputMaybe; + localRound_starts_with?: InputMaybe; + localRound_starts_with_nocase?: InputMaybe; }; export enum Vote_OrderBy { - Choice = "choice", - Dispute = "dispute", + CoreDispute = "coreDispute", Id = "id", Juror = "juror", - Justification = "justification", - Round = "round", + LocalRound = "localRound", } export type _Block_ = { @@ -2211,10 +3050,10 @@ export type CasesPageQuery = { disputes: Array<{ __typename?: "Dispute"; id: string; - arbitrated: any; period: Period; lastPeriodChange: any; - subcourtID: { + arbitrated: { __typename?: "Arbitrable"; id: string }; + court: { __typename?: "Court"; id: string; policy?: string | null; @@ -2222,7 +3061,96 @@ export type CasesPageQuery = { timesPerPeriod: Array; }; }>; - casesDataPoint?: { __typename?: "CasesDataPoint"; value: any } | null; + counter?: { __typename?: "Counter"; cases: any } | null; +}; + +export type ClassicAppealQueryVariables = Exact<{ + disputeID: Scalars["ID"]; +}>; + +export type ClassicAppealQuery = { + __typename?: "Query"; + dispute?: { + __typename?: "Dispute"; + lastPeriodChange: any; + court: { __typename?: "Court"; id: string; timesPerPeriod: Array }; + arbitrated: { __typename?: "Arbitrable"; id: string }; + disputeKitDispute?: { + __typename?: "ClassicDispute"; + id: string; + currentLocalRoundIndex: any; + localRounds: Array<{ + __typename?: "ClassicRound"; + winningChoice: any; + paidFees: Array; + fundedChoices: Array; + }>; + } | null; + } | null; +}; + +export type CourtDetailsQueryVariables = Exact<{ + id: Scalars["ID"]; +}>; + +export type CourtDetailsQuery = { + __typename?: "Query"; + court?: { + __typename?: "Court"; + policy?: string | null; + minStake: any; + alpha: any; + numberDisputes: any; + numberStakedJurors: any; + stake: any; + paidETH: any; + paidPNK: any; + } | null; +}; + +export type CourtPolicyUriQueryVariables = Exact<{ + courtID: Scalars["ID"]; +}>; + +export type CourtPolicyUriQuery = { + __typename?: "Query"; + court?: { __typename?: "Court"; policy?: string | null } | null; +}; + +export type CourtTreeQueryVariables = Exact<{ [key: string]: never }>; + +export type CourtTreeQuery = { + __typename?: "Query"; + court?: { + __typename?: "Court"; + name?: string | null; + id: string; + children: Array<{ + __typename?: "Court"; + name?: string | null; + id: string; + children: Array<{ + __typename?: "Court"; + name?: string | null; + id: string; + children: Array<{ + __typename?: "Court"; + name?: string | null; + id: string; + children: Array<{ + __typename?: "Court"; + name?: string | null; + id: string; + children: Array<{ + __typename?: "Court"; + name?: string | null; + id: string; + }>; + }>; + }>; + }>; + }>; + } | null; }; export type DisputeDetailsQueryVariables = Exact<{ @@ -2233,17 +3161,17 @@ export type DisputeDetailsQuery = { __typename?: "Query"; dispute?: { __typename?: "Dispute"; - arbitrated: any; period: Period; ruled: boolean; lastPeriodChange: any; - subcourtID: { + court: { __typename?: "Court"; id: string; timesPerPeriod: Array; hiddenVotes: boolean; feeForJuror: any; }; + arbitrated: { __typename?: "Arbitrable"; id: string }; } | null; }; @@ -2255,7 +3183,6 @@ export type DrawQueryVariables = Exact<{ export type DrawQuery = { __typename?: "Query"; draws: Array<{ __typename?: "Draw"; voteID: any }>; - votes: Array<{ __typename?: "Vote"; id: string }>; }; export type EvidencesQueryVariables = Exact<{ @@ -2265,10 +3192,10 @@ export type EvidencesQueryVariables = Exact<{ export type EvidencesQuery = { __typename?: "Query"; evidences: Array<{ - __typename?: "Evidence"; + __typename?: "ClassicEvidence"; id: string; evidence: string; - sender: any; + sender: { __typename?: "User"; id: string }; }>; }; @@ -2279,30 +3206,14 @@ export type HomePageQueryVariables = Exact<{ export type HomePageQuery = { __typename?: "Query"; disputes: Array<{ __typename?: "Dispute"; id: string }>; - pnkstakedDataPoints: Array<{ - __typename?: "PNKStakedDataPoint"; - id: string; - value: any; - }>; - ethpaidDataPoints: Array<{ - __typename?: "ETHPaidDataPoint"; + counters: Array<{ + __typename?: "Counter"; id: string; - value: any; - }>; - pnkredistributedDataPoints: Array<{ - __typename?: "PNKRedistributedDataPoint"; - id: string; - value: any; - }>; - activeJurorsDataPoints: Array<{ - __typename?: "ActiveJurorsDataPoint"; - id: string; - value: any; - }>; - casesDataPoints: Array<{ - __typename?: "CasesDataPoint"; - id: string; - value: any; + stakedPNK: any; + paidETH: any; + redistributedPNK: any; + activeJurors: any; + cases: any; }>; }; @@ -2314,16 +3225,21 @@ export type VotingHistoryQuery = { __typename?: "Query"; dispute?: { __typename?: "Dispute"; - rounds: Array<{ - __typename?: "Round"; - nbVotes: any; - totalVoted: any; - votes: Array<{ - __typename?: "Vote"; - choice?: any | null; - justification?: string | null; - juror: { __typename?: "Juror"; id: string }; + id: string; + rounds: Array<{ __typename?: "Round"; nbVotes: any }>; + disputeKitDispute?: { + __typename?: "ClassicDispute"; + localRounds: Array<{ + __typename?: "ClassicRound"; + totalVoted: any; + votes: Array<{ + __typename?: "ClassicVote"; + choice: any; + justification: string; + id: string; + juror: { __typename?: "User"; id: string }; + }>; }>; - }>; + } | null; } | null; }; diff --git a/web/src/hooks/queries/useAppealCost.ts b/web/src/hooks/queries/useAppealCost.ts new file mode 100644 index 000000000..8181bddf4 --- /dev/null +++ b/web/src/hooks/queries/useAppealCost.ts @@ -0,0 +1,13 @@ +import useSWRImmutable from "swr/immutable"; +import { useConnectedContract } from "hooks/useConnectedContract"; + +export const useAppealCost = (disputeID?: string) => { + const KlerosCore = useConnectedContract("KlerosCore"); + return useSWRImmutable( + () => (KlerosCore ? `AppealCost${disputeID}` : false), + async () => { + if (!KlerosCore) return; + return KlerosCore.appealCost(disputeID); + } + ); +}; diff --git a/web/src/hooks/queries/useCasesQuery.ts b/web/src/hooks/queries/useCasesQuery.ts index 81e779584..082ee7b53 100644 --- a/web/src/hooks/queries/useCasesQuery.ts +++ b/web/src/hooks/queries/useCasesQuery.ts @@ -12,8 +12,10 @@ const casesQuery = gql` orderDirection: desc ) { id - arbitrated - courtID { + arbitrated { + id + } + court { id policy feeForJuror @@ -22,8 +24,8 @@ const casesQuery = gql` period lastPeriodChange } - casesDataPoint(id: "0") { - value + counter(id: "0") { + cases } } `; diff --git a/web/src/hooks/queries/useClassicAppealQuery.ts b/web/src/hooks/queries/useClassicAppealQuery.ts new file mode 100644 index 000000000..f330ffa7a --- /dev/null +++ b/web/src/hooks/queries/useClassicAppealQuery.ts @@ -0,0 +1,43 @@ +import useSWR from "swr"; +import { gql } from "graphql-request"; +import { ClassicAppealQuery } from "src/graphql/generated"; +export type { ClassicAppealQuery }; + +const classicAppealQuery = gql` + query ClassicAppeal($disputeID: ID!) { + dispute(id: $disputeID) { + court { + id + timesPerPeriod + } + arbitrated { + id + } + lastPeriodChange + disputeKitDispute { + id + currentLocalRoundIndex + localRounds { + ... on ClassicRound { + winningChoice + paidFees + fundedChoices + } + } + } + } + } +`; + +export const useClassicAppealQuery = (id?: string | number) => { + const { data, error, isValidating } = useSWR(() => + typeof id !== "undefined" + ? { + query: classicAppealQuery, + variables: { disputeID: id?.toString() }, + } + : false + ); + const result = data ? (data as ClassicAppealQuery) : undefined; + return { data: result, error, isValidating }; +}; diff --git a/web/src/hooks/queries/useCourtDetails.ts b/web/src/hooks/queries/useCourtDetails.ts new file mode 100644 index 000000000..225957102 --- /dev/null +++ b/web/src/hooks/queries/useCourtDetails.ts @@ -0,0 +1,32 @@ +import useSWR from "swr"; +import { gql } from "graphql-request"; +import { CourtDetailsQuery } from "src/graphql/generated"; +export type { CourtDetailsQuery }; + +const courtDetailsQuery = gql` + query CourtDetails($id: ID!) { + court(id: $id) { + policy + minStake + alpha + numberDisputes + numberStakedJurors + stake + paidETH + paidPNK + } + } +`; + +export const useCourtDetails = (id?: string) => { + const { data, error, isValidating } = useSWR( + id + ? { + query: courtDetailsQuery, + variables: { id }, + } + : null + ); + const result = data ? (data as CourtDetailsQuery) : undefined; + return { data: result, error, isValidating }; +}; diff --git a/web/src/hooks/queries/useCourtPolicy.ts b/web/src/hooks/queries/useCourtPolicy.ts index be92202d8..32bcdd8bc 100644 --- a/web/src/hooks/queries/useCourtPolicy.ts +++ b/web/src/hooks/queries/useCourtPolicy.ts @@ -1,20 +1,7 @@ -import useSWRImmutable from "swr/immutable"; -import { PolicyRegistry } from "@kleros/kleros-v2-contracts/typechain-types/src/arbitration/PolicyRegistry"; -import { useConnectedContract } from "hooks/useConnectedContract"; +import { useCourtPolicyURI } from "queries/useCourtPolicyURI"; +import { useIPFSQuery } from "../useIPFSQuery"; -export const useCourtPolicy = (courtID?: number) => { - const policyRegistry = useConnectedContract( - "PolicyRegistry" - ) as PolicyRegistry; - return useSWRImmutable( - () => (policyRegistry && courtID ? `PolicyRegistry${courtID}` : false), - async () => { - if (policyRegistry) { - const policyFilter = policyRegistry.filters.PolicyUpdate(courtID); - return policyRegistry - .queryFilter(policyFilter) - .then((events) => events[0]); - } else throw Error; - } - ); +export const useCourtPolicy = (courtID?: string) => { + const { data: policyURI } = useCourtPolicyURI(courtID); + return useIPFSQuery(policyURI); }; diff --git a/web/src/hooks/queries/useCourtPolicyURI.ts b/web/src/hooks/queries/useCourtPolicyURI.ts new file mode 100644 index 000000000..0cd406af9 --- /dev/null +++ b/web/src/hooks/queries/useCourtPolicyURI.ts @@ -0,0 +1,27 @@ +import useSWRImmutable from "swr/immutable"; +import { gql } from "graphql-request"; +import { CourtPolicyUriQuery } from "src/graphql/generated"; +export type { CourtPolicyUriQuery }; + +const courtPolicyURIQuery = gql` + query CourtPolicyURI($courtID: ID!) { + court(id: $courtID) { + policy + } + } +`; + +export const useCourtPolicyURI = (id?: string | number) => { + const { data, error, isValidating } = useSWRImmutable(() => + typeof id !== "undefined" + ? { + query: courtPolicyURIQuery, + variables: { courtID: id?.toString() }, + } + : false + ); + const result = data + ? (data.court.policy as CourtPolicyUriQuery.court.policy) + : undefined; + return { data: result, error, isValidating }; +}; diff --git a/web/src/hooks/queries/useCourtTree.ts b/web/src/hooks/queries/useCourtTree.ts new file mode 100644 index 000000000..eb321c7c6 --- /dev/null +++ b/web/src/hooks/queries/useCourtTree.ts @@ -0,0 +1,41 @@ +import useSWR from "swr"; +import { gql } from "graphql-request"; +import { CourtTreeQuery } from "src/graphql/generated"; +export type { CourtTreeQuery }; + +const courtTreeQuery = gql` + query CourtTree { + court(id: "1") { + name + id + children(orderBy: name) { + name + id + children { + name + id + children { + name + id + children { + name + id + children { + name + id + } + } + } + } + } + } + } +`; + +export const useCourtTree = () => { + const { data, error, isValidating } = useSWR({ + query: courtTreeQuery, + }); + const result = data ? (data as CourtTreeQuery) : undefined; + return { data: result, error, isValidating }; +}; diff --git a/web/src/hooks/queries/useDisputeDetailsQuery.ts b/web/src/hooks/queries/useDisputeDetailsQuery.ts index 779378ebc..0e1bc8f96 100644 --- a/web/src/hooks/queries/useDisputeDetailsQuery.ts +++ b/web/src/hooks/queries/useDisputeDetailsQuery.ts @@ -6,13 +6,15 @@ export type { DisputeDetailsQuery }; const disputeDetailsQuery = gql` query DisputeDetails($disputeID: ID!) { dispute(id: $disputeID) { - courtID { + court { id timesPerPeriod hiddenVotes feeForJuror } - arbitrated + arbitrated { + id + } period ruled lastPeriodChange @@ -21,10 +23,14 @@ const disputeDetailsQuery = gql` `; export const useDisputeDetailsQuery = (id?: string | number) => { - const { data, error, isValidating } = useSWR({ - query: () => (typeof id !== "undefined" ? disputeDetailsQuery : false), - variables: { disputeID: id?.toString() }, - }); + const { data, error, isValidating } = useSWR(() => + typeof id !== "undefined" + ? { + query: disputeDetailsQuery, + variables: { disputeID: id?.toString() }, + } + : false + ); const result = data ? (data as DisputeDetailsQuery) : undefined; return { data: result, error, isValidating }; }; diff --git a/web/src/hooks/queries/useDisputeKitClassicMultipliers.ts b/web/src/hooks/queries/useDisputeKitClassicMultipliers.ts new file mode 100644 index 000000000..c586a0ccf --- /dev/null +++ b/web/src/hooks/queries/useDisputeKitClassicMultipliers.ts @@ -0,0 +1,30 @@ +import useSWRImmutable from "swr/immutable"; +import { BigNumber } from "ethers"; +import { useConnectedContract } from "hooks/useConnectedContract"; + +export const useDisputeKitClassicMultipliers = () => { + const disputeKitClassic = useConnectedContract("DisputeKitClassic"); + return useSWRImmutable( + () => (disputeKitClassic ? `Multipliers` : false), + async () => { + if (!disputeKitClassic) return; + const winner_stake_multiplier = + await disputeKitClassic.WINNER_STAKE_MULTIPLIER(); + const loser_stake_multiplier = + await disputeKitClassic.LOSER_STAKE_MULTIPLIER(); + const loser_appeal_period_multiplier = + await disputeKitClassic.LOSER_APPEAL_PERIOD_MULTIPLIER(); + return { + winner_stake_multiplier, + loser_stake_multiplier, + loser_appeal_period_multiplier, + }; + } + ); +}; + +export interface IDisputeKitClassicMultipliers { + winner_stake_multiplier: BigNumber; + loser_stake_multiplier: BigNumber; + loser_appeal_period_multiplier: BigNumber; +} diff --git a/web/src/hooks/queries/useDrawQuery.ts b/web/src/hooks/queries/useDrawQuery.ts index 8c85b735c..f789d95ff 100644 --- a/web/src/hooks/queries/useDrawQuery.ts +++ b/web/src/hooks/queries/useDrawQuery.ts @@ -8,9 +8,6 @@ const drawQuery = gql` draws(where: { dispute: $disputeID, juror: $address }) { voteID } - votes(where: { dispute: $disputeID, juror: $address }) { - id - } } `; diff --git a/web/src/hooks/queries/useETHBalance.ts b/web/src/hooks/queries/useETHBalance.ts new file mode 100644 index 000000000..2285934a9 --- /dev/null +++ b/web/src/hooks/queries/useETHBalance.ts @@ -0,0 +1,17 @@ +import useSWR from "swr"; +import { useWeb3 } from "hooks/useWeb3"; + +export function useETHBalance() { + const { library, account } = useWeb3(); + return useSWR( + () => (library && account ? `ETHBalance{account}` : false), + async () => { + if (library && account) { + const balance = await library.getBalance(account); + return balance; + } else { + return undefined; + } + } + ); +} diff --git a/web/src/hooks/queries/useEvidenceGroup.ts b/web/src/hooks/queries/useEvidenceGroup.ts index 9ad04db71..2f15e43b8 100644 --- a/web/src/hooks/queries/useEvidenceGroup.ts +++ b/web/src/hooks/queries/useEvidenceGroup.ts @@ -1,25 +1,33 @@ import useSWRImmutable from "swr/immutable"; -import { utils } from "ethers"; -import { IMetaEvidence } from "@kleros/kleros-v2-contracts/typechain-types/src/evidence/IMetaEvidence"; +// import { utils } from "ethers"; +// import { IMetaEvidence } from "@kleros/kleros-v2-contracts/typechain-types/src/evidence/IMetaEvidence"; import { useConnectedContract } from "hooks/useConnectedContract"; export const useEvidenceGroup = ( disputeID?: string, arbitrableAddress?: string ) => { - const formattedAddress = arbitrableAddress - ? utils.getAddress(arbitrableAddress) - : undefined; + // const formattedAddress = arbitrableAddress + // ? utils.getAddress(arbitrableAddress) + // : undefined; const arbitrable = useConnectedContract( "IMetaEvidence", - formattedAddress - ) as IMetaEvidence; + "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + 10200 + ); + // const arbitrable = useConnectedContract( + // "IMetaEvidence", + // formattedAddress + // ) as IMetaEvidence; return useSWRImmutable( () => arbitrable ? `EvidenceGroup${disputeID}${arbitrableAddress}` : false, async () => { if (arbitrable) { - const disputeFilter = arbitrable.filters.Dispute(null, disputeID); + const disputeFilter = arbitrable.filters.Dispute( + null, + parseInt(disputeID!) + 1 + ); const disputeEvents = await arbitrable.queryFilter(disputeFilter); return disputeEvents[0].args?._evidenceGroupID.toString(); } else throw Error; diff --git a/web/src/hooks/queries/useEvidences.ts b/web/src/hooks/queries/useEvidences.ts index 5e1445929..2f92c8c30 100644 --- a/web/src/hooks/queries/useEvidences.ts +++ b/web/src/hooks/queries/useEvidences.ts @@ -12,7 +12,9 @@ const evidencesQuery = gql` ) { id evidence - sender + sender { + id + } } } `; diff --git a/web/src/hooks/queries/useGetMetaEvidence.ts b/web/src/hooks/queries/useGetMetaEvidence.ts index c78fa47eb..2ff2910da 100644 --- a/web/src/hooks/queries/useGetMetaEvidence.ts +++ b/web/src/hooks/queries/useGetMetaEvidence.ts @@ -1,20 +1,27 @@ import useSWRImmutable from "swr/immutable"; -import { utils } from "ethers"; +// import { utils } from "ethers"; import { useConnectedContract } from "hooks/useConnectedContract"; export const useGetMetaEvidence = ( disputeID?: string, arbitrableAddress?: string ) => { - const formattedAddress = arbitrableAddress - ? utils.getAddress(arbitrableAddress) - : undefined; - const arbitrable = useConnectedContract("IMetaEvidence", formattedAddress); + // const formattedAddress = arbitrableAddress + // ? utils.getAddress(arbitrableAddress) + // : undefined; + const arbitrable = useConnectedContract( + "IMetaEvidence", + "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + 10200 + ); return useSWRImmutable( - () => (arbitrable ? `MetaEvidence{disputeID}${arbitrableAddress}` : false), + () => (arbitrable ? `MetaEvidence${disputeID}${arbitrableAddress}` : false), async () => { if (arbitrable) { - const disputeFilter = arbitrable.filters.Dispute(null, disputeID); + const disputeFilter = arbitrable.filters.Dispute( + null, + parseInt(disputeID) + 1 + ); const disputeEvents = await arbitrable.queryFilter(disputeFilter); const metaEvidenceFilter = arbitrable.filters.MetaEvidence( disputeEvents[0].args?._metaEvidenceID @@ -23,7 +30,7 @@ export const useGetMetaEvidence = ( metaEvidenceFilter ); return fetch( - `https://ipfs.kleros.io${metaEvidenceEvents[0].args?._evidence}` + `https://cloudflare-ipfs.com${metaEvidenceEvents[0].args?._evidence}` ).then((res) => res.json()); } else throw Error; } diff --git a/web/src/hooks/queries/useHomePageQuery.ts b/web/src/hooks/queries/useHomePageQuery.ts index 7f83658cc..f7f44c657 100644 --- a/web/src/hooks/queries/useHomePageQuery.ts +++ b/web/src/hooks/queries/useHomePageQuery.ts @@ -8,25 +8,13 @@ const homePageQuery = gql` disputes(first: 3) { id } - pnkstakedDataPoints(where: { id_gt: $timeframe }) { + counters(where: { id_gt: $timeframe }) { id - value - } - ethpaidDataPoints(where: { id_gt: $timeframe }) { - id - value - } - pnkredistributedDataPoints(where: { id_gt: $timeframe }) { - id - value - } - activeJurorsDataPoints(where: { id_gt: $timeframe }) { - id - value - } - casesDataPoints(where: { id_gt: $timeframe }) { - id - value + stakedPNK + paidETH + redistributedPNK + activeJurors + cases } } `; diff --git a/web/src/hooks/queries/useJurorBalance.ts b/web/src/hooks/queries/useJurorBalance.ts new file mode 100644 index 000000000..a2e2a30a9 --- /dev/null +++ b/web/src/hooks/queries/useJurorBalance.ts @@ -0,0 +1,21 @@ +import useSWR from "swr"; +import { KlerosCore } from "@kleros/kleros-v2-contracts/typechain-types/src/arbitration/KlerosCore"; +import { useConnectedContract } from "../useConnectedContract"; + +export const useJurorBalance = ( + user?: string | null, + courtId?: string | undefined +) => { + const klerosCore = useConnectedContract("KlerosCore") as KlerosCore; + return useSWR( + () => + klerosCore && user && courtId ? `JurorBalance{address}{courtId}` : false, + async () => { + if (klerosCore && user && courtId) { + return await klerosCore.getJurorBalance(user, courtId); + } else { + return undefined; + } + } + ); +}; diff --git a/web/src/hooks/queries/usePNKAllowance.ts b/web/src/hooks/queries/usePNKAllowance.ts new file mode 100644 index 000000000..8e082bbba --- /dev/null +++ b/web/src/hooks/queries/usePNKAllowance.ts @@ -0,0 +1,21 @@ +import useSWR from "swr"; +import { PNK } from "@kleros/kleros-v2-contracts/typechain-types/src/token/PNK"; +import { useConnectedContract } from "hooks/useConnectedContract"; +import { CONTRACTS } from "utils/getContract"; + +export const usePNKAllowance = (user?: string | null) => { + const pnkContract = useConnectedContract("PNK") as PNK; + return useSWR( + () => (pnkContract && user ? `PNKAllowance{user}` : false), + async () => { + if (pnkContract && user) { + return await pnkContract.allowance( + user, + CONTRACTS["KlerosCore"].address + ); + } else { + return undefined; + } + } + ); +}; diff --git a/web/src/hooks/queries/usePNKBalance.ts b/web/src/hooks/queries/usePNKBalance.ts new file mode 100644 index 000000000..9e6901775 --- /dev/null +++ b/web/src/hooks/queries/usePNKBalance.ts @@ -0,0 +1,18 @@ +import useSWR from "swr"; +import { PNK } from "@kleros/kleros-v2-contracts/typechain-types/src/token/PNK"; +import { useConnectedContract } from "hooks/useConnectedContract"; + +export const usePNKBalance = (user?: string | null) => { + const pnkContract = useConnectedContract("PNK") as PNK; + return useSWR( + () => (pnkContract && user ? `PNKBalance${user}` : false), + async () => { + if (pnkContract && user) { + const balance = await pnkContract.balanceOf(user); + return balance; + } else { + return undefined; + } + } + ); +}; diff --git a/web/src/hooks/queries/usePolicyRegistryEvent.ts b/web/src/hooks/queries/usePolicyRegistryEvent.ts new file mode 100644 index 000000000..77c9c3c71 --- /dev/null +++ b/web/src/hooks/queries/usePolicyRegistryEvent.ts @@ -0,0 +1,20 @@ +import useSWRImmutable from "swr/immutable"; +import { PolicyRegistry } from "@kleros/kleros-v2-contracts/typechain-types/src/arbitration/PolicyRegistry"; +import { useConnectedContract } from "hooks/useConnectedContract"; + +export const usePolicyRegistryEvent = (courtID?: string | number) => { + const policyRegistry = useConnectedContract( + "PolicyRegistry" + ) as PolicyRegistry; + return useSWRImmutable( + () => (policyRegistry && courtID ? `PolicyRegistry${courtID}` : false), + async () => { + if (policyRegistry) { + const policyFilter = policyRegistry.filters.PolicyUpdate(courtID); + return policyRegistry + .queryFilter(policyFilter) + .then((events) => events[0]); + } else throw Error; + } + ); +}; diff --git a/web/src/hooks/queries/useVotingHistory.ts b/web/src/hooks/queries/useVotingHistory.ts index 966939d8c..9bff562fc 100644 --- a/web/src/hooks/queries/useVotingHistory.ts +++ b/web/src/hooks/queries/useVotingHistory.ts @@ -6,15 +6,25 @@ export type { VotingHistoryQuery }; const votingHistoryQuery = gql` query VotingHistory($disputeID: ID!) { dispute(id: $disputeID) { + id rounds { nbVotes - totalVoted - votes { - juror { - id + } + disputeKitDispute { + localRounds { + ... on ClassicRound { + totalVoted + votes { + id + juror { + id + } + ... on ClassicVote { + choice + justification + } + } } - choice - justification } } } @@ -22,10 +32,14 @@ const votingHistoryQuery = gql` `; export const useVotingHistory = (disputeID?: string) => { - const { data, error, isValidating } = useSWR({ - query: votingHistoryQuery, - variables: { disputeID }, - }); + const { data, error, isValidating } = useSWR(() => + typeof disputeID !== "undefined" + ? { + query: votingHistoryQuery, + variables: { disputeID }, + } + : false + ); const result = data ? (data as VotingHistoryQuery) : undefined; return { data: result, error, isValidating }; }; diff --git a/web/src/hooks/useClassicAppealContext.tsx b/web/src/hooks/useClassicAppealContext.tsx new file mode 100644 index 000000000..234aaaff0 --- /dev/null +++ b/web/src/hooks/useClassicAppealContext.tsx @@ -0,0 +1,192 @@ +import React, { useMemo, useState, createContext, useContext } from "react"; +import { useParams } from "react-router-dom"; +import { BigNumber } from "ethers"; +import { ONE_BASIS_POINT } from "consts/index"; +import { Periods } from "consts/periods"; +import { notUndefined } from "utils/index"; +import { useGetMetaEvidence } from "queries/useGetMetaEvidence"; +import { useAppealCost } from "queries/useAppealCost"; +import { useDisputeKitClassicMultipliers } from "queries/useDisputeKitClassicMultipliers"; +import { + useClassicAppealQuery, + ClassicAppealQuery, +} from "queries/useClassicAppealQuery"; +import { useCountdown } from "hooks/useCountdown"; + +const LoserSideCountdownContext = createContext(undefined); + +const OptionsContext = createContext(undefined); + +interface ISelectedOptionContext { + selectedOption: number | undefined; + setSelectedOption: (arg0: number) => void; +} +const SelectedOptionContext = createContext({ + selectedOption: undefined, + //eslint-disable-next-line @typescript-eslint/no-empty-function + setSelectedOption: () => {}, +}); + +interface IFundingContext { + winningChoice: string | undefined; + paidFees: BigNumber[] | undefined; + loserRequiredFunding: BigNumber | undefined; + winnerRequiredFunding: BigNumber | undefined; + fundedChoices: string[] | undefined; +} +const FundingContext = createContext({ + winningChoice: undefined, + paidFees: undefined, + loserRequiredFunding: undefined, + winnerRequiredFunding: undefined, + fundedChoices: undefined, +}); + +export const ClassicAppealProvider: React.FC<{ + children: React.ReactNode; +}> = ({ children }) => { + const { id } = useParams(); + const { data } = useClassicAppealQuery(id); + const dispute = data?.dispute; + const paidFees = getPaidFees(data?.dispute); + const winningChoice = getWinningChoice(data?.dispute); + const { data: appealCost } = useAppealCost(id); + const arbitrable = data?.dispute?.arbitrated.id; + const { data: metaEvidence } = useGetMetaEvidence(id, arbitrable); + const { data: multipliers } = useDisputeKitClassicMultipliers(); + const options = ["Refuse to Arbitrate"].concat( + metaEvidence?.rulingOptions?.titles + ); + const loserSideCountdown = useLoserSideCountdown( + dispute?.lastPeriodChange, + dispute?.court.timesPerPeriod[Periods.appeal], + multipliers?.loser_appeal_period_multiplier.toString() + ); + const loserRequiredFunding = getLoserRequiredFunding( + appealCost, + multipliers?.loser_stake_multiplier + ); + const winnerRequiredFunding = getWinnerRequiredFunding( + appealCost, + multipliers?.winner_stake_multiplier + ); + const fundedChoices = getFundedChoices(data?.dispute); + const [selectedOption, setSelectedOption] = useState(); + return ( + + ({ selectedOption, setSelectedOption }), + [selectedOption, setSelectedOption] + )} + > + ({ + winningChoice, + paidFees, + loserRequiredFunding, + winnerRequiredFunding, + fundedChoices, + }), + [ + winningChoice, + paidFees, + loserRequiredFunding, + winnerRequiredFunding, + fundedChoices, + ] + )} + > + + {children} + + + + + ); +}; + +export const useLoserSideCountdownContext = () => + useContext(LoserSideCountdownContext); +export const useSelectedOptionContext = () => useContext(SelectedOptionContext); +export const useFundingContext = () => useContext(FundingContext); +export const useOptionsContext = () => useContext(OptionsContext); + +const getCurrentLocalRound = (dispute?: ClassicAppealQuery["dispute"]) => { + const currentLocalRoundIndex = + dispute?.disputeKitDispute?.currentLocalRoundIndex; + return dispute?.disputeKitDispute?.localRounds[currentLocalRoundIndex]; +}; + +const getPaidFees = (dispute?: ClassicAppealQuery["dispute"]) => { + const currentLocalRound = getCurrentLocalRound(dispute); + return currentLocalRound?.paidFees.map((amount) => BigNumber.from(amount)); +}; + +const getFundedChoices = (dispute?: ClassicAppealQuery["dispute"]) => { + const currentLocalRound = getCurrentLocalRound(dispute); + return currentLocalRound?.fundedChoices; +}; + +const getWinningChoice = (dispute?: ClassicAppealQuery["dispute"]) => { + const currentLocalRound = getCurrentLocalRound(dispute); + return currentLocalRound?.winningChoice; +}; + +const getLoserRequiredFunding = ( + appealCost: BigNumber, + loser_stake_multiplier: BigNumber +): BigNumber => + notUndefined([appealCost, loser_stake_multiplier]) + ? appealCost.add( + loser_stake_multiplier.mul(appealCost).div(ONE_BASIS_POINT) + ) + : BigNumber.from(0); + +const getWinnerRequiredFunding = ( + appealCost: BigNumber, + winner_stake_multiplier: BigNumber +): BigNumber => + notUndefined([appealCost, winner_stake_multiplier]) + ? appealCost.add( + winner_stake_multiplier.mul(appealCost).div(ONE_BASIS_POINT) + ) + : BigNumber.from(0); + +const getDeadline = ( + lastPeriodChange: string, + appealPeriodDuration: string, + loserTimeMultiplier: string +): number => { + const parsedLastPeriodChange = BigNumber.from(lastPeriodChange); + const parsedAppealPeriodDuration = BigNumber.from(appealPeriodDuration); + const parsedLoserTimeMultiplier = BigNumber.from(loserTimeMultiplier); + const loserAppealPeriodDuration = parsedAppealPeriodDuration + .mul(parsedLoserTimeMultiplier) + .div(ONE_BASIS_POINT); + return loserAppealPeriodDuration.add(parsedLastPeriodChange).toNumber(); +}; + +function useLoserSideCountdown( + lastPeriodChange: string, + appealPeriodDuration: string, + loserTimeMultiplier: string +) { + const deadline = useMemo( + () => + notUndefined([ + lastPeriodChange, + appealPeriodDuration, + loserTimeMultiplier, + ]) + ? getDeadline( + lastPeriodChange, + appealPeriodDuration, + loserTimeMultiplier + ) + : 0, + [lastPeriodChange, appealPeriodDuration, loserTimeMultiplier] + ); + return useCountdown(deadline); +} diff --git a/web/src/hooks/useConnectedContract.ts b/web/src/hooks/useConnectedContract.ts index a4f09b286..8e725467e 100644 --- a/web/src/hooks/useConnectedContract.ts +++ b/web/src/hooks/useConnectedContract.ts @@ -1,24 +1,26 @@ import { useWeb3 } from "hooks/useWeb3"; import { JsonRpcProvider } from "@ethersproject/providers"; import { getContract, ContractName } from "utils/getContract"; +import { QUERY_CHAINS } from "consts/chains"; export type { ContractName }; export const useConnectedContract = ( contractName: ContractName, - contractAddress?: string - // chainId?: number + contractAddress?: string, + chain?: number ) => { const { library } = useWeb3(); const contract = getContract(contractName, contractAddress); - if (library) { + if (library && !chain) { const connectedContract = contract?.connect(library.getSigner()); return connectedContract; } else { try { - const provider = new JsonRpcProvider( - "https://arb-goerli.g.alchemy.com/v2/HAAmSjN1RzxG1LNsGh9Je72bYVPsyFfQ" - ); + const rpcUrl = chain + ? QUERY_CHAINS[chain].rpcUrls[0] + : "https://arb-goerli.g.alchemy.com/v2/HAAmSjN1RzxG1LNsGh9Je72bYVPsyFfQ"; + const provider = new JsonRpcProvider(rpcUrl); const connectedContract = contract?.connect(provider); return connectedContract; } catch (error) { diff --git a/web/src/hooks/useCountdown.ts b/web/src/hooks/useCountdown.ts new file mode 100644 index 000000000..85e102566 --- /dev/null +++ b/web/src/hooks/useCountdown.ts @@ -0,0 +1,18 @@ +import { useState, useEffect } from "react"; +import { getTimeLeft } from "utils/date"; + +export function useCountdown(deadline?: number): number | undefined { + const [counter, setCounter] = useState(); + useEffect(() => { + if (typeof deadline !== "undefined") { + const timeLeft = getTimeLeft(deadline); + setCounter(timeLeft); + } + }, [deadline]); + useEffect(() => { + typeof counter !== "undefined" && + counter > 0 && + setTimeout(() => setCounter(counter - 1), 1000); + }, [counter]); + return counter; +} diff --git a/web/src/hooks/useHomePageContext.tsx b/web/src/hooks/useHomePageContext.tsx index 2eec861ef..9ec6b5529 100644 --- a/web/src/hooks/useHomePageContext.tsx +++ b/web/src/hooks/useHomePageContext.tsx @@ -8,12 +8,7 @@ interface IContext { isValidating: boolean; } -export type HomePageQueryDataPoints = - | HomePageQuery["pnkstakedDataPoints"] - | HomePageQuery["pnkredistributedDataPoints"] - | HomePageQuery["casesDataPoints"] - | HomePageQuery["ethpaidDataPoints"] - | HomePageQuery["activeJurorsDataPoints"]; +export type HomePageQueryDataPoints = keyof HomePageQuery["counters"][number]; const Context = createContext({ data: undefined, diff --git a/web/src/hooks/useIPFSQuery.ts b/web/src/hooks/useIPFSQuery.ts index f8a0bc64c..440c95998 100644 --- a/web/src/hooks/useIPFSQuery.ts +++ b/web/src/hooks/useIPFSQuery.ts @@ -4,10 +4,9 @@ export const useIPFSQuery = (ipfsPath?: string) => { return useSWRImmutable( () => (ipfsPath !== undefined ? ipfsPath : false), async () => { - console.log("ipfsQuery"); if (ipfsPath) { - return fetch(`https://ipfs.kleros.io${ipfsPath}`).then((res) => - res.json() + return fetch(`https://cloudflare-ipfs.com${ipfsPath}`).then( + async (res) => await res.json() ); } else throw Error; } diff --git a/web/src/hooks/useParsedAmount.ts b/web/src/hooks/useParsedAmount.ts new file mode 100644 index 000000000..d3b522710 --- /dev/null +++ b/web/src/hooks/useParsedAmount.ts @@ -0,0 +1,9 @@ +import { useMemo } from "react"; +import { BigNumber, utils } from "ethers"; + +export function useParsedAmount(amount: string) { + return useMemo( + () => (amount === "" ? BigNumber.from(0) : utils.parseUnits(amount, 18)), + [amount] + ); +} diff --git a/web/src/index.html b/web/src/index.html index 2474662b3..559ef32f0 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -3,7 +3,16 @@ - My First Parcel App + + + + Kleros · Court
diff --git a/web/src/index.tsx b/web/src/index.tsx index 31508c17d..a5f6a2bb2 100644 --- a/web/src/index.tsx +++ b/web/src/index.tsx @@ -1,11 +1,24 @@ import React from "react"; import { createRoot } from "react-dom/client"; +import * as Sentry from "@sentry/react"; +import { BrowserTracing } from "@sentry/tracing"; import App from "./app"; import Modal from "react-modal"; import { HashRouter as Router } from "react-router-dom"; -Modal.setAppElement("#app"); +Sentry.init({ + dsn: process.env.REACT_APP_SENTRY_ENDPOINT, + environment: process.env.REACT_APP_CONTEXT, + integrations: [new BrowserTracing()], + + // Set tracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production + tracesSampleRate: 1.0, +}); + const container = document.getElementById("app"); +Modal.setAppElement(container!); const root = createRoot(container!); root.render( diff --git a/web/src/layout/Header/index.tsx b/web/src/layout/Header/index.tsx index d936ad6b8..b82f299a4 100644 --- a/web/src/layout/Header/index.tsx +++ b/web/src/layout/Header/index.tsx @@ -44,9 +44,9 @@ const OpenContext = React.createContext({ }, }); -export const useOpenContext = () => { +export function useOpenContext() { return useContext(OpenContext); -}; +} const Header: React.FC = () => { const [isOpen, setIsOpen] = useState(false); diff --git a/web/src/layout/index.tsx b/web/src/layout/index.tsx index 6f4b73274..4a50039d3 100644 --- a/web/src/layout/index.tsx +++ b/web/src/layout/index.tsx @@ -1,6 +1,7 @@ import React from "react"; import styled from "styled-components"; import { Outlet } from "react-router-dom"; +import { ToastContainer } from "react-toastify"; import Header from "./Header"; import Footer from "./Footer"; @@ -9,9 +10,15 @@ const Container = styled.div` width: 100%; `; +const StyledToastContainer = styled(ToastContainer)` + padding: 16px; + padding-top: 70px; +`; + const Layout: React.FC = () => (
+